X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Fsalome%2Fgui%2FGEOM%2Finput%2Ftui_repairing_operations.doc;h=0ce8b63dbd0d7b8df3eeb442b02b1cced53ab855;hb=00621ab4f35ece96476fc358acf598d78ec0a95d;hp=98dccc6f0e461a89ec71474eec60a5a5c5e03240;hpb=239f8109c64fa0c5a2e1d87a420bad5529b57f48;p=modules%2Fgeom.git diff --git a/doc/salome/gui/GEOM/input/tui_repairing_operations.doc b/doc/salome/gui/GEOM/input/tui_repairing_operations.doc index 98dccc6f0..0ce8b63db 100644 --- a/doc/salome/gui/GEOM/input/tui_repairing_operations.doc +++ b/doc/salome/gui/GEOM/input/tui_repairing_operations.doc @@ -65,7 +65,7 @@ box = geompy.MakeBoxDXDYDZ(200, 200, 200) # The list of IDs (IDList) for suppress faces sup_faces = [] -sup_faces = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"]) +sup_faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"]) # get indices of the sub-shape f1_id = geompy.GetSubShapeID(box, sup_faces[3]) @@ -182,7 +182,7 @@ cut = geompy.MakeCut(cone, cylinder) # get faces as sub-shapes faces = [] -faces = geompy.SubShapeAllSorted(cut, geompy.ShapeType["FACE"]) +faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"]) f_2 = geompy.GetSubShapeID(cut, faces[2]) # remove one face from the shape @@ -190,7 +190,7 @@ cut_without_f_2 = geompy.SuppressFaces(cut, [f_2]) # get wires as sub-shapes wires = [] -wires = geompy.SubShapeAllSorted(cut_without_f_2, geompy.ShapeType["WIRE"]) +wires = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["WIRE"]) w_0 = geompy.GetSubShapeID(cut_without_f_2, wires[0]) # suppress the selected wire @@ -289,6 +289,77 @@ gg.createAndDisplayGO(id_glue) gg.setDisplayMode(id_glue,1) \endcode +\anchor tui_glue_edges +

Glue Edges

+ +\code +import geompy +import salome +gg = salome.ImportComponentGUI("GEOM") + +# create boxes +box1 = geompy.MakeBox(0,0,0,100,50,100) +box2 = geompy.MakeBox(100,0,0,250,50,100) + +# make compound +compound = geompy.MakeCompound([box1, box2]) + +# glue all compound's edges +tolerance = 1e-5 +glue1 = geompy.MakeGlueEdges(compound, tolerance) + +# glue some compound's edges +list_edges = geompy.GetGlueEdges(compound, tolerance) +glue2 = geompy.MakeGlueEdgesByList(compound, tolerance, [list_edges[0], list_edges[2]]) + +# add objects in study +geompy.addToStudy(box1, "Box1") +geompy.addToStudy(box2, "Box2") +geompy.addToStudy(compound, "Compound") +geompy.addToStudy(glue1, "Glue all edges") +geompy.addToStudy(glue2, "Glue two edges") + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) +\endcode + +\anchor tui_limit_tolerance +

Limit Tolerance

+ +\code +import geompy +gg = salome.ImportComponentGUI("GEOM") + +# import initial topology +shape1 = geompy.ImportBREP("my_shape_1.brep") +shape2 = geompy.ImportBREP("my_shape_2.brep") + +geompy.addToStudy(shape1, "Shape 1") +geompy.addToStudy(shape2, "Shape 2") + +# perform partition +try: + part = geompy.MakePartition([shape1, shape2]) +except: + # limit tolerance + tolerance = 1e-07 + shape1_lt = geompy.LimitTolerance(shape1, tolerance) + shape2_lt = geompy.LimitTolerance(shape2, tolerance) + + # process shape + good_shape1 = geompy.ProcessShape(shape1_lt, ["FixShape"], ["FixShape.Tolerance3d"], ["1e-7"]) + good_shape2 = geompy.ProcessShape(shape2_lt, ["FixShape"], ["FixShape.Tolerance3d"], ["1e-7"]) + + geompy.addToStudy(good_shape1, "Shape 1 corrected") + geompy.addToStudy(good_shape2, "Shape 2 corrected") + + # perform partition on corrected shapes + part = geompy.MakePartition([good_shape1, good_shape2]) + pass + +geompy.addToStudy(part, "Partition") +\endcode + \anchor tui_add_point_on_edge

Add Point on Edge

@@ -308,17 +379,69 @@ divide = geompy.DivideEdge(edge, -1, 0.5, 0) # add objects in the study id_edge = geompy.addToStudy(edge, "Edge") -edge_points = geompy.SubShapeAllSorted(edge, geompy.ShapeType["VERTEX"]) +edge_points = geompy.SubShapeAllSortedCentres(edge, geompy.ShapeType["VERTEX"]) for point in edge_points: geompy.addToStudyInFather(edge, point, "Edge's point") id_divide = geompy.addToStudy(divide, "Divided edge") -edge_points = geompy.SubShapeAllSorted(divide, geompy.ShapeType["VERTEX"]) +edge_points = geompy.SubShapeAllSortedCentres(divide, geompy.ShapeType["VERTEX"]) for point in edge_points: geompy.addToStudyInFather(divide, point, "Edge's point after divide") salome.sg.updateObjBrowser(1) \endcode +\anchor tui_fuse_collinear_edges +

Fuse Collinear Edges within a Wire

+ +\code +import geompy +import salome + +# create vertices +p1 = geompy.MakeVertex(0, 0, 0) +p2 = geompy.MakeVertex(70, 0, 0) +p3 = geompy.MakeVertex(70, 50, 0) +p4 = geompy.MakeVertex(70, 80, 0) +p5 = geompy.MakeVertex(50, 80, 0) +p6 = geompy.MakeVertex(20, 80, 0) +p7 = geompy.MakeVertex(0, 80, 0) +p8 = geompy.MakeVertex(0, 30, 0) + +points = [p1, p2, p3, p4, p5, p6, p7, p8] + +# make a wire +wire_1 = geompy.MakePolyline(points, True) + +# suppress some vertices in the wire +wire_2 = geompy.FuseCollinearEdgesWithinWire(wire_1, [p3]) +wire_3 = geompy.FuseCollinearEdgesWithinWire(wire_1, [p5, p6]) + +# suppress all suitable vertices in the wire +wire_4 = geompy.FuseCollinearEdgesWithinWire(wire_1, []) + +wires = [wire_1, wire_2, wire_3, wire_4] + +# add objects in the study +ii = 1 +for point in points: + geompy.addToStudy(point, "p%d"%ii) + ii = ii + 1 + pass + +ii = 1 +for wire in wires: + geompy.addToStudy(wire, "wire_%d"%ii) + wire_points = geompy.SubShapeAllSortedCentres(wire, geompy.ShapeType["VERTEX"]) + jj = 1 + for point in wire_points: + geompy.addToStudyInFather(wire, point, "point_%d"%jj) + jj = jj + 1 + pass + ii = ii + 1 + pass + +salome.sg.updateObjBrowser(1) +\endcode */