From cb3dfcada87c2912b4a85ce3cb2f7c5e3a5926a8 Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 7 Feb 2019 16:59:20 +0300 Subject: [PATCH] Fuse history of high level objects: workaround is implemented for the OCCT issue 30841. Test for the issue 2826 is added. --- src/FeaturesPlugin/CMakeLists.txt | 1 + src/FeaturesPlugin/Test/Test2826.py | 463 +++++++++++++++++++++++ src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp | 85 +++++ src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h | 4 + src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h | 16 +- 5 files changed, 561 insertions(+), 8 deletions(-) create mode 100644 src/FeaturesPlugin/Test/Test2826.py diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index 566bd072c..1208e3229 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -448,4 +448,5 @@ ADD_UNIT_TESTS(TestExtrusion.py Test2729.py Test2738.py Test2751.py + Test2826.py ) diff --git a/src/FeaturesPlugin/Test/Test2826.py b/src/FeaturesPlugin/Test/Test2826.py new file mode 100644 index 000000000..dc1cdd099 --- /dev/null +++ b/src/FeaturesPlugin/Test/Test2826.py @@ -0,0 +1,463 @@ +## 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(6.188, 9.025, 6.188, -3.45) +SketchLine_2 = Sketch_1.addLine(6.188, -3.45, 0, -3.45) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_3 = Sketch_1.addLine(0, -3.45, 0, -6.449999999999999) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_4 = Sketch_1.addLine(0, -6.449999999999999, 7.782, -6.45) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_5 = Sketch_1.addLine(7.782, -6.45, 7.782, -3.45) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchLine_6 = Sketch_1.addLine(7.782, -3.45, 6.538, -3.45) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchLine_7 = Sketch_1.addLine(6.538, -3.45, 6.538, -2.4) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchLine_8 = Sketch_1.addLine(6.538, -2.4, 6.375999999999999, -2.25) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchLine_9 = Sketch_1.addLine(6.375999999999999, -2.25, 6.375999999999999, 9.025) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchLine_10 = Sketch_1.addLine(6.375999999999999, 9.025, 6.188, 9.025) +SketchLine_10.setAuxiliary(True) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_10.endPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_10.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_2.result()) +SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result()) +SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_4.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) +SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_1.result()) +SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result()) +SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_7.result()) +SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchLine_11 = SketchProjection_1.createdFeature() +SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_11.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_11).startPoint(), SketchLine_2.result(), 3.45, True) +SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 3) +SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_12 = SketchProjection_2.createdFeature() +SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_12.result(), 9.025, True) +SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_10.result(), 0.188) +SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_8.endPoint(), SketchLine_7.endPoint(), 0.15) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_2.result()) +SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_1.result(), 0.35, True) +SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_12.result(), 2.25, True) +SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_11.result(), 6.188, True) +SketchLine_13 = Sketch_1.addLine(7.032, -4.050000000000001, 5.532, -4.050000000000001) +SketchLine_14 = Sketch_1.addLine(5.532, -4.050000000000001, 5.532, -5.850000000000001) +SketchLine_15 = Sketch_1.addLine(5.532, -5.850000000000001, 7.032, -5.850000000000001) +SketchLine_16 = Sketch_1.addLine(7.032, -5.850000000000001, 7.032, -4.050000000000001) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_13.result()) +SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_14.result()) +SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_15.result()) +SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_16.result()) +SketchLine_17 = Sketch_1.addLine(6.282, 9.025000000000013, 6.282, -4.050000000000002) +SketchLine_17.setAuxiliary(True) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_17.startPoint(), SketchLine_10.result()) +SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_13.result()) +SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_17.result()) +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_17.startPoint(), SketchLine_10.result()) +SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchLine_17.endPoint(), SketchLine_13.result()) +SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_13.result(), 1.5) +SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_16.result(), 1.8) +SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_17.endPoint(), SketchLine_5.result(), 1.5, True) +SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_14.startPoint(), SketchLine_2.result(), 0.6, True) +SketchLine_18 = Sketch_1.addLine(6.375999999999999, 9.025, 6.537999999999999, 9.186999999999999) +SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_18.startPoint()) +SketchLine_19 = Sketch_1.addLine(6.537999999999999, 9.186999999999999, 6.537999999999999, 10.256) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) +SketchLine_20 = Sketch_1.addLine(6.537999999999999, 10.256, 6.188, 10.256) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint()) +SketchLine_21 = Sketch_1.addLine(6.188, 10.256, 4.938, 10.97786688777512) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) +SketchLine_22 = Sketch_1.addLine(6.188, 9.025, 6.082, 9.532) +SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_22.startPoint()) +SketchArc_1 = Sketch_1.addArc(4.793854309433998, 9.262673655435936, 6.082, 9.532, 5.676829966640704, 10.23848613167324, False) +SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchArc_1.startPoint()) +SketchLine_23 = Sketch_1.addLine(5.676829966640704, 10.23848613167324, 5.417460848824595, 10.45671600291324) +SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_23.startPoint()) +SketchLine_24 = Sketch_1.addLine(5.417460848824595, 10.45671600291324, 5.143396378647488, 10.65615482129427) +SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) +SketchLine_25 = Sketch_1.addLine(5.143396378647488, 10.65615482129427, 4.856000000000001, 10.83583872155447) +SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint()) +SketchArc_2 = Sketch_1.addArc(0, 2.425, 4.856000000000001, 10.83583872155447, 0, 12.137, False) +SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchArc_2.startPoint()) +SketchArc_3 = Sketch_1.addArc(0, 2.425, 4.938, 10.97786688777512, 0, 12.301, False) +SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchArc_3.startPoint()) +SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_3.center(), SketchArc_2.center()) +SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_11.result()) +SketchArc_4 = Sketch_1.addArc(0, 2.425, 0, 12.219, 6.538, 9.717255618119815, True) +SketchArc_4.setAuxiliary(True) +SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_2.center(), SketchArc_4.center()) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_4.results()[1], 9.794) +SketchLine_26 = Sketch_1.addLine(0, 12.301, 0, 12.137) +SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_26.endPoint()) +SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchLine_26.startPoint(), SketchLine_11.result()) +SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchLine_26.endPoint(), SketchArc_2.endPoint()) +SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchLine_11.result(), SketchLine_26.endPoint()) +SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_26.result()) +SketchConstraintMiddle_3 = Sketch_1.setMiddlePoint(SketchArc_4.startPoint(), SketchLine_26.result()) +SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_26.startPoint(), SketchArc_4.startPoint(), 0.082, True) +SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_20.result()) +SketchConstraintVertical_9 = Sketch_1.setVertical(SketchLine_19.result()) +SketchConstraintDistance_9 = Sketch_1.setDistance(SketchArc_3.center(), SketchLine_12.result(), 2.425, True) +SketchLine_27 = Sketch_1.addLine(4.856000000000001, 10.83583872155447, 0, 2.425) +SketchLine_27.setAuxiliary(True) +SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_27.startPoint()) +SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_27.endPoint()) +SketchLine_28 = Sketch_1.addLine(5.143396378647488, 10.65615482129427, 0, 2.425) +SketchLine_28.setAuxiliary(True) +SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_28.endPoint()) +SketchLine_29 = Sketch_1.addLine(0, 2.425, 5.417460848824595, 10.45671600291324) +SketchLine_29.setAuxiliary(True) +SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_29.endPoint()) +SketchLine_30 = Sketch_1.addLine(5.676829966640704, 10.23848613167324, 0, 2.425) +SketchLine_30.setAuxiliary(True) +SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_30.startPoint()) +SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_30.endPoint()) +SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_27.result(), SketchLine_11.result(), 29.99999999999999) +SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_28.result(), SketchLine_11.result(), 32.00000000000001) +SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_29.result(), SketchLine_11.result(), 34.00000000000001) +SketchConstraintAngle_4 = Sketch_1.setAngle(SketchLine_30.result(), SketchLine_11.result(), 36.00000000000001) +SketchConstraintAngle_5 = Sketch_1.setAngleComplementary(SketchLine_18.result(), SketchLine_10.result(), 44.99999999999972) +SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_20.result(), 0.35) +SketchConstraintDistance_10 = Sketch_1.setDistance(SketchLine_20.startPoint(), SketchLine_12.result(), 10.256, True) +SketchConstraintDistance_10.setName("SketchConstraintDistance_13") +SketchConstraintDistance_11 = Sketch_1.setDistance(SketchLine_22.endPoint(), SketchLine_1.result(), 0.106, True) +SketchConstraintDistance_11.setName("SketchConstraintDistance_14") +SketchConstraintDistance_12 = Sketch_1.setDistance(SketchLine_22.endPoint(), SketchLine_12.result(), 9.532, True) +SketchConstraintDistance_12.setName("SketchConstraintDistance_15") +SketchLine_31 = Sketch_1.addLine(4.856000000000001, 10.83583872155447, 4.938, 10.97786688777512) +SketchLine_31.setAuxiliary(True) +SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_31.startPoint()) +SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_48") +SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_31.endPoint()) +SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_49") +SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_31.result(), SketchLine_27.result()) +SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_19.result()) +SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_50") +SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], 1.316) +SketchLine_32 = Sketch_1.addLine(5.143396378647488, 10.65615482129427, 5.236653048654413, 10.80539669036974) +SketchLine_32.setAuxiliary(True) +SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_51") +SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_32.endPoint(), SketchLine_21.result()) +SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_52") +SketchLine_33 = Sketch_1.addLine(5.417460848824595, 10.45671600291324, 5.536033128724348, 10.63250663704018) +SketchLine_33.setAuxiliary(True) +SketchConstraintCoincidence_52 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_53") +SketchConstraintCoincidence_53 = Sketch_1.setCoincident(SketchLine_33.endPoint(), SketchLine_21.result()) +SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_54") +SketchLine_34 = Sketch_1.addLine(5.676829966640704, 10.23848613167324, 5.836876630976977, 10.4587714668974) +SketchLine_34.setAuxiliary(True) +SketchConstraintCoincidence_54 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_55") +SketchConstraintCoincidence_55 = Sketch_1.setCoincident(SketchLine_34.endPoint(), SketchLine_21.result()) +SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_56") +SketchConstraintCollinear_2 = Sketch_1.setCollinear(SketchLine_32.result(), SketchLine_28.result()) +SketchConstraintCollinear_3 = Sketch_1.setCollinear(SketchLine_33.result(), SketchLine_29.result()) +SketchConstraintCollinear_4 = Sketch_1.setCollinear(SketchLine_34.result(), SketchLine_30.result()) +SketchPoint_1 = Sketch_1.addPoint(5.190029273900029, 10.73078305375602) +SketchConstraintCoincidence_56 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_4.results()[1]) +SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_57") +SketchConstraintCoincidence_57 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_32.result()) +SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_58") +SketchConstraintDistance_13 = Sketch_1.setDistance(SketchLine_25.startPoint(), SketchPoint_1.coordinates(), 0.08799999999999999, True) +SketchConstraintDistance_13.setName("SketchConstraintDistance_16") +SketchPoint_2 = Sketch_1.addPoint(5.476735296592504, 10.54459398560407) +SketchConstraintCoincidence_58 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchArc_4.results()[1]) +SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_59") +SketchConstraintCoincidence_59 = Sketch_1.setCoincident(SketchLine_33.result(), SketchPoint_2.coordinates()) +SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_60") +SketchConstraintDistance_14 = Sketch_1.setDistance(SketchLine_24.startPoint(), SketchPoint_2.coordinates(), 0.106, True) +SketchConstraintDistance_14.setName("SketchConstraintDistance_17") +SketchPoint_3 = Sketch_1.addPoint(5.756768760952494, 10.34851244290823) +SketchConstraintCoincidence_60 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchArc_4.results()[1]) +SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_61") +SketchConstraintCoincidence_61 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_34.result()) +SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_62") +SketchConstraintDistance_15 = Sketch_1.setDistance(SketchArc_1.endPoint(), SketchPoint_3.coordinates(), 0.136, True) +SketchConstraintDistance_15.setName("SketchConstraintDistance_18") +SketchConstraintCoincidence_62 = Sketch_1.setCoincident(SketchLine_21.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_63") +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_18f-SketchLine_19f-SketchLine_20f-SketchLine_21f-SketchArc_3_2f-SketchLine_26f-SketchArc_2_2r-SketchLine_25r-SketchLine_24r-SketchLine_23r-SketchArc_1_2r-SketchLine_22r-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r")], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_4")]) +Group_1.setName("Base") +Group_1.result().setName("Base") +Group_2_objects = [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_24"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchArc_2_2"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_23"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_22"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchArc_1_2")] +Group_2 = model.addGroup(Part_1_doc, Group_2_objects) +Group_2.setName("Faces_int") +Group_2.result().setName("Faces_int") +Group_3_objects = [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_16"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_14"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_15")] +Group_3 = model.addGroup(Part_1_doc, Group_3_objects) +Group_3.setName("Faces_gallerie") +Group_3.result().setName("Faces_gallerie") +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) +SketchLine_35 = Sketch_2.addLine(3.397674805046317, 12.11397308570391, 3.082152448528626, 11.21424138021434) +SketchLine_36 = Sketch_2.addLine(3.241000000000001, 12.09482302308413, 3.241000000000001, 11.06850194037818) +SketchLine_36.setAuxiliary(True) +SketchConstraintVertical_10 = Sketch_2.setVertical(SketchLine_36.result()) +SketchPoint_4 = Sketch_2.addPoint(3.241, 11.66720509403099) +SketchConstraintCoincidence_63 = Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchLine_35.result()) +SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_64") +SketchConstraintCoincidence_64 = Sketch_2.setCoincident(SketchLine_36.result(), SketchPoint_4.coordinates()) +SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_65") +SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_4_2"), False) +SketchArc_5 = SketchProjection_3.createdFeature() +SketchConstraintCoincidence_65 = Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchArc_5.results()[1]) +SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_66") +SketchConstraintAngle_6 = Sketch_2.setAngleComplementary(SketchLine_35.result(), SketchLine_36.result(), 160.675) +SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchLine_37 = SketchProjection_4.createdFeature() +SketchConstraintDistance_16 = Sketch_2.setDistance(SketchPoint_4.coordinates(), SketchLine_37.result(), 3.241, True) +SketchConstraintDistance_16.setName("SketchConstraintDistance_19") +SketchLine_38 = Sketch_2.addLine(3.911629569238839, 11.53981731861503, 3.828898026216406, 11.30390315670624) +SketchLine_39 = Sketch_2.addLine(3.828898026216406, 11.30390315670624, 4.057270795192212, 11.20218846558286) +SketchConstraintCoincidence_66 = Sketch_2.setCoincident(SketchLine_38.endPoint(), SketchLine_39.startPoint()) +SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_67") +SketchLine_40 = Sketch_2.addLine(4.057270795192212, 11.20218846558286, 4.140002338214646, 11.43810262749166) +SketchLine_40.setAuxiliary(True) +SketchConstraintCoincidence_67 = Sketch_2.setCoincident(SketchLine_39.endPoint(), SketchLine_40.startPoint()) +SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_68") +SketchLine_41 = Sketch_2.addLine(4.140002338214646, 11.43810262749166, 3.911629569238839, 11.53981731861503) +SketchConstraintCoincidence_68 = Sketch_2.setCoincident(SketchLine_40.endPoint(), SketchLine_41.startPoint()) +SketchConstraintCoincidence_68.setName("SketchConstraintCoincidence_69") +SketchConstraintCoincidence_69 = Sketch_2.setCoincident(SketchLine_38.startPoint(), SketchLine_41.endPoint()) +SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_70") +SketchLine_42 = Sketch_2.addLine(4.057270795192212, 11.20218846558286, 4.410949215071502, 11.07754130426779) +SketchConstraintCoincidence_70 = Sketch_2.setCoincident(SketchLine_39.endPoint(), SketchLine_42.startPoint()) +SketchConstraintCoincidence_70.setName("SketchConstraintCoincidence_71") +SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_2_2"), False) +SketchArc_6 = SketchProjection_5.createdFeature() +SketchConstraintCoincidence_71 = Sketch_2.setCoincident(SketchLine_42.endPoint(), SketchArc_6.results()[1]) +SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_72") +SketchLine_43 = Sketch_2.addLine(4.410949215071502, 11.07754130426779, 4.465704943014801, 11.23368068225505) +SketchConstraintCoincidence_72 = Sketch_2.setCoincident(SketchLine_42.endPoint(), SketchLine_43.startPoint()) +SketchConstraintCoincidence_72.setName("SketchConstraintCoincidence_73") +SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_3_2"), False) +SketchArc_7 = SketchProjection_6.createdFeature() +SketchConstraintCoincidence_73 = Sketch_2.setCoincident(SketchLine_43.endPoint(), SketchArc_7.results()[1]) +SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_74") +SketchLine_44 = Sketch_2.addLine(4.465704943014801, 11.23368068225505, 4.140002338214646, 11.43810262749166) +SketchConstraintCoincidence_74 = Sketch_2.setCoincident(SketchLine_43.endPoint(), SketchLine_44.startPoint()) +SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_75") +SketchConstraintCoincidence_75 = Sketch_2.setCoincident(SketchLine_40.endPoint(), SketchLine_44.endPoint()) +SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_76") +SketchConstraintParallel_1 = Sketch_2.setParallel(SketchLine_38.result(), SketchLine_35.result()) +SketchConstraintParallel_2 = Sketch_2.setParallel(SketchLine_40.result(), SketchLine_38.result()) +SketchConstraintParallel_3 = Sketch_2.setParallel(SketchLine_43.result(), SketchLine_40.result()) +SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_40.result(), 0.25) +SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_40.result(), SketchLine_38.result()) +SketchPoint_5 = Sketch_2.addPoint(3.87026379772762, 11.42186023766063) +SketchConstraintCoincidence_76 = Sketch_2.setCoincident(SketchPoint_5.coordinates(), SketchLine_38.result()) +SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_77") +SketchConstraintMiddle_4 = Sketch_2.setMiddlePoint(SketchPoint_5.coordinates(), SketchLine_38.result()) +SketchConstraintCoincidence_77 = Sketch_2.setCoincident(SketchPoint_5.coordinates(), SketchArc_5.results()[1]) +SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_78") +SketchPoint_6 = Sketch_2.addPoint(4.09863656670343, 11.32014554653726) +SketchConstraintCoincidence_78 = Sketch_2.setCoincident(SketchPoint_6.coordinates(), SketchLine_40.result()) +SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_79") +SketchConstraintCoincidence_79 = Sketch_2.setCoincident(SketchPoint_6.coordinates(), SketchArc_5.results()[1]) +SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_80") +SketchConstraintMiddle_5 = Sketch_2.setMiddlePoint(SketchPoint_6.coordinates(), SketchLine_40.result()) +SketchConstraintLength_7 = Sketch_2.setLength(SketchLine_41.result(), 0.25) +SketchConstraintDistance_17 = Sketch_2.setDistance(SketchLine_38.startPoint(), SketchLine_35.result(), "1.35/2", True) +SketchConstraintDistance_17.setName("SketchConstraintDistance_20") +SketchConstraintDistance_18 = Sketch_2.setDistance(SketchLine_41.startPoint(), SketchLine_43.result(), 0.375, True) +SketchConstraintDistance_18.setName("SketchConstraintDistance_21") +SketchLine_45 = Sketch_2.addLine(3.911629569238839, 11.53981731861503, 3.397674805046317, 12.11397308570391) +SketchConstraintCoincidence_80 = Sketch_2.setCoincident(SketchLine_38.startPoint(), SketchLine_45.startPoint()) +SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_81") +SketchConstraintCoincidence_81 = Sketch_2.setCoincident(SketchLine_35.startPoint(), SketchLine_45.endPoint()) +SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_82") +SketchLine_46 = Sketch_2.addLine(3.082152448528626, 11.21424138021434, 3.828898026216406, 11.30390315670624) +SketchConstraintCoincidence_82 = Sketch_2.setCoincident(SketchLine_35.endPoint(), SketchLine_46.startPoint()) +SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_83") +SketchConstraintCoincidence_83 = Sketch_2.setCoincident(SketchLine_38.endPoint(), SketchLine_46.endPoint()) +SketchConstraintCoincidence_83.setName("SketchConstraintCoincidence_84") +model.do() +Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_35r-SketchLine_46f-SketchLine_38r-SketchLine_45f")], model.selection("EDGE", "Sketch_2/SketchLine_35"), 360, 0) +AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Revolution_2_1")], model.selection("EDGE", "PartSet/OZ"), 2) +Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("COMPOUND", "AngularCopy_1_1")]) +Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 3.6, False) +Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) +SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_9][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8]"), True) +SketchCircle_1 = SketchProjection_7.createdFeature() +SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2]"), True) +SketchCircle_2 = SketchProjection_8.createdFeature() +SketchLine_47 = Sketch_3.addLine(6.067916611160706, -1.958, 6.166614630411087, -1.958) +SketchConstraintCoincidence_84 = Sketch_3.setCoincident(SketchLine_47.startPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_84.setName("SketchConstraintCoincidence_85") +SketchArc_8 = Sketch_3.addArc(0, 0, 6.166614630411087, -1.958, 6.47, 0, False) +SketchConstraintCoincidence_85 = Sketch_3.setCoincident(SketchLine_47.endPoint(), SketchArc_8.startPoint()) +SketchConstraintCoincidence_85.setName("SketchConstraintCoincidence_87") +SketchConstraintHorizontal_8 = Sketch_3.setHorizontal(SketchLine_47.result()) +SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_48 = SketchProjection_9.createdFeature() +SketchLine_48.setName("SketchLine_49") +SketchLine_48.result().setName("SketchLine_49") +SketchConstraintDistance_19 = Sketch_3.setDistance(SketchLine_47.endPoint(), SketchLine_48.result(), 1.958, True) +SketchConstraintDistance_19.setName("SketchConstraintDistance_23") +SketchLine_49 = Sketch_3.addLine(5.870057921349673, -1.957999999999988, 5.858998207885032, -1.675999999999991) +SketchLine_49.setName("SketchLine_50") +SketchLine_49.result().setName("SketchLine_50") +SketchConstraintCoincidence_86 = Sketch_3.setCoincident(SketchLine_49.startPoint(), SketchCircle_2.results()[1]) +SketchConstraintCoincidence_86.setName("SketchConstraintCoincidence_89") +SketchConstraintCoincidence_87 = Sketch_3.setCoincident(SketchArc_8.endPoint(), SketchLine_48.result()) +SketchConstraintCoincidence_87.setName("SketchConstraintCoincidence_88") +SketchArc_9 = Sketch_3.addArc(0, 0, 5.858998207885032, -1.675999999999991, 6.093999999999999, 0, False) +SketchConstraintCoincidence_88 = Sketch_3.setCoincident(SketchLine_49.endPoint(), SketchArc_9.startPoint()) +SketchConstraintCoincidence_88.setName("SketchConstraintCoincidence_90") +SketchConstraintCoincidence_89 = Sketch_3.setCoincident(SketchLine_48.result(), SketchArc_9.endPoint()) +SketchConstraintCoincidence_89.setName("SketchConstraintCoincidence_91") +SketchConstraintCoincidence_90 = Sketch_3.setCoincident(SketchArc_9.center(), SketchAPI_Line(SketchLine_48).startPoint()) +SketchConstraintCoincidence_90.setName("SketchConstraintCoincidence_92") +SketchConstraintCoincidence_91 = Sketch_3.setCoincident(SketchArc_8.result(), SketchAPI_Line(SketchLine_48).startPoint()) +SketchConstraintCoincidence_91.setName("SketchConstraintCoincidence_93") +SketchPoint_7 = Sketch_3.addPoint(6.188, 0) +SketchConstraintCoincidence_92 = Sketch_3.setCoincident(SketchPoint_7.coordinates(), SketchCircle_2.results()[1]) +SketchConstraintCoincidence_92.setName("SketchConstraintCoincidence_94") +SketchConstraintCoincidence_93 = Sketch_3.setCoincident(SketchPoint_7.coordinates(), SketchLine_48.result()) +SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_95") +SketchPoint_8 = Sketch_3.addPoint(6.375999999999999, 0) +SketchConstraintCoincidence_94 = Sketch_3.setCoincident(SketchPoint_8.coordinates(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_94.setName("SketchConstraintCoincidence_96") +SketchConstraintCoincidence_95 = Sketch_3.setCoincident(SketchPoint_8.coordinates(), SketchLine_48.result()) +SketchConstraintCoincidence_95.setName("SketchConstraintCoincidence_97") +SketchConstraintDistance_20 = Sketch_3.setDistance(SketchPoint_8.coordinates(), SketchArc_8.endPoint(), 0.094, True) +SketchConstraintDistance_20.setName("SketchConstraintDistance_22") +SketchConstraintDistance_21 = Sketch_3.setDistance(SketchArc_9.endPoint(), SketchPoint_7.coordinates(), 0.094, True) +SketchConstraintDistance_21.setName("SketchConstraintDistance_24") +SketchConstraintDistance_22 = Sketch_3.setDistance(SketchArc_9.startPoint(), SketchLine_47.result(), 0.282, True) +SketchConstraintDistance_22.setName("SketchConstraintDistance_25") +SketchConstraintCoincidence_96 = Sketch_3.setCoincident(SketchLine_49.startPoint(), SketchLine_47.result()) +SketchConstraintCoincidence_96.setName("SketchConstraintCoincidence_98") +SketchConstraintMirror_1_objects = [SketchArc_9.results()[1], SketchLine_49.result(), SketchLine_47.result(), SketchArc_8.results()[1]] +SketchConstraintMirror_1 = Sketch_3.addMirror(SketchLine_48.result(), SketchConstraintMirror_1_objects) +[SketchArc_10, SketchLine_50, SketchLine_51, SketchArc_11] = SketchConstraintMirror_1.mirrored() +SketchLine_51.setName("SketchLine_52") +SketchLine_51.result().setName("SketchLine_52") +SketchLine_50.setName("SketchLine_51") +SketchLine_50.result().setName("SketchLine_51") +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchProjection_8f-SketchProjection_8f-SketchLine_51f-SketchArc_10_2r-SketchArc_9_2r-SketchLine_50r"), model.selection("FACE", "Sketch_3/Face-SketchProjection_7r-SketchLine_47f-SketchArc_8_2f-SketchArc_11_2f-SketchLine_52r-SketchProjection_7r")], model.selection(), 0, 4.2) +Sketch_4 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) +SketchLine_52 = Sketch_4.addLine(0.75, 2.1, -0.75, 2.1) +SketchLine_52.setName("SketchLine_53") +SketchLine_52.result().setName("SketchLine_53") +SketchLine_53 = Sketch_4.addLine(-0.75, 2.1, -0.75, 0.3) +SketchLine_53.setName("SketchLine_54") +SketchLine_53.result().setName("SketchLine_54") +SketchLine_54 = Sketch_4.addLine(-0.75, 0.3, 0.75, 0.3) +SketchLine_54.setName("SketchLine_55") +SketchLine_54.result().setName("SketchLine_55") +SketchLine_55 = Sketch_4.addLine(0.75, 0.3, 0.75, 2.1) +SketchLine_55.setName("SketchLine_56") +SketchLine_55.result().setName("SketchLine_56") +SketchConstraintCoincidence_97 = Sketch_4.setCoincident(SketchLine_55.endPoint(), SketchLine_52.startPoint()) +SketchConstraintCoincidence_97.setName("SketchConstraintCoincidence_99") +SketchConstraintCoincidence_98 = Sketch_4.setCoincident(SketchLine_52.endPoint(), SketchLine_53.startPoint()) +SketchConstraintCoincidence_98.setName("SketchConstraintCoincidence_100") +SketchConstraintCoincidence_99 = Sketch_4.setCoincident(SketchLine_53.endPoint(), SketchLine_54.startPoint()) +SketchConstraintCoincidence_99.setName("SketchConstraintCoincidence_101") +SketchConstraintCoincidence_100 = Sketch_4.setCoincident(SketchLine_54.endPoint(), SketchLine_55.startPoint()) +SketchConstraintCoincidence_100.setName("SketchConstraintCoincidence_102") +SketchConstraintHorizontal_9 = Sketch_4.setHorizontal(SketchLine_52.result()) +SketchConstraintVertical_11 = Sketch_4.setVertical(SketchLine_53.result()) +SketchConstraintHorizontal_10 = Sketch_4.setHorizontal(SketchLine_54.result()) +SketchConstraintVertical_12 = Sketch_4.setVertical(SketchLine_55.result()) +SketchProjection_10 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchLine_56 = SketchProjection_10.createdFeature() +SketchLine_56.setName("SketchLine_57") +SketchLine_56.result().setName("SketchLine_57") +SketchConstraintDistance_23 = Sketch_4.setDistance(SketchLine_52.startPoint(), SketchLine_56.result(), 2.1, True) +SketchConstraintDistance_23.setName("SketchConstraintDistance_26") +SketchConstraintDistance_24 = Sketch_4.setDistance(SketchLine_54.endPoint(), SketchLine_56.result(), 0.3, True) +SketchConstraintDistance_24.setName("SketchConstraintDistance_27") +SketchPoint_9 = Sketch_4.addPoint(0, 2.1) +SketchConstraintCoincidence_101 = Sketch_4.setCoincident(SketchPoint_9.coordinates(), SketchLine_52.result()) +SketchConstraintCoincidence_101.setName("SketchConstraintCoincidence_103") +SketchProjection_11 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchLine_57 = SketchProjection_11.createdFeature() +SketchLine_57.setName("SketchLine_58") +SketchLine_57.result().setName("SketchLine_58") +SketchConstraintCoincidence_102 = Sketch_4.setCoincident(SketchPoint_9.coordinates(), SketchLine_57.result()) +SketchConstraintCoincidence_102.setName("SketchConstraintCoincidence_104") +SketchConstraintMiddle_6 = Sketch_4.setMiddlePoint(SketchPoint_9.coordinates(), SketchLine_52.result()) +SketchConstraintDistance_25 = Sketch_4.setDistance(SketchPoint_9.coordinates(), SketchLine_52.startPoint(), 0.75, True) +SketchConstraintDistance_25.setName("SketchConstraintDistance_28") +model.do() +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchLine_53r-SketchLine_54f-SketchLine_55f-SketchLine_56f")], model.selection(), 10, 0) +Rotation_1_objects = [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_2_1")] +Rotation_1 = model.addRotation(Part_1_doc, Rotation_1_objects, model.selection("EDGE", "PartSet/OZ"), -90) +Cut_2_objects_1 = [model.selection("SOLID", "Cut_1_1"), model.selection("SOLID", "Rotation_1_1"), model.selection("SOLID", "Rotation_1_2")] +Cut_2 = model.addCut(Part_1_doc, Cut_2_objects_1, [model.selection("SOLID", "Rotation_1_3")]) +Fuse_2_objects_1 = [model.selection("SOLID", "Cut_2_1"), model.selection("SOLID", "Cut_2_2"), model.selection("SOLID", "Cut_2_3")] +Fuse_2 = model.addFuse(Part_1_doc, Fuse_2_objects_1, True) +model.do() +# move groups to the end +Part_1_doc.moveFeature(Group_1.feature(), Fuse_2.feature()) +Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) +Part_1_doc.moveFeature(Group_3.feature(), Group_2.feature()) +model.end() + +# check groups are correct +from ModelAPI import * +from GeomAPI import * +aFactory = ModelAPI_Session.get().validators() + +selectionList = Group_1.feature().selectionList("group_list") +assert(selectionList.size() == 1) +assert(aFactory.validate(Group_1.feature())) +assert(Group_1.groupList().value(0).value().shapeType() == GeomAPI_Shape.FACE) + +selectionList = Group_2.feature().selectionList("group_list") +assert(selectionList.size() == 8) +assert(aFactory.validate(Group_2.feature())) +for i in range(8): + assert(Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE) + +selectionList = Group_3.feature().selectionList("group_list") +assert(selectionList.size() == 4) +assert(aFactory.validate(Group_3.feature())) +for i in range(4): + assert(Group_3.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE) diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp index c9d9524c4..7be2b6eea 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp @@ -25,6 +25,8 @@ #include #include +#include +#include //================================================================================================= GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean(const GeomShapePtr theObject, @@ -130,3 +132,86 @@ void GeomAlgoAPI_Boolean::build(const ListOfShape& theObjects, this->setShape(aShape); this->setDone(true); } + +static bool isHistoryType(TopAbs_ShapeEnum theType) { + return theType == TopAbs_VERTEX || theType == TopAbs_EDGE || + theType == TopAbs_FACE || theType == TopAbs_SOLID; +} + +/// searches the corresponding result for theOld +static void searchResult(const TopoDS_Shape& theOld, const TopoDS_Shape& theResult, + BOPAlgo_BOP* theBuilder, TopTools_MapOfShape& theNews) +{ + if (theResult.ShapeType() == theOld.ShapeType()) { // check some sub-shape produces a sub-result + if (theOld.IsSame(theResult)) { + theNews.Add(theResult); + return; + } + // searching for new result by sub-shapes of aSubType type + TopAbs_ShapeEnum aSubType = TopAbs_ShapeEnum(int(theOld.ShapeType()) + 1); + while(aSubType < TopAbs_VERTEX && !isHistoryType(aSubType)) + aSubType = TopAbs_ShapeEnum(int(aSubType) + 1); + if (aSubType == TopAbs_SHAPE) + return; + TopTools_MapOfShape aResSubs; + for(TopExp_Explorer aResExp(theResult, aSubType); aResExp.More(); aResExp.Next()) + aResSubs.Add(aResExp.Current()); + for(TopExp_Explorer anExp(theOld, aSubType); anExp.More(); anExp.Next()) { + const TopTools_ListOfShape& aNewSubs = theBuilder->Modified(anExp.Current()); + // searching for this new sub in theResult + for(TopTools_ListIteratorOfListOfShape aNewSub(aNewSubs); aNewSub.More(); aNewSub.Next()) { + if (aResSubs.Contains(aNewSub.Value())) { + theNews.Add(theResult); + return; + } + } + } + } else if (theResult.ShapeType() < theOld.ShapeType()) { // recursive search among sub-shapes + for(TopoDS_Iterator aSubResults(theResult); aSubResults.More(); aSubResults.Next()) { + searchResult(theOld, aSubResults.Value(), theBuilder, theNews); + } + } +} + +// check the shape is on the higher level of compound or compsolid +bool isInComp(const TopoDS_Shape& theComp, const TopoDS_Shape& theShape) { + if (theComp.ShapeType() == TopAbs_COMPOUND || theComp.ShapeType() == TopAbs_COMPSOLID) { + for(TopoDS_Iterator anIter(theComp); anIter.More(); anIter.Next()) { + if (isInComp(anIter.Value(), theShape)) + return true; + } + } else return theShape.IsSame(theComp); + return false; +} + +//================================================================================================= +/// make arguments of Fuse produce result shapes with "modified" evolution +void GeomAlgoAPI_Boolean::modified(const GeomShapePtr theOldShape, ListOfShape& theNewShapes) +{ + BOPAlgo_BOP* aBuilder = this->implPtr(); + if (aBuilder->Operation() == BOPAlgo_FUSE) { // only for fuse and when old is and argument + TopoDS_Shape anOld = theOldShape->impl(); + bool isOldComp = anOld.ShapeType() == TopAbs_COMPOUND || anOld.ShapeType() == TopAbs_COMPSOLID; + bool aFound = false; + TopTools_ListIteratorOfListOfShape anIter(aBuilder->Arguments()); + for(; !aFound && anIter.More(); anIter.Next()) + aFound = anOld.IsSame(anIter.Value()) || (!isOldComp && isInComp(anIter.Value(), anOld)); + for(anIter.Initialize(aBuilder->Tools()); !aFound && anIter.More(); anIter.Next()) + aFound = anOld.IsSame(anIter.Value()) || (!isOldComp && isInComp(anIter.Value(), anOld)); + if (aFound) { + TopoDS_Shape aResult = aBuilder->Shape(); + TopTools_MapOfShape aNewsMap; + searchResult(anOld, aResult, aBuilder, aNewsMap); + if (!aNewsMap.IsEmpty()) { + for(TopTools_MapIteratorOfMapOfShape aNewsIter(aNewsMap); aNewsIter.More(); aNewsIter.Next()) + { + GeomShapePtr aShape(new GeomAPI_Shape); + aShape->setImpl(new TopoDS_Shape(aNewsIter.Value())); + theNewShapes.push_back(aShape); + } + return; + } + } + } + GeomAlgoAPI_MakeShape::modified(theOldShape, theNewShapes); // default behavior +} diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h index 54a5d9428..e5367ec67 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h @@ -57,6 +57,10 @@ public: const ListOfShape& theTools, const OperationType theOperationType); + /// Redefinition of the generic method for the Fuse problem: OCCT 30481 + GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theOldShape, + ListOfShape& theNewShapes); + private: /// Builds resulting shape. void build(const ListOfShape& theObjects, diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h index 4c80a6e7c..c562c562d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h @@ -52,7 +52,7 @@ public: /// \return the total area of the faces of the current shape or 0.0 if it can be computed. GEOMALGOAPI_EXPORT static double area(const std::shared_ptr theShape); - /// \return the centre of mass of the current face. + /// \return the center of mass of the current face. /// The coordinates returned for the center of mass /// are expressed in the absolute Cartesian coordinate system. /// (This function works only for surfaces). @@ -95,7 +95,7 @@ public: /// \brief Enlarges or reduces plane to fit bounding box. /// \return plane that fits to bounding box. /// \param[in] thePlane base plane. - /// \param[in] thePoints bounding box points (shoud be eight). + /// \param[in] thePoints bounding box points (should be eight). GEOMALGOAPI_EXPORT static std::shared_ptr fitPlaneToBox( const std::shared_ptr thePlane, const std::list >& thePoints); @@ -120,10 +120,10 @@ public: /// \brief Return a plane for list of shapes if they are all planar. /// \param[in] theShapes shapes to find plane. - /// \return plane where all shapes lie or empty ptr if they not planar. + /// \return plane where all shapes lie or empty pointer if they not planar. GEOMALGOAPI_EXPORT static std::shared_ptr findPlane(const ListOfShape& theShapes); - /// \brief Checks that vertex/edge is inside face or vertext inside wire. + /// \brief Checks that vertex/edge is inside face or vertex inside wire. /// \param[in] theSubShape shape that should be inside. /// \param[in] theBaseShape base shape. /// \return true if edge inside the face. @@ -153,7 +153,7 @@ public: std::pair >, std::list > > > PointToRefsMap; /// \brief Performs the split of the shape by points. - /// \param[in] theBaseShape shape that should be splitted. + /// \param[in] theBaseShape shape that should be divided. /// \param[in] thePoints container of points to split /// \param[out] theShapes container of shapes after split GEOMALGOAPI_EXPORT static void splitShape(const std::shared_ptr& theBaseShape, @@ -161,7 +161,7 @@ public: std::set >& theShapes); /// \brief Performs the split of the shape by points. - /// \param[in] theBaseShape shape that should be splitted. + /// \param[in] theBaseShape shape that should be divided. /// \param[in] thePoints container of points to split /// \param[out] theShapes container of shapes after split GEOMALGOAPI_EXPORT static void splitShape_p(const std::shared_ptr& theBaseShape, @@ -173,7 +173,7 @@ public: const std::set >& theShapes); #ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS - /// \brief Returns a dir from a shape and an axis. + /// \brief Returns a direction from a shape and an axis. /// \param[in] theBaseShape shape whose center of mass serves as the starting point of the dir. /// \param[in] theAxis axis that serves as a direction for the dir /// \return dir that builds from center of mass of the base shape and the axis @@ -182,7 +182,7 @@ public: const std::shared_ptr theAxis); #endif - /// \brief Reapproximate a wire to build a single edge + /// \brief Re-approximate a wire to build a single edge GEOMALGOAPI_EXPORT static std::shared_ptr wireToEdge( const std::shared_ptr& theWire); -- 2.39.2