Fuse
import salome
salome.salome_init_without_session()
import GEOM
from salome.geom import geomBuilder
gg = salome.ImportComponentGUI("GEOM")
p1 = geompy.MakeVertex(25, 55, 0)
p2 = geompy.MakeVertex( 0, 0, 0)
v = geompy.MakeVector(p1, p2)
height = 35
radius1 = 20
cylinder = geompy.MakeCylinder(p1, v, radius1, height)
sphere = geompy.MakeSphereR(40)
box = geompy.MakeBoxDXDYDZ(80, 80, 80)
fuse1 = geompy.MakeFuse(cylinder, sphere)
fuse2 = geompy.MakeBoolean(cylinder, sphere, 3)
fuse3 = geompy.MakeFuseList([cylinder, sphere, box])
id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
id_sphere = geompy.addToStudy(sphere, "Sphere")
id_box = geompy.addToStudy(box, "Box")
id_fuse1 = geompy.addToStudy(fuse1, "Fuse_1")
id_fuse2 = geompy.addToStudy(fuse2, "Fuse_2")
id_fuse3 = geompy.addToStudy(fuse3, "Fuse_3")
gg.createAndDisplayGO(id_cylinder)
gg.setDisplayMode(id_cylinder,1)
gg.createAndDisplayGO(id_sphere)
gg.setDisplayMode(id_sphere,1)
gg.createAndDisplayGO(id_box)
gg.setDisplayMode(id_box,1)
gg.createAndDisplayGO(id_fuse1)
gg.setDisplayMode(id_fuse1,1)
gg.createAndDisplayGO(id_fuse2)
gg.setDisplayMode(id_fuse2,1)
gg.createAndDisplayGO(id_fuse3)
gg.setDisplayMode(id_fuse3,1)
Download this script
Common
import salome
salome.salome_init_without_session()
import GEOM
from salome.geom import geomBuilder
gg = salome.ImportComponentGUI("GEOM")
p1 = geompy.MakeVertex(25, 55, 0)
p2 = geompy.MakeVertex( 0, 0, 0)
v = geompy.MakeVector(p1, p2)
height = 35
radius1 = 20
cylinder = geompy.MakeCylinder(p1, v, radius1, height)
sphere = geompy.MakeSphereR(40)
box = geompy.MakeBoxDXDYDZ(80, 80, 80)
common1 = geompy.MakeCommon(cylinder, sphere)
common2 = geompy.MakeCommonList([cylinder, sphere, box])
id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
id_sphere = geompy.addToStudy(sphere, "Sphere")
id_box = geompy.addToStudy(box, "Box")
id_common1 = geompy.addToStudy(common1, "Common_1")
id_common2 = geompy.addToStudy(common2, "Common_2")
gg.createAndDisplayGO(id_cylinder)
gg.setDisplayMode(id_cylinder,1)
gg.createAndDisplayGO(id_sphere)
gg.setDisplayMode(id_sphere,1)
gg.createAndDisplayGO(id_box)
gg.setDisplayMode(id_box,1)
gg.createAndDisplayGO(id_common1)
gg.setDisplayMode(id_common1,1)
gg.createAndDisplayGO(id_common2)
gg.setDisplayMode(id_common2,1)
Download this script
Cut
import salome
salome.salome_init_without_session()
import GEOM
from salome.geom import geomBuilder
gg = salome.ImportComponentGUI("GEOM")
p1 = geompy.MakeVertex(25, 55, 0)
p2 = geompy.MakeVertex( 0, 0, 0)
v = geompy.MakeVector(p1, p2)
height = 35
radius1 = 20
cylinder = geompy.MakeCylinder(p1, v, radius1, height)
sphere = geompy.MakeSphereR(40)
box = geompy.MakeBoxDXDYDZ(80, 80, 80)
cut1 = geompy.MakeCut(cylinder, sphere)
cut2 = geompy.MakeCutList(cylinder, [sphere, box])
id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
id_sphere = geompy.addToStudy(sphere, "Sphere")
id_box = geompy.addToStudy(box, "Box")
id_cut1 = geompy.addToStudy(cut1, "Cut_1")
id_cut2 = geompy.addToStudy(cut2, "Cut_2")
gg.createAndDisplayGO(id_cylinder)
gg.setDisplayMode(id_cylinder,1)
gg.createAndDisplayGO(id_sphere)
gg.setDisplayMode(id_sphere,1)
gg.createAndDisplayGO(id_box)
gg.setDisplayMode(id_box,1)
gg.createAndDisplayGO(id_cut1)
gg.setDisplayMode(id_cut1,1)
gg.createAndDisplayGO(id_cut2)
gg.setDisplayMode(id_cut2,1)
Download this script
Intersection
import salome
salome.salome_init_without_session()
import GEOM
from salome.geom import geomBuilder
gg = salome.ImportComponentGUI("GEOM")
p1 = geompy.MakeVertex(25, 55, 0)
p2 = geompy.MakeVertex( 0, 0, 0)
v = geompy.MakeVector(p1, p2)
height = 35
radius1 = 20
cylinder = geompy.MakeCylinder(p1, v, radius1, height)
sphere = geompy.MakeSphereR(40)
section = geompy.MakeSection(cylinder, sphere)
id_section = geompy.addToStudy(section, "Section")
gg.createAndDisplayGO(id_section)
gg.setDisplayMode(id_section,1)
Download this script