2013-02-12 17:35:16 +06:00
|
|
|
# Explode on Blocks
|
|
|
|
|
|
|
|
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 box and a sphere
|
|
|
|
box = geompy.MakeBoxDXDYDZ(200, 200, 200)
|
|
|
|
sphere = geompy.MakeSphereR(100)
|
|
|
|
|
|
|
|
# make a compound
|
|
|
|
compound = geompy.MakeCompound([box, sphere])
|
|
|
|
|
|
|
|
# get all the blocks of the given compound, by criteria: min_nb_faces <= nb. of faces <= max_nb_faces
|
|
|
|
min_nb_faces = 6
|
|
|
|
max_nb_faces = 6
|
|
|
|
make_block_explode = geompy.MakeBlockExplode(compound, min_nb_faces, max_nb_faces)
|
|
|
|
|
|
|
|
# add objects in the study
|
|
|
|
id_compound = geompy.addToStudy(compound, "Compound")
|
|
|
|
id_make_block_explode = geompy.addToStudyInFather(compound, make_block_explode[0], "MakeBlockExplode")
|
|
|
|
|
|
|
|
# display the results
|
|
|
|
gg.createAndDisplayGO(id_compound)
|
|
|
|
gg.createAndDisplayGO(id_make_block_explode)
|
|
|
|
gg.setDisplayMode(id_make_block_explode,1)
|