geom/doc/salome/examples/check_conformity.py

46 lines
1.7 KiB
Python

# Check Conformity
import salome
salome.salome_init_without_session()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New()
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
Vertex_1 = geompy.MakeVertex(-30, -70, 0)
Vertex_2 = geompy.MakeVertex(-30, 50, 0)
Line_1 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_1)
Vertex_3 = geompy.MakeVertex(0, -50, 0)
Vertex_4 = geompy.MakeVertex(-40, -10, 0)
Vertex_5 = geompy.MakeVertex(0, 40, 0)
Arc_1 = geompy.MakeArc(Vertex_5, Vertex_4, Vertex_3)
Vertex_6 = geompy.MakeVertex(10, -50, 4)
Vertex_7 = geompy.MakeVertex(10, -50, 10)
Vertex_8 = geompy.MakeVertex(10, 40, 10)
Arc_1_vertex_3 = geompy.GetSubShape(Arc_1, [3])
Line_2 = geompy.MakeLineTwoPnt(Arc_1_vertex_3, Vertex_6)
Line_3 = geompy.MakeLineTwoPnt(Vertex_6, Vertex_7)
Line_4 = geompy.MakeLineTwoPnt(Vertex_7, Vertex_8)
Vertex_9 = geompy.MakeVertex(15, 40, 10)
Vertex_10 = geompy.MakeVertex(17, 0, 6)
Vertex_11 = geompy.MakeVertex(17, 0, 3)
Line_5 = geompy.MakeLineTwoPnt(Vertex_8, Vertex_9)
Line_6 = geompy.MakeLineTwoPnt(Vertex_9, Vertex_10)
Line_7 = geompy.MakeLineTwoPnt(Vertex_10, Vertex_11)
Arc_1_vertex_2 = geompy.GetSubShape(Arc_1, [2])
Line_8 = geompy.MakeLineTwoPnt(Vertex_11, Arc_1_vertex_2)
Wire_1 = geompy.MakeWire([Arc_1, Line_2, Line_3, Line_4, Line_5, Line_6, Line_7, Line_8], 1e-07)
Wire_2 = geompy.MakeWire([Line_1], 1e-07)
Compound_1 = geompy.MakeCompound([Wire_1, Wire_2])
# Get CheckConformity tool
cc = geompy.CheckConformity(Compound_1)
valid = cc.isValid()
dist = cc.distantShapes()
small = cc.smallEdges()
interfer = cc.interferingSubshapes()
intersect = cc.selfIntersected2D()