From df6c2f4113da27ea3c4ea91c0e9109ebdf47e13b Mon Sep 17 00:00:00 2001 From: mpv Date: Tue, 30 Oct 2018 10:44:53 +0300 Subject: [PATCH] Fix for the issue #2721 : multiply selection in viewer problems Also fixed the problem when sketch is created, extrusion on sketch is aborted and the next extrusion is crashed on the sketch wire selection. --- src/FeaturesPlugin/CMakeLists.txt | 2 + src/FeaturesPlugin/Test/Test2698.py | 351 +++++++++++++++++++++++++ src/FeaturesPlugin/Test/Test2701.py | 118 +++++++++ src/GeomAPI/GeomAPI_PlanarEdges.h | 2 +- src/Model/Model_AttributeSelection.cpp | 14 +- src/Model/Model_ResultConstruction.cpp | 30 ++- 6 files changed, 506 insertions(+), 11 deletions(-) create mode 100644 src/FeaturesPlugin/Test/Test2698.py create mode 100644 src/FeaturesPlugin/Test/Test2701.py diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index 5ebd1306c..5ea94cb08 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -382,4 +382,6 @@ ADD_UNIT_TESTS(TestExtrusion.py Test2686.py Test2689.py Test2693.py + Test2698.py + Test2701.py ) diff --git a/src/FeaturesPlugin/Test/Test2698.py b/src/FeaturesPlugin/Test/Test2698.py new file mode 100644 index 000000000..44b5dea52 --- /dev/null +++ b/src/FeaturesPlugin/Test/Test2698.py @@ -0,0 +1,351 @@ +## 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() +model.addParameter(partSet, "hh", "20") +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(0, -3.45, 0, -6.45) +SketchLine_2 = Sketch_1.addLine(0, -6.45, 7.781999999999999, -6.45) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_3 = Sketch_1.addLine(7.781999999999999, -6.45, 7.781999999999999, -3.45) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_4 = Sketch_1.addLine(7.781999999999999, -3.45, 6.537999941088452, -3.45) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_5 = Sketch_1.addLine(6.537999941088452, -3.45, 6.537999999999999, -2.4) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchLine_6 = Sketch_1.addLine(6.537999999999999, -2.4, 6.375999999999999, -2.25) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchLine_7 = Sketch_1.addLine(6.375999999999999, -2.25, 6.375999999999999, 9.025) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchLine_8 = Sketch_1.addLine(6.375999999999999, 9.025, 6.537999999999998, 9.186999999999999) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchLine_9 = Sketch_1.addLine(6.537999999999998, 9.186999999999999, 6.537999999999998, 10.256) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchLine_10 = Sketch_1.addLine(6.537999999999998, 10.256, 6.187999999999998, 10.256) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_11 = Sketch_1.addLine(6.187999999999998, 10.256, 4.9175, 10.94235984621995) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchLine_12 = SketchProjection_1.createdFeature() +SketchArc_1 = Sketch_1.addArc(0, 2.425, 0, 12.26, 4.9175, 10.94235984621995, True) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_12.result(), SketchArc_1.center()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_12.result(), SketchArc_1.startPoint()) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchArc_1.endPoint()) +SketchLine_13 = Sketch_1.addLine(0, 12.26, 0, 12.096) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_13.startPoint()) +SketchLine_14 = Sketch_1.addLine(0, -3.45, 6.187999958006518, -3.45) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_14.startPoint()) +SketchLine_15 = Sketch_1.addLine(6.187999958006518, -3.45, 6.188, 9.025) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchLine_16 = Sketch_1.addLine(6.188, 9.025, 6.082, 9.532) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_14.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) +SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_2.result()) +SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_10.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_9.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_7.result()) +SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_15.result()) +SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_3.result()) +SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_5.result()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_14.result()) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_12.result()) +SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_1.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_14.endPoint(), SketchLine_5.result(), 0.35, True) +SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_15.result(), 0.188, True) +SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 3) +SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_17 = SketchProjection_2.createdFeature() +SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_17.result(), 3.45, True) +SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_15.result(), 6.188, True) +SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_7.endPoint(), SketchLine_17.result(), 9.025, True) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_12.result()) +SketchLine_18 = Sketch_1.addLine(6.188, 9.025, 6.375999999999999, 9.025) +SketchLine_18.setAuxiliary(True) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_18.endPoint()) +SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_18.result()) +SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_10.startPoint(), SketchLine_17.result(), 10.256, True) +SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_10.result(), 0.35) +SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_18.result(), SketchLine_8.result(), 45) +SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_17.result(), 9.186999999999999, True) +SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_16.endPoint(), SketchLine_15.result(), 0.106, True) +SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_16.endPoint(), SketchLine_17.result(), 9.532, True) +SketchArc_2 = Sketch_1.addArc(4.793786120242238, 9.263, 6.082, 9.532, 5.676067550792405, 10.23944020672409, False) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchArc_2.startPoint()) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], 1.316) +SketchConstraintDistance_10 = Sketch_1.setDistance(SketchArc_2.center(), SketchLine_17.result(), 9.263, True) +SketchLine_19 = Sketch_1.addLine(4.793786120242238, 9.263, 6.082, 9.532) +SketchLine_19.setAuxiliary(True) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_19.endPoint()) +SketchLine_20 = Sketch_1.addLine(4.793786120242238, 9.263, 5.676067550792405, 10.23944020672409) +SketchLine_20.setAuxiliary(True) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_20.endPoint()) +SketchLine_21 = Sketch_1.addLine(4.793786120242238, 9.263, 4.79378612024245, 10.72808112087842) +SketchLine_21.setAuxiliary(True) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_21.startPoint()) +SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_21.result()) +SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_20.result(), SketchLine_21.result(), 42.09999999999906) +SketchLine_22 = Sketch_1.addLine(5.676067550792282, 10.23944020672395, 5.404900443923878, 10.43809443685872) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_22.startPoint()) +SketchLine_23 = Sketch_1.addLine(5.404900443923878, 10.43809443685872, 5.12663857042824, 10.62933672216996) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) +SketchLine_24 = Sketch_1.addLine(5.12663857042824, 10.62933672216996, 4.835500000000001, 10.80033167999931) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) +SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_13.result(), "0.082*2") +SketchArc_3 = Sketch_1.addArc(0, 2.425, 0, 12.096, 4.835500000000001, 10.80033167999931, True) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_1.center(), SketchArc_3.center()) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchArc_3.startPoint()) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchArc_3.endPoint()) +SketchConstraintDistance_11 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_17.result(), 2.425, True) +SketchLine_25 = Sketch_1.addLine(0, 2.425, 4.9175, 10.94235984621995) +SketchLine_25.setName("SketchLine_26") +SketchLine_25.result().setName("SketchLine_26") +SketchLine_25.setAuxiliary(True) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_25.startPoint()) +SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_37") +SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_11.result()) +SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_38") +SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_25.result()) +SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_39") +SketchLine_26 = Sketch_1.addLine(0, 2.425, 5.220090907696442, 10.77889172431985) +SketchLine_26.setName("SketchLine_27") +SketchLine_26.result().setName("SketchLine_27") +SketchLine_26.setAuxiliary(True) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_40") +SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_26.endPoint(), SketchLine_11.result()) +SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_41") +SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchLine_24.startPoint(), SketchLine_26.result()) +SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_42") +SketchLine_27 = Sketch_1.addLine(0, 2.425, 5.524022094217663, 10.61469954608912) +SketchLine_27.setName("SketchLine_28") +SketchLine_27.result().setName("SketchLine_28") +SketchLine_27.setAuxiliary(True) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_27.startPoint()) +SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_43") +SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchLine_27.endPoint(), SketchLine_11.result()) +SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_44") +SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchLine_27.result(), SketchLine_23.startPoint()) +SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_45") +SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_46") +SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_25.result(), SketchLine_12.result(), 30.00000000000003) +SketchConstraintAngle_4 = Sketch_1.setAngle(SketchLine_26.result(), SketchLine_12.result(), 32.00000000000001) +SketchConstraintAngle_5 = Sketch_1.setAngle(SketchLine_27.result(), SketchLine_12.result(), 33.99999999999999) +SketchConstraintDistance_12 = Sketch_1.setDistance(SketchLine_23.endPoint(), SketchLine_11.result(), "0.088*2", True) +SketchConstraintDistance_13 = Sketch_1.setDistance(SketchLine_22.endPoint(), SketchLine_11.result(), "0.106*2", True) +SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], 9.835000000000001) +SketchLine_28 = Sketch_1.addLine(7.031999999999999, -4.05, 5.531999999999999, -4.05) +SketchLine_28.setName("SketchLine_29") +SketchLine_28.result().setName("SketchLine_29") +SketchLine_29 = Sketch_1.addLine(5.531999999999999, -4.05, 5.531999999999999, -5.85) +SketchLine_29.setName("SketchLine_30") +SketchLine_29.result().setName("SketchLine_30") +SketchLine_30 = Sketch_1.addLine(5.531999999999999, -5.85, 7.031999999999999, -5.85) +SketchLine_30.setName("SketchLine_31") +SketchLine_30.result().setName("SketchLine_31") +SketchLine_31 = Sketch_1.addLine(7.031999999999999, -5.85, 7.031999999999999, -4.05) +SketchLine_31.setName("SketchLine_32") +SketchLine_31.result().setName("SketchLine_32") +SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_47") +SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_48") +SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchLine_29.endPoint(), SketchLine_30.startPoint()) +SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_49") +SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_50") +SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_28.result()) +SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_29.result()) +SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_30.result()) +SketchConstraintVertical_9 = Sketch_1.setVertical(SketchLine_31.result()) +SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_30.result(), 1.5) +SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_29.result(), 1.8) +SketchConstraintDistance_14 = Sketch_1.setDistance(SketchLine_29.startPoint(), SketchLine_14.result(), 0.6, True) +SketchLine_32 = Sketch_1.addLine(6.281999999999999, 9.025000000000009, 6.281999999999999, -4.049999999999998) +SketchLine_32.setName("SketchLine_33") +SketchLine_32.result().setName("SketchLine_33") +SketchLine_32.setAuxiliary(True) +SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchLine_32.startPoint(), SketchLine_18.result()) +SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_51") +SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchLine_32.endPoint(), SketchLine_28.result()) +SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_52") +SketchConstraintVertical_10 = Sketch_1.setVertical(SketchLine_32.result()) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_32.endPoint(), SketchLine_28.result()) +SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchLine_32.startPoint(), SketchLine_18.result()) +SketchConstraintDistance_15 = Sketch_1.setDistance(SketchLine_32.endPoint(), SketchLine_3.result(), 1.5, True) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_6.endPoint(), SketchLine_5.endPoint(), 0.15) +SketchConstraintDistance_16 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_17.result(), 2.25, True) +SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_21.result(), SketchLine_21.endPoint()) +SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_53") +SketchConstraintCoincidence_52 = Sketch_1.setCoincident(SketchLine_25.result(), SketchLine_21.endPoint()) +SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_54") +model.do() +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchArc_1_2f-SketchLine_13f-SketchArc_3_2r-SketchLine_24r-SketchLine_23r-SketchLine_22r-SketchArc_2_2r-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_32r-SketchLine_31r-SketchLine_30r-SketchLine_29r")], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) +SketchLine_33 = Sketch_2.addLine(0, 2.425, 3.282538500974061, 11.74164236673401) +SketchLine_33.setName("SketchLine_34") +SketchLine_33.result().setName("SketchLine_34") +SketchLine_33.setAuxiliary(True) +SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_28_StartVertex"), False) +SketchPoint_1 = SketchProjection_3.createdFeature() +SketchConstraintCoincidence_53 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchPoint_1.result()) +SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_55") +SketchPoint_2 = Sketch_2.addPoint(3.241, 11.6237460014939) +SketchConstraintCoincidence_54 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_33.result()) +SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_56") +SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchLine_34 = SketchProjection_4.createdFeature() +SketchLine_34.setName("SketchLine_36") +SketchLine_34.result().setName("SketchLine_36") +SketchConstraintDistance_17 = Sketch_2.setDistance(SketchPoint_2.coordinates(), SketchLine_34.result(), 3.241, True) +SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_13"), False) +SketchLine_35 = SketchProjection_5.createdFeature() +SketchLine_35.setName("SketchLine_37") +SketchLine_35.result().setName("SketchLine_37") +SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_28"), False) +SketchLine_36 = SketchProjection_6.createdFeature() +SketchLine_36.setName("SketchLine_38") +SketchLine_36.result().setName("SketchLine_38") +SketchArc_4 = Sketch_2.addArc(0, 2.425, 0, 12.178, 5.453808387550194, 10.51060344512932, True) +SketchArc_4.setAuxiliary(True) +SketchConstraintCoincidence_55 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchArc_4.center()) +SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_58") +SketchConstraintCoincidence_56 = Sketch_2.setCoincident(SketchLine_35.result(), SketchArc_4.startPoint()) +SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_59") +SketchConstraintCoincidence_57 = Sketch_2.setCoincident(SketchLine_36.result(), SketchArc_4.endPoint()) +SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_60") +SketchConstraintMiddle_3 = Sketch_2.setMiddlePoint(SketchLine_35.result(), SketchArc_4.startPoint()) +SketchConstraintCoincidence_58 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchArc_4.results()[1]) +SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_61") +SketchArc_5 = Sketch_2.addArc(0, 2.425, 3.28253850097406, 11.74164236673401, 4.139817701932777, 11.39365616437401, True) +SketchConstraintCoincidence_59 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchArc_5.center()) +SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_62") +SketchConstraintCoincidence_60 = Sketch_2.setCoincident(SketchLine_33.result(), SketchArc_5.startPoint()) +SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_63") +SketchLine_37 = Sketch_2.addLine(4.139817701932777, 11.39365616437401, 4.459277785066624, 11.1909606795611) +SketchLine_37.setName("SketchLine_39") +SketchLine_37.result().setName("SketchLine_39") +SketchConstraintCoincidence_61 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_37.startPoint()) +SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_64") +SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_1_2"), False) +SketchArc_6 = SketchProjection_7.createdFeature() +SketchConstraintCoincidence_62 = Sketch_2.setCoincident(SketchLine_37.endPoint(), SketchArc_6.results()[1]) +SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_65") +SketchLine_38 = Sketch_2.addLine(4.459277785066624, 11.1909606795611, 4.390495384356073, 11.041947909785) +SketchLine_38.setName("SketchLine_40") +SketchLine_38.result().setName("SketchLine_40") +SketchConstraintCoincidence_63 = Sketch_2.setCoincident(SketchLine_37.endPoint(), SketchLine_38.startPoint()) +SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_66") +SketchProjection_8 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_3_2"), False) +SketchArc_7 = SketchProjection_8.createdFeature() +SketchConstraintCoincidence_64 = Sketch_2.setCoincident(SketchLine_38.endPoint(), SketchArc_7.results()[1]) +SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_67") +SketchLine_39 = Sketch_2.addLine(4.390495384356073, 11.041947909785, 4.035044020470619, 11.16667053559354) +SketchLine_39.setName("SketchLine_41") +SketchLine_39.result().setName("SketchLine_41") +SketchConstraintCoincidence_65 = Sketch_2.setCoincident(SketchLine_38.endPoint(), SketchLine_39.startPoint()) +SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_68") +SketchArc_8 = Sketch_2.addArc(0, 2.425, 3.199461499025941, 11.5058496362538, 4.035044020470619, 11.16667053559354, True) +SketchConstraintCoincidence_66 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchArc_8.center()) +SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_69") +SketchConstraintCoincidence_67 = Sketch_2.setCoincident(SketchLine_33.result(), SketchArc_8.startPoint()) +SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_70") +SketchConstraintCoincidence_68 = Sketch_2.setCoincident(SketchArc_8.endPoint(), SketchLine_39.endPoint()) +SketchConstraintCoincidence_68.setName("SketchConstraintCoincidence_71") +SketchLine_40 = Sketch_2.addLine(0, 2.425, 4.139817701932777, 11.39365616437401) +SketchLine_40.setName("SketchLine_42") +SketchLine_40.result().setName("SketchLine_42") +SketchLine_40.setAuxiliary(True) +SketchConstraintCoincidence_69 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchLine_40.startPoint()) +SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_72") +SketchConstraintCoincidence_70 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_40.endPoint()) +SketchConstraintCoincidence_70.setName("SketchConstraintCoincidence_73") +SketchConstraintCoincidence_71 = Sketch_2.setCoincident(SketchArc_8.endPoint(), SketchLine_40.result()) +SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_74") +SketchConstraintParallel_1 = Sketch_2.setParallel(SketchLine_38.result(), SketchLine_40.result()) +SketchLine_41 = Sketch_2.addLine(0, 2.425, 3.9115060144283, 11.49555702253678) +SketchLine_41.setName("SketchLine_43") +SketchLine_41.result().setName("SketchLine_43") +SketchLine_41.setAuxiliary(True) +SketchConstraintCoincidence_72 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchLine_41.startPoint()) +SketchConstraintCoincidence_72.setName("SketchConstraintCoincidence_75") +SketchConstraintCoincidence_73 = Sketch_2.setCoincident(SketchLine_41.endPoint(), SketchArc_5.results()[1]) +SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_76") +SketchPoint_3 = Sketch_2.addPoint(3.812510620258724, 11.26599240868436) +SketchConstraintCoincidence_74 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_41.result()) +SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_77") +SketchConstraintCoincidence_75 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchArc_8.results()[1]) +SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_78") +SketchLine_42 = Sketch_2.addLine(3.812510620258724, 11.26599240868436, 3.9115060144283, 11.49555702253678) +SketchLine_42.setName("SketchLine_44") +SketchLine_42.result().setName("SketchLine_44") +SketchConstraintCoincidence_76 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_42.startPoint()) +SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_79") +SketchConstraintCoincidence_77 = Sketch_2.setCoincident(SketchLine_41.endPoint(), SketchLine_42.endPoint()) +SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_80") +SketchPoint_4 = Sketch_2.addPoint(3.862008317343517, 11.38077471561057) +SketchConstraintCoincidence_78 = Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchLine_42.result()) +SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_81") +SketchConstraintMiddle_4 = Sketch_2.setMiddlePoint(SketchPoint_4.coordinates(), SketchLine_42.result()) +SketchConstraintCoincidence_79 = Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchArc_4.results()[1]) +SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_82") +SketchConstraintDistance_18 = Sketch_2.setDistance(SketchLine_42.endPoint(), SketchLine_40.result(), 0.25, True) +SketchConstraintDistance_19 = Sketch_2.setDistance(SketchArc_5.endPoint(), SketchLine_38.result(), 0.375, True) +SketchConstraintDistance_20 = Sketch_2.setDistance(SketchArc_5.startPoint(), SketchLine_42.result(), "1.35/2", True) +SketchConstraintDistance_21 = Sketch_2.setDistance(SketchArc_8.startPoint(), SketchArc_5.startPoint(), 0.25, True) +SketchConstraintCoincidence_80 = Sketch_2.setCoincident(SketchLine_33.endPoint(), SketchArc_5.startPoint()) +SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_83") +SketchLine_43 = Sketch_2.addLine(3.199461499025942, 11.5058496362538, 3.28253850097406, 11.74164236673401) +SketchLine_43.setName("SketchLine_45") +SketchLine_43.result().setName("SketchLine_45") +SketchConstraintCoincidence_81 = Sketch_2.setCoincident(SketchArc_8.startPoint(), SketchLine_43.startPoint()) +SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_84") +SketchConstraintCoincidence_82 = Sketch_2.setCoincident(SketchLine_33.endPoint(), SketchLine_43.endPoint()) +SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_85") +model.do() +Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_5_2f-SketchLine_45r-SketchArc_8_2r-SketchLine_44f")], model.selection("EDGE", "Sketch_2/SketchLine_34"), 360, 0) +Revolution_2.result().setName("Cut_tool") +Revolution_3 = model.addRevolution(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchArc_5_2f-SketchLine_44r-SketchArc_8_2r-SketchLine_41r-SketchLine_40r-SketchLine_39r_wire")], model.selection("EDGE", "Sketch_2/SketchLine_34"), 360, 0) +Revolution_3.result().setName("Fuse_tool") +Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Cut_tool"), model.selection("SOLID", "Fuse_tool")], model.selection("EDGE", "PartSet/OZ"), True) +Symmetry_1.result().subResult(0).setName("Symmetry_1_1_1") +Symmetry_1.result().subResult(1).setName("Symmetry_1_1_2") +Symmetry_1.results()[1].subResult(0).setName("Symmetry_1_2_1") +Symmetry_1.results()[1].subResult(1).setName("Symmetry_1_2_2") +Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("COMPOUND", "Cut_tool")]) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cut_1_1"), model.selection("COMPOUND", "Fuse_tool")], True) +model.do() +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.end() + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/Test2701.py b/src/FeaturesPlugin/Test/Test2701.py new file mode 100644 index 000000000..97de48178 --- /dev/null +++ b/src/FeaturesPlugin/Test/Test2701.py @@ -0,0 +1,118 @@ +## 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() +model.addParameter(Part_1_doc, "a", "10") +model.addParameter(Part_1_doc, "b", "8") +model.addParameter(Part_1_doc, "c", "2*a") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_1 = Sketch_1.addLine(-48.37423594569039, -43.07420401522882, -48.37423594569039, -8.074204015228814) +SketchLine_2 = Sketch_1.addLine(-40.38893648559045, -0.07421752185518632, -2.793802518897851e-22, 0) +SketchLine_3 = Sketch_1.addLine(-2.793802518897851e-22, 0, 37.58770483143633, -13.68080573302675) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_2") +SketchLine_4 = Sketch_1.addLine(37.58770483143633, -13.68080573302675, 19.91003530177265, -31.35847526269043) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3") +SketchLine_5 = Sketch_1.addLine(-8.374235945690391, -43.07420401522882, -48.37423594569039, -43.07420401522882) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_5") +SketchArc_1 = Sketch_1.addArc(-40.37423594569039, -8.074204015228817, -40.38893648559045, -0.07421752185518632, -48.37423594569039, -8.074204015228814, False) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_6") +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.endPoint()) +SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_7") +SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_1.result()) +SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_2.result()) +SketchArc_2 = Sketch_1.addArc(-8.374235945690213, -3.074204015227884, -8.374235945690391, -43.07420401522882, 19.91003530177265, -31.35847526269043, False) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_8") +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_4.endPoint()) +SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_9") +SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_4.result()) +SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_5.result()) +SketchLine_6 = Sketch_1.addLine(-2.793802518897851e-22, 0, 0, 35) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_10") +SketchLine_7 = Sketch_1.addLine(30.00000000001173, 65.00000000001097, 42.00000000001173, 65.00000000001097) +SketchLine_8 = Sketch_1.addLine(65.00000000000007, 42, 65.00000000000007, 30) +SketchLine_9 = Sketch_1.addLine(35.00000000000009, 0, -2.793802518897851e-22, 0) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_9.endPoint()) +SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_14") +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_7.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_9.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_8.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result()) +SketchArc_3 = Sketch_1.addArc(30.00000000000873, 35.00000000000306, 30.00000000001173, 65.00000000001097, 0, 35, False) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_15") +SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_6.endPoint()) +SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_16") +SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_6.result()) +SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_7.result()) +SketchArc_4 = Sketch_1.addArc(42.00000000000008, 41.99999999999999, 65.00000000000007, 42, 42.00000000001173, 65.00000000001097, False) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_17") +SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_7.endPoint()) +SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_18") +SketchConstraintTangent_7 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_7.result()) +SketchConstraintTangent_8 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_8.result()) +SketchArc_5 = Sketch_1.addArc(35.00000000000006, 30.00000000000001, 35.00000000000009, 0, 65.00000000000007, 30, False) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_5.startPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_19") +SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_8.endPoint()) +SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_20") +SketchConstraintTangent_9 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchLine_8.result()) +SketchConstraintTangent_10 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchLine_9.result()) +SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchPoint_1 = SketchProjection_1.createdFeature() +SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) +SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_21") +SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) +SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_1.result()) +SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_4.result(), SketchLine_3.result(), 65.00000000000011) +SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), "2*c") +SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_4.result(), 25) +SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_5.result(), "4*a") +SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_1.result(), 35) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 8) +SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_9.result(), 20.00000000000001) +SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 40) +SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_6.result(), 35) +SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_7.result(), 12) +SketchConstraintLength_7 = Sketch_1.setLength(SketchLine_8.result(), 12) +SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_3.results()[1], 30) +SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_5.results()[1], 30) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0) +model.do() +model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) +model.end() + +assert(model.checkPythonDump()) diff --git a/src/GeomAPI/GeomAPI_PlanarEdges.h b/src/GeomAPI/GeomAPI_PlanarEdges.h index ef1cea8be..0fc2a9f0a 100644 --- a/src/GeomAPI/GeomAPI_PlanarEdges.h +++ b/src/GeomAPI/GeomAPI_PlanarEdges.h @@ -35,7 +35,7 @@ * \ingroup DataModel * \brief Interface to the set of edges located in one plane * - * Normally this interface corresponds to theedges of the sketch + * Normally this interface corresponds to the edges of the sketch */ class GeomAPI_PlanarEdges : public GeomAPI_Shape { diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index bc5d28d94..61b85dd89 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -137,7 +137,7 @@ bool Model_AttributeSelection::setValue(const ObjectPtr& theContext, myRef.setValue(theContext); } - // do noth use naming if selected shape is result shape itself, but not sub-shape + // do not use naming if selected shape is result shape itself, but not sub-shape TDF_Label aSelLab = selectionLabel(); aSelLab.ForgetAttribute(kSIMPLE_REF_ID); aSelLab.ForgetAttribute(kINVALID_SELECTION); @@ -536,7 +536,7 @@ ResultPtr Model_AttributeSelection::context() if(aPart.get() && aPart->data() == aResult->data()) { ResultPtr aPartResult = std::dynamic_pointer_cast(aPart); FeaturePtr anOwnerFeature = std::dynamic_pointer_cast(owner()); - // check that this result is not this-feature result (it is forbidden t oselect itself) + // check that this result is not this-feature result (it is forbidden to select itself) if(anOwnerFeature.get() && anOwnerFeature->firstResult() != aPartResult) { return aPartResult; } @@ -654,7 +654,7 @@ bool Model_AttributeSelection::update() aNewShape = aNS->Get(); if (anOldShape.IsNull() || aNewShape.IsNull() || !anOldShape.IsEqual(aNewShape)) { - // shape type shoud not not changed: if shape becomes compound of such shapes, then split + // shape type should not be changed: if shape becomes compound of such shapes, then split if (myParent && !anOldShape.IsNull() && !aNewShape.IsNull() && anOldShape.ShapeType() != aNewShape.ShapeType() && (aNewShape.ShapeType() == TopAbs_COMPOUND || aNewShape.ShapeType() == TopAbs_COMPSOLID)) @@ -1358,7 +1358,7 @@ void Model_AttributeSelection::computeValues( } } if (aToFindPart == 2 && !aNewToOld.IsEmpty()) { - // map of sub-shapes -> number of occurences of these shapes in containers + // map of sub-shapes -> number of occurrences of these shapes in containers NCollection_DataMap aSubs; TopTools_DataMapOfShapeShape::Iterator aContIter(aNewToOld); for(; aContIter.More(); aContIter.Next()) { @@ -1441,11 +1441,11 @@ bool Model_AttributeSelection::searchNewContext(std::shared_ptr } if (aResults.empty()) return false; // no modifications found, must stay the same - // iterate all results to find futher modifications + // iterate all results to find further modifications std::set::iterator aResIter = aResults.begin(); for(; aResIter != aResults.end(); aResIter++) { if (aResIter->get() != NULL) { - // compute new values by two contextes: the old and the new + // compute new values by two contexts: the old and the new TopTools_ListOfShape aValShapes; computeValues(theContext, *aResIter, theValShape, aValShapes); @@ -1460,7 +1460,7 @@ bool Model_AttributeSelection::searchNewContext(std::shared_ptr if (searchNewContext(theDoc, aNewContShape, *aResIter, aNewValSh, theAccessLabel, aNewRes, aNewUpdatedVal)) { - // appeand new results instead of the current ones + // append new results instead of the current ones std::list::iterator aNewIter = aNewRes.begin(); TopTools_ListIteratorOfListOfShape aNewUpdVal(aNewUpdatedVal); for(; aNewIter != aNewRes.end(); aNewIter++, aNewUpdVal.Next()) { diff --git a/src/Model/Model_ResultConstruction.cpp b/src/Model/Model_ResultConstruction.cpp index 103c54259..b1ec3c9fc 100644 --- a/src/Model/Model_ResultConstruction.cpp +++ b/src/Model/Model_ResultConstruction.cpp @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include @@ -71,6 +73,10 @@ void Model_ResultConstruction::setShape(std::shared_ptr theShape) ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), anEvent); } myShape = theShape; + if (myShape.get() && myShape->shapeType() == GeomAPI_Shape::COMPOUND && + std::dynamic_pointer_cast(myShape).get() == NULL) { + int a= 10; + } } } @@ -88,7 +94,7 @@ static std::string shortName( aName.erase(std::remove(aName.begin(), aName.end(), '/'), aName.end()); aName.erase(std::remove(aName.begin(), aName.end(), '&'), aName.end()); // remove the last 's', 'e', 'f' and 'r' symbols: - // they are used as markers of start/end/forward/rewersed indicators + // they are used as markers of start/end/forward/reversed indicators static const std::string aSyms("sefr"); std::string::iterator aSuffix = aName.end() - 1; while(aSyms.find(*aSuffix) != std::string::npos) { @@ -98,7 +104,6 @@ static std::string shortName( return aName; } - bool Model_ResultConstruction::updateShape() { std::shared_ptr aData = std::dynamic_pointer_cast(data()); @@ -108,6 +113,25 @@ bool Model_ResultConstruction::updateShape() if (aShapeLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) { TopoDS_Shape aShape = aNS->Get(); if (!aShape.IsNull()) { + if (aShape.ShapeType() == TopAbs_COMPOUND) { + // restore the sketch planar edges object + std::shared_ptr aBigWire(new GeomAPI_PlanarEdges); + aBigWire->setImpl(new TopoDS_Shape(aShape)); + FeaturePtr aSketch = + document()->feature(std::dynamic_pointer_cast(data()->owner())); + std::shared_ptr anOrigin = + std::dynamic_pointer_cast(aSketch->data()->attribute("Origin")); + std::shared_ptr aDirX = + std::dynamic_pointer_cast(aSketch->data()->attribute("DirX")); + std::shared_ptr aNorm = + std::dynamic_pointer_cast(aSketch->data()->attribute("Norm")); + if (anOrigin.get() && aDirX.get() && aNorm.get()) { + aBigWire->setPlane(anOrigin->pnt(), aDirX->dir(), aNorm->dir()); + myShape = aBigWire; + return true; + } + } + // just restore shape GeomShapePtr aGShape(new GeomAPI_Shape); aGShape->setImpl(new TopoDS_Shape(aShape)); myShape = aGShape; // restore the sketch sub-components @@ -393,7 +417,7 @@ void Model_ResultConstruction::storeShape(std::shared_ptr theShap TDF_Label anEdgesLabel = aLab.FindChild(1); anEdgesBuilder = new TNaming_Builder(anEdgesLabel); std::ostringstream aSubName; - // tag is needed for Test1922 to distinguish subedges of different faces + // tag is needed for Test1922 to distinguish sub-edges of different faces aSubName<<"SubEdge_"<