2013-02-12 17:35:16 +06:00
|
|
|
# Check Compound of Blocks
|
|
|
|
|
|
|
|
import salome
|
2013-04-04 13:06:43 +06:00
|
|
|
salome.salome_init()
|
|
|
|
import GEOM
|
|
|
|
from salome.geom import geomBuilder
|
|
|
|
geompy = geomBuilder.New(salome.myStudy)
|
2013-02-12 17:35:16 +06:00
|
|
|
gg = salome.ImportComponentGUI("GEOM")
|
|
|
|
|
|
|
|
# create boxes
|
|
|
|
box1 = geompy.MakeBox(0,0,0,100,50,100)
|
|
|
|
box2 = geompy.MakeBox(100,0,0,250,50,100)
|
|
|
|
|
|
|
|
# make a compound
|
|
|
|
compound = geompy.MakeCompound([box1, box2])
|
|
|
|
|
|
|
|
# glue the faces of the compound
|
|
|
|
tolerance = 1e-5
|
|
|
|
glue = geompy.MakeGlueFaces(compound, tolerance)
|
|
|
|
IsValid = geompy.CheckCompoundOfBlocks(glue)
|
|
|
|
if IsValid == 0:
|
2017-02-10 21:07:24 +05:00
|
|
|
raise RuntimeError("Invalid compound created")
|
2013-02-12 17:35:16 +06:00
|
|
|
else:
|
2017-02-10 21:07:24 +05:00
|
|
|
print("\nCompound is valid")
|