From 6b9fb8af9e4b0fa9b7b052d8f0b6e7a20e320b79 Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 28 Jun 2018 17:30:56 +0300 Subject: [PATCH] Fix for the issue #2514 : Error after load a python dump (RHF) Do not export degenerated edges to the naming structure. In this issue the degenerated and other edges in Revolution were exported in a changed order. --- src/FeaturesPlugin/CMakeLists.txt | 1 + src/FeaturesPlugin/Test/Test2514.py | 324 ++++++++++++++++++++++++++++ src/Model/Model_BodyBuilder.cpp | 3 +- 3 files changed, 327 insertions(+), 1 deletion(-) create mode 100644 src/FeaturesPlugin/Test/Test2514.py diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index 000ff2aa5..e8961edee 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -252,4 +252,5 @@ ADD_UNIT_TESTS(TestExtrusion.py Test2419_3.py Test2465.py Test2495.py + Test2514.py ) diff --git a/src/FeaturesPlugin/Test/Test2514.py b/src/FeaturesPlugin/Test/Test2514.py new file mode 100644 index 000000000..a4b592e6d --- /dev/null +++ b/src/FeaturesPlugin/Test/Test2514.py @@ -0,0 +1,324 @@ +## Copyright (C) 2014-2017 CEA/DEN, EDF R&D +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +## +## See http:##www.salome-platform.org/ or +## email : webmaster.salome@opencascade.com +## + +# -*- coding: utf-8 -*- + +from SketchAPI import * + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) +SketchLine_1 = Sketch_1.addLine(15, 17, 15, -3) +SketchLine_2 = Sketch_1.addLine(15, -3, 0, -3) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchLine_3 = SketchProjection_1.createdFeature() +SketchLine_3.setName("SketchLine_4") +SketchLine_3.result().setName("SketchLine_4") +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_4") +SketchArc_1 = Sketch_1.addArc(0, -8.980762113533162, 0, 21.01923788646684, 15, 17, True) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.result(), SketchArc_1.center()) +SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_5") +SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 15) +SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 20) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_7") +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 30) +SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_4 = SketchProjection_2.createdFeature() +SketchLine_4.setName("SketchLine_5") +SketchLine_4.result().setName("SketchLine_5") +SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_4.result(), 3, True) +SketchLine_5 = Sketch_1.addLine(15, 0, 16, 0) +SketchLine_5.setName("SketchLine_6") +SketchLine_5.result().setName("SketchLine_6") +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_8") +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_4.result()) +SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_9") +SketchLine_6 = Sketch_1.addLine(16, 0, 16, -3) +SketchLine_6.setName("SketchLine_7") +SketchLine_6.result().setName("SketchLine_7") +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_10") +SketchLine_7 = Sketch_1.addLine(16, -3, 15, -3) +SketchLine_7.setName("SketchLine_8") +SketchLine_7.result().setName("SketchLine_8") +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_11") +SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_12") +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_4.result()) +SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_13") +SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_2.result()) +SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_14") +SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 1) +SketchLine_8 = Sketch_1.addLine(15, 0, 0, 0) +SketchLine_8.setName("SketchLine_9") +SketchLine_8.result().setName("SketchLine_9") +SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_15") +SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_3).startPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_16") +SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_17") +model.do() +Edge_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_6"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_9")] +Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects) +Revolution_1_objects = [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_3"), model.selection("EDGE", "Edge_1_4"), model.selection("EDGE", "Edge_1_5"), model.selection("EDGE", "Edge_1_6"), model.selection("EDGE", "Edge_1_7")] +Revolution_1 = model.addRevolution(Part_1_doc, Revolution_1_objects, model.selection("EDGE", "PartSet/OZ"), 360, 0) +Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) +SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_2e"), False) +SketchPoint_1 = SketchProjection_3.createdFeature() +SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False) +SketchLine_9 = SketchProjection_4.createdFeature() +SketchLine_9.setName("SketchLine_11") +SketchLine_9.result().setName("SketchLine_11") +SketchLine_10 = Sketch_2.addLine(1.5, -3, -1.5, -3) +SketchLine_10.setName("SketchLine_10") +SketchLine_10.result().setName("SketchLine_10") +SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchLine_9.result()) +SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_18") +SketchLine_11 = Sketch_2.addLine(-1.5, -3, -1, -5) +SketchLine_11.setName("SketchLine_12") +SketchLine_11.result().setName("SketchLine_12") +SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_19") +SketchLine_12 = Sketch_2.addLine(-1, -5, 1, -5) +SketchLine_12.setName("SketchLine_13") +SketchLine_12.result().setName("SketchLine_13") +SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_20") +SketchLine_13 = Sketch_2.addLine(1, -5, 1.5, -3) +SketchLine_13.setName("SketchLine_14") +SketchLine_13.result().setName("SketchLine_14") +SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_21") +SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchLine_13.endPoint()) +SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_22") +SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_12.result()) +SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False) +SketchLine_14 = SketchProjection_5.createdFeature() +SketchLine_14.setName("SketchLine_15") +SketchLine_14.result().setName("SketchLine_15") +SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_14.result()) +SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_23") +SketchPoint_2 = Sketch_2.addPoint(-5.903605550615992e-026, -5) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_12.result()) +SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_24") +SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchPoint_2.coordinates(), SketchLine_12.result()) +SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchLine_15 = SketchProjection_6.createdFeature() +SketchLine_15.setName("SketchLine_16") +SketchLine_15.result().setName("SketchLine_16") +SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_15.result()) +SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_25") +SketchConstraintDistance_2 = Sketch_2.setDistance(SketchLine_11.endPoint(), SketchLine_10.result(), 2, True) +SketchConstraintLength_4 = Sketch_2.setLength(SketchLine_10.result(), 3) +SketchConstraintMiddle_2 = Sketch_2.setMiddlePoint(SketchAPI_Line(SketchLine_9).endPoint(), SketchLine_10.result()) +SketchConstraintLength_5 = Sketch_2.setLength(SketchLine_12.result(), 2) +model.do() +Edge_2_objects = [model.selection("EDGE", "Sketch_2/Edge-SketchLine_12"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_13"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_14"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_10")] +Edge_2 = model.addEdge(Part_1_doc, Edge_2_objects) +Extrusion_1_objects = [model.selection("EDGE", "Edge_2_1"), model.selection("EDGE", "Edge_2_2"), model.selection("EDGE", "Edge_2_3"), model.selection("EDGE", "Edge_2_4")] +Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection("EDGE", "PartSet/OY"), 3, 3) +Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_6")) +SketchLine_16 = Sketch_3.addLine(-15, 0, -10, 2.951677693621839e-024) +SketchLine_16.setName("SketchLine_17") +SketchLine_16.result().setName("SketchLine_17") +SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Revolution_1_6/Generated_Edge_1"), False) +SketchCircle_1 = SketchProjection_7.createdFeature() +SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_16.startPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_26") +SketchLine_17 = Sketch_3.addLine(-10, 2.951677693621839e-024, -10, -3) +SketchLine_17.setName("SketchLine_18") +SketchLine_17.result().setName("SketchLine_18") +SketchConstraintCoincidence_24 = Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_27") +SketchLine_18 = Sketch_3.addLine(-10, -3, -14.69693845669907, -3) +SketchLine_18.setName("SketchLine_19") +SketchLine_18.result().setName("SketchLine_19") +SketchConstraintCoincidence_25 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_28") +SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchLine_18.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_29") +SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_17.result()) +SketchConstraintCoincidence_27 = Sketch_3.setCoincident(SketchLine_16.result(), SketchAPI_Circle(SketchCircle_1).center()) +SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_30") +SketchConstraintParallel_1 = Sketch_3.setParallel(SketchLine_16.result(), SketchLine_18.result()) +SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_16.result(), 5) +SketchConstraintLength_7 = Sketch_3.setLength(SketchLine_17.result(), 3) +SketchConstraintMirror_1 = Sketch_3.addMirror(SketchLine_16.result(), [SketchLine_17.result(), SketchLine_18.result()]) +[SketchLine_19, SketchLine_20] = SketchConstraintMirror_1.mirrored() +SketchLine_20.setName("SketchLine_21") +SketchLine_20.result().setName("SketchLine_21") +SketchLine_19.setName("SketchLine_20") +SketchLine_19.result().setName("SketchLine_20") +SketchLine_21 = Sketch_3.addLine(-1.5, -2, 2, -2) +SketchLine_21.setName("SketchLine_22") +SketchLine_21.result().setName("SketchLine_22") +SketchLine_22 = Sketch_3.addLine(2, -2, 2, 2) +SketchLine_22.setName("SketchLine_23") +SketchLine_22.result().setName("SketchLine_23") +SketchConstraintCoincidence_28 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint()) +SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_31") +SketchLine_23 = Sketch_3.addLine(2, 2, -1.5, 2) +SketchLine_23.setName("SketchLine_24") +SketchLine_23.result().setName("SketchLine_24") +SketchConstraintCoincidence_29 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) +SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_32") +SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_24 = SketchProjection_8.createdFeature() +SketchLine_24.setName("SketchLine_25") +SketchLine_24.result().setName("SketchLine_25") +SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchLine_16.startPoint(), SketchLine_24.result()) +SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_33") +SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_23.result()) +SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_21.result()) +SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_22.result()) +SketchArc_2 = Sketch_3.addArc(0, 0, -1.5, -2, -1.5, 2, True) +SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchAPI_Circle(SketchCircle_1).center(), SketchArc_2.center()) +SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_34") +SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchArc_2.startPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_35") +SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchArc_2.endPoint(), SketchLine_23.endPoint()) +SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_36") +SketchPoint_3 = Sketch_3.addPoint(2, 0) +SketchConstraintCoincidence_34 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_22.result()) +SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_37") +SketchConstraintCoincidence_35 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_24.result()) +SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_38") +SketchConstraintMiddle_3 = Sketch_3.setMiddlePoint(SketchPoint_3.coordinates(), SketchLine_22.result()) +SketchLine_25 = Sketch_3.addLine(-1.5, -2, -1.5, 2) +SketchLine_25.setName("SketchLine_26") +SketchLine_25.result().setName("SketchLine_26") +SketchLine_25.setAuxiliary(True) +SketchConstraintCoincidence_36 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_39") +SketchConstraintCoincidence_37 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_25.endPoint()) +SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_40") +SketchProjection_9 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_12s-SketchLine_10e"), False) +SketchPoint_4 = SketchProjection_9.createdFeature() +SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_25.result()) +SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_41") +SketchConstraintLength_8 = Sketch_3.setLength(SketchLine_25.result(), 4) +SketchProjection_10 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_10s-SketchLine_14e"), False) +SketchPoint_5 = SketchProjection_10.createdFeature() +SketchConstraintDistance_3 = Sketch_3.setDistance(SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_22.result(), 0.5, True) +SketchLine_26 = Sketch_3.addLine(-7.5, -7.382311001750988e-022, -7.5, -3) +SketchLine_26.setName("SketchLine_27") +SketchLine_26.result().setName("SketchLine_27") +SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_26.result()) +SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_26.startPoint(), SketchLine_16.result()) +SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_42") +SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_26.endPoint(), SketchLine_18.result()) +SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_43") +SketchLine_27 = Sketch_3.addLine(-7.5, -7.382311001750988e-022, -2.500000000000019, -5.187200122832181e-016) +SketchLine_27.setName("SketchLine_28") +SketchLine_27.result().setName("SketchLine_28") +SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_26.startPoint(), SketchLine_27.startPoint()) +SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_44") +SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchLine_27.endPoint(), SketchArc_2.results()[1]) +SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_45") +SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_27.result()) +SketchConstraintDistance_4 = Sketch_3.setDistance(SketchLine_17.startPoint(), SketchLine_26.result(), 2.5, True) +SketchLine_28 = Sketch_3.addLine(2, 0, 11, 0) +SketchLine_28.setName("SketchLine_29") +SketchLine_28.result().setName("SketchLine_29") +SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_46") +SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchLine_28.endPoint(), SketchLine_24.result()) +SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_47") +SketchLine_29 = Sketch_3.addLine(15, 0, 14, 0) +SketchLine_29.setName("SketchLine_30") +SketchLine_29.result().setName("SketchLine_30") +SketchProjection_11 = Sketch_3.addProjection(model.selection("VERTEX", "Revolution_1_6/Generated_Edge_1"), False) +SketchPoint_6 = SketchProjection_11.createdFeature() +SketchConstraintCoincidence_45 = Sketch_3.setCoincident(SketchLine_29.startPoint(), SketchPoint_6.result()) +SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_48") +SketchConstraintCoincidence_46 = Sketch_3.setCoincident(SketchLine_29.endPoint(), SketchLine_24.result()) +SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_49") +SketchConstraintDistance_5 = Sketch_3.setDistance(SketchLine_28.endPoint(), SketchLine_29.endPoint(), 3, True) +SketchConstraintLength_9 = Sketch_3.setLength(SketchLine_29.result(), 1) +SketchLine_30 = Sketch_3.addLine(11, 0, 11, -2.000000000000004) +SketchLine_30.setName("SketchLine_31") +SketchLine_30.result().setName("SketchLine_31") +SketchConstraintCoincidence_47 = Sketch_3.setCoincident(SketchLine_28.endPoint(), SketchLine_30.startPoint()) +SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_50") +SketchLine_31 = Sketch_3.addLine(9.500000000000002, 2.627360613063856e-019, 9.5, -2.000000000000004) +SketchLine_31.setName("SketchLine_32") +SketchLine_31.result().setName("SketchLine_32") +SketchConstraintCoincidence_48 = Sketch_3.setCoincident(SketchLine_31.startPoint(), SketchLine_28.result()) +SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_51") +SketchLine_32 = Sketch_3.addLine(8, -1.882265929199326e-020, 8, -2.000000000000004) +SketchLine_32.setName("SketchLine_33") +SketchLine_32.result().setName("SketchLine_33") +SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchLine_32.startPoint(), SketchLine_28.result()) +SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_52") +SketchLine_33 = Sketch_3.addLine(5, -3.396138881322731e-022, 5, -2.000000000000004) +SketchLine_33.setName("SketchLine_34") +SketchLine_33.result().setName("SketchLine_34") +SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchLine_33.startPoint(), SketchLine_28.result()) +SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_53") +SketchLine_34 = Sketch_3.addLine(5, -2.000000000000004, 11, -2.000000000000004) +SketchLine_34.setName("SketchLine_35") +SketchLine_34.result().setName("SketchLine_35") +SketchLine_34.setAuxiliary(True) +SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchLine_33.endPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_54") +SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchLine_30.endPoint(), SketchLine_34.endPoint()) +SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_55") +SketchConstraintVertical_6 = Sketch_3.setVertical(SketchLine_33.result()) +SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_32.result()) +SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_31.result()) +SketchConstraintVertical_9 = Sketch_3.setVertical(SketchLine_30.result()) +SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_34.result()) +SketchConstraintCoincidence_53 = Sketch_3.setCoincident(SketchLine_32.endPoint(), SketchLine_34.result()) +SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_56") +SketchConstraintCoincidence_54 = Sketch_3.setCoincident(SketchLine_31.endPoint(), SketchLine_34.result()) +SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_57") +SketchConstraintDistance_6 = Sketch_3.setDistance(SketchLine_21.endPoint(), SketchLine_33.result(), 3, True) +SketchConstraintDistance_7 = Sketch_3.setDistance(SketchLine_33.endPoint(), SketchLine_32.result(), 3, True) +SketchConstraintDistance_8 = Sketch_3.setDistance(SketchLine_32.endPoint(), SketchLine_31.result(), 1.5, True) +SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_31.endPoint(), SketchLine_30.result(), 1.5, True) +SketchConstraintCoincidence_55 = Sketch_3.setCoincident(SketchLine_33.endPoint(), SketchLine_21.result()) +SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_58") +SketchConstraintMirror_2_objects = [SketchLine_33.result(), SketchLine_32.result(), SketchLine_31.result(), SketchLine_30.result()] +SketchConstraintMirror_2 = Sketch_3.addMirror(SketchLine_24.result(), SketchConstraintMirror_2_objects) +[SketchLine_35, SketchLine_36, SketchLine_37, SketchLine_38] = SketchConstraintMirror_2.mirrored() +SketchLine_38.setName("SketchLine_39") +SketchLine_38.result().setName("SketchLine_39") +SketchLine_37.setName("SketchLine_38") +SketchLine_37.result().setName("SketchLine_38") +SketchLine_36.setName("SketchLine_37") +SketchLine_36.result().setName("SketchLine_37") +SketchLine_35.setName("SketchLine_36") +SketchLine_35.result().setName("SketchLine_36") +model.end() + +assert(model.checkPythonDump()) diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index 6155c3923..df9380e33 100755 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -385,7 +385,8 @@ static void keepTopLevelShapes(ListOfShape& theShapes, const TopoDS_Shape& theRo ListOfShape::iterator anIt = theShapes.begin(); while (anIt != theShapes.end()) { TopoDS_Shape aNewShape = (*anIt)->impl(); - if (theRoot.IsSame(aNewShape) || (theResultShape && + bool aSkip = aNewShape.IsNull() || (aNewShape.ShapeType() == TopAbs_EDGE && BRep_Tool::Degenerated(TopoDS::Edge(aNewShape))); + if (aSkip || theRoot.IsSame(aNewShape) || (theResultShape && (!theResultShape->isSubShape(*anIt, false) || theResultShape->isSame(*anIt)))) { ListOfShape::iterator aRemoveIt = anIt++; theShapes.erase(aRemoveIt); -- 2.39.2