Salome HOME
Fix pb with make test on OCCT 6.9.0
[modules/geom.git] / doc / salome / examples / check_self_intersections.py
index 44c55d257ded8aabc79cb67a0cd89d6daba9c639..f70a545408742406726db20a2cda0181fba96cc9 100644 (file)
@@ -1,11 +1,21 @@
 # Detect Self-intersections
 
-import geompy
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
 
 # create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-IsValid = geompy.CheckSelfIntersections(box)
-if IsValid == 0:
-    raise RuntimeError, "Box with self-intersections created"
+box = geompy.MakeBoxDXDYDZ(100,100,100)
+# create a cylinder
+cylinder = geompy.MakeCylinderRH(100, 300)
+# make a compound
+compound = geompy.MakeCompound([box, cylinder])
+
+# check self-intersection
+IsValid = geompy.CheckSelfIntersections(compound)
+if not IsValid:
+    print "Shape is self-intersected!"
 else:
-    print "\nBox is valid"
+    print "No self-intersection detected in a shape"