1 # Fuse Collinear Edges within a Wire
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 p1 = geompy.MakeVertex(0, 0, 0)
11 p2 = geompy.MakeVertex(70, 0, 0)
12 p3 = geompy.MakeVertex(70, 50, 0)
13 p4 = geompy.MakeVertex(70, 80, 0)
14 p5 = geompy.MakeVertex(50, 80, 0)
15 p6 = geompy.MakeVertex(20, 80, 0)
16 p7 = geompy.MakeVertex(0, 80, 0)
17 p8 = geompy.MakeVertex(0, 30, 0)
19 points = [p1, p2, p3, p4, p5, p6, p7, p8]
22 wire_1 = geompy.MakePolyline(points, True)
24 # suppress some vertices in the wire
25 wire_2 = geompy.FuseCollinearEdgesWithinWire(wire_1, [p3])
26 wire_3 = geompy.FuseCollinearEdgesWithinWire(wire_1, [p5, p6])
28 # suppress all suitable vertices in the wire
29 wire_4 = geompy.FuseCollinearEdgesWithinWire(wire_1, [])
31 wires = [wire_1, wire_2, wire_3, wire_4]
33 # add objects in the study
36 geompy.addToStudy(point, "p%d"%ii)
42 geompy.addToStudy(wire, "wire_%d"%ii)
43 wire_points = geompy.SubShapeAllSortedCentres(wire, geompy.ShapeType["VERTEX"])
45 for point in wire_points:
46 geompy.addToStudyInFather(wire, point, "point_%d"%jj)
52 salome.sg.updateObjBrowser(1)