Boolean Operations

Fuse

import geompy

import salome

gg = salome.ImportComponentGUI("GEOM")

 

# create vertex and vector

p1 = geompy.MakeVertex(25, 55, 0)

p2 = geompy.MakeVertex( 0,  0, 0)

v = geompy.MakeVector(p1, p2)

 

# create cylinder

height = 35

radius1 = 20

cylinder = geompy.MakeCylinder(p1, v, radius1, height)

 

# create sphere

sphere = geompy.MakeSphereR(40)

 

# make fuse

fuse = geompy.MakeFuse(cylinder, sphere)

 

# add objects in study

id_cylinder = geompy.addToStudy(cylinder, "Cylinder")

id_sphere = geompy.addToStudy(sphere, "Sphere")

id_fuse = geompy.addToStudy(fuse, "Fuse")

 

# display results

gg.createAndDisplayGO(id_cylinder)

gg.setDisplayMode(id_cylinder,1)

gg.createAndDisplayGO(id_sphere)

gg.setDisplayMode(id_sphere,1)

gg.createAndDisplayGO(id_fuse)

gg.setDisplayMode(id_fuse,1)

 

Common

import geompy

import salome

gg = salome.ImportComponentGUI("GEOM")

 

# create vertex and vector

p1 = geompy.MakeVertex(25, 55, 0)

p2 = geompy.MakeVertex( 0,  0, 0)

v = geompy.MakeVector(p1, p2)

 

# create cylinder

height = 35

radius1 = 20

cylinder = geompy.MakeCylinder(p1, v, radius1, height)

 

# create sphere

sphere = geompy.MakeSphereR(40)

 

# make common

common = geompy.MakeCommon(cylinder, sphere)

 

# add objects in study

id_common = geompy.addToStudy(common, "Common")

 

# display results

gg.createAndDisplayGO(id_common)

gg.setDisplayMode(id_common,1)

 

Cut

import geompy

import salome

gg = salome.ImportComponentGUI("GEOM")

 

# create vertex and vector

p1 = geompy.MakeVertex(25, 55, 0)

p2 = geompy.MakeVertex( 0,  0, 0)

v = geompy.MakeVector(p1, p2)

 

# create cylinder

height = 35

radius1 = 20

cylinder = geompy.MakeCylinder(p1, v, radius1, height)

 

# create sphere

sphere = geompy.MakeSphereR(40)

 

# make cut

cut = geompy.MakeCut(cylinder, sphere)

 

# add objects in study

id_cut = geompy.addToStudy(cut, "Cut")

 

# display results

gg.createAndDisplayGO(id_cut)

gg.setDisplayMode(id_cut,1)

 

Section

import geompy

import salome

gg = salome.ImportComponentGUI("GEOM")

 

# create vertex and vector

p1 = geompy.MakeVertex(25, 55, 0)

p2 = geompy.MakeVertex( 0,  0, 0)

v = geompy.MakeVector(p1, p2)

 

# create cylinder

height = 35

radius1 = 20

cylinder = geompy.MakeCylinder(p1, v, radius1, height)

 

# create sphere

sphere = geompy.MakeSphereR(40)

 

# make section

section = geompy.MakeSection(cylinder, sphere)

 

# add objects in study

id_section = geompy.addToStudy(section, "Section")

 

# display results

gg.createAndDisplayGO(id_section)

gg.setDisplayMode(id_section,1)