2013-02-12 17:35:16 +06:00
|
|
|
# Fuse
|
|
|
|
|
|
|
|
import salome
|
2013-04-04 13:06:43 +06:00
|
|
|
salome.salome_init()
|
|
|
|
import GEOM
|
|
|
|
from salome.geom import geomBuilder
|
2017-06-13 14:57:14 +05:00
|
|
|
geompy = geomBuilder.New()
|
2013-02-12 17:35:16 +06:00
|
|
|
gg = salome.ImportComponentGUI("GEOM")
|
|
|
|
|
|
|
|
# create a vertex and a vector
|
|
|
|
p1 = geompy.MakeVertex(25, 55, 0)
|
|
|
|
p2 = geompy.MakeVertex( 0, 0, 0)
|
|
|
|
v = geompy.MakeVector(p1, p2)
|
|
|
|
|
|
|
|
# create a cylinder
|
|
|
|
height = 35
|
|
|
|
radius1 = 20
|
|
|
|
cylinder = geompy.MakeCylinder(p1, v, radius1, height)
|
|
|
|
|
|
|
|
# create a sphere
|
|
|
|
sphere = geompy.MakeSphereR(40)
|
|
|
|
|
2013-05-23 12:42:48 +06:00
|
|
|
# create a box
|
|
|
|
box = geompy.MakeBoxDXDYDZ(80, 80, 80)
|
|
|
|
|
2013-02-12 17:35:16 +06:00
|
|
|
# fuse
|
|
|
|
fuse1 = geompy.MakeFuse(cylinder, sphere)
|
|
|
|
fuse2 = geompy.MakeBoolean(cylinder, sphere, 3)
|
2013-05-23 12:42:48 +06:00
|
|
|
fuse3 = geompy.MakeFuseList([cylinder, sphere, box])
|
2013-02-12 17:35:16 +06:00
|
|
|
|
|
|
|
# add objects in the study
|
|
|
|
id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
|
|
|
|
id_sphere = geompy.addToStudy(sphere, "Sphere")
|
2013-05-23 12:42:48 +06:00
|
|
|
id_box = geompy.addToStudy(box, "Box")
|
2013-02-12 17:35:16 +06:00
|
|
|
id_fuse1 = geompy.addToStudy(fuse1, "Fuse_1")
|
|
|
|
id_fuse2 = geompy.addToStudy(fuse2, "Fuse_2")
|
2013-05-23 12:42:48 +06:00
|
|
|
id_fuse3 = geompy.addToStudy(fuse3, "Fuse_3")
|
2013-02-12 17:35:16 +06:00
|
|
|
|
|
|
|
# display results
|
|
|
|
gg.createAndDisplayGO(id_cylinder)
|
|
|
|
gg.setDisplayMode(id_cylinder,1)
|
|
|
|
gg.createAndDisplayGO(id_sphere)
|
|
|
|
gg.setDisplayMode(id_sphere,1)
|
2013-05-23 12:42:48 +06:00
|
|
|
gg.createAndDisplayGO(id_box)
|
|
|
|
gg.setDisplayMode(id_box,1)
|
2013-02-12 17:35:16 +06:00
|
|
|
gg.createAndDisplayGO(id_fuse1)
|
|
|
|
gg.setDisplayMode(id_fuse1,1)
|
|
|
|
gg.createAndDisplayGO(id_fuse2)
|
|
|
|
gg.setDisplayMode(id_fuse2,1)
|
2013-05-23 12:42:48 +06:00
|
|
|
gg.createAndDisplayGO(id_fuse3)
|
|
|
|
gg.setDisplayMode(id_fuse3,1)
|