Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Check Compound of Blocks
1 # Check Compound of Blocks
2 
3 import salome
4 salome.salome_init()
5 import GEOM
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI("GEOM")
9 
10 # create boxes
11 box1 = geompy.MakeBox(0,0,0,100,50,100)
12 box2 = geompy.MakeBox(100,0,0,250,50,100)
13 
14 # make a compound
15 compound = geompy.MakeCompound([box1, box2])
16 
17 # glue the faces of the compound
18 tolerance = 1e-5
19 glue = geompy.MakeGlueFaces(compound, tolerance)
20 IsValid = geompy.CheckCompoundOfBlocks(glue)
21 if IsValid == 0:
22  raise RuntimeError, "Invalid compound created"
23 else:
24  print "\nCompound is valid"

Download this script