6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 Vertex_1 = geompy.MakeVertex(0, 0, 0)
11 Vertex_2 = geompy.MakeVertex(0, 70, 0)
12 Vertex_3 = geompy.MakeVertex(30, 100, 0)
13 Vertex_4 = geompy.MakeVertex(60, 70, 0)
14 Vertex_5 = geompy.MakeVertex(90, 100, 0)
15 Vertex_6 = geompy.MakeVertex(120, 70, 0)
16 Vertex_7 = geompy.MakeVertex(120, 0, 0)
17 Vertex_8 = geompy.MakeVertex(90, -30, 0)
18 Vertex_9 = geompy.MakeVertex(60, 0, 0)
19 Vertex_10 = geompy.MakeVertex(30, -30, 0)
21 geompy.addToStudy( Vertex_1,
'Vertex_1' )
22 geompy.addToStudy( Vertex_2,
'Vertex_2' )
23 geompy.addToStudy( Vertex_3,
'Vertex_3' )
24 geompy.addToStudy( Vertex_4,
'Vertex_4' )
25 geompy.addToStudy( Vertex_5,
'Vertex_5' )
26 geompy.addToStudy( Vertex_6,
'Vertex_6' )
27 geompy.addToStudy( Vertex_7,
'Vertex_7' )
28 geompy.addToStudy( Vertex_8,
'Vertex_8' )
29 geompy.addToStudy( Vertex_9,
'Vertex_9' )
30 geompy.addToStudy( Vertex_10,
'Vertex_10' )
32 Curve_a = geompy.MakeInterpol([Vertex_2, Vertex_3, Vertex_4, Vertex_5, Vertex_6],
False,
True)
33 Curve_b = geompy.MakeInterpol([Vertex_1, Vertex_7, Vertex_8, Vertex_9, Vertex_10],
False,
True)
35 geompy.addToStudy( Curve_a,
'Curve_a' )
36 geompy.addToStudy( Curve_b,
'Curve_b' )
39 [nbSols, listCoords] = geompy.ClosestPoints(Curve_a, Curve_b)
41 for i
in range(nbSols):
42 v1 = geompy.MakeVertex(listCoords[i*6 + 0], listCoords[i*6 + 1], listCoords[i*6 + 2])
43 v2 = geompy.MakeVertex(listCoords[i*6 + 3], listCoords[i*6 + 4], listCoords[i*6 + 5])
45 geompy.addToStudy(v1,
'MinDist_%d_Curve_a'%(i+1))
46 geompy.addToStudy(v2,
'MinDist_%d_Curve_b'%(i+1))
49 print "Minimal distance between Curve_a and Curve_b is", geompy.MinDistance(Curve_a, Curve_b)
52 [aDist, DX, DY, DZ] = geompy.MinDistanceComponents(Curve_a, Curve_b)
53 print "Minimal distance between Curve_a and Curve_b is (", DX,
",", DY,
",", DZ,
")"