From b7f8a1520fd5987d36da285e81474f482521f5db Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 13 Jun 2019 14:49:22 +0300 Subject: [PATCH] Issue #17000: Fix naming error in Extrusion. --- src/FeaturesPlugin/CMakeLists.txt | 1 + .../FeaturesPlugin_Extrusion.cpp | 4 +- src/FeaturesPlugin/Test/Test17000.py | 246 ++++++++++++++++++ 3 files changed, 249 insertions(+), 2 deletions(-) create mode 100644 src/FeaturesPlugin/Test/Test17000.py diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index 5317c2a3c..0e5ed0f99 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -522,4 +522,5 @@ ADD_UNIT_TESTS(TestExtrusion.py TestRemoveResultsBody.py TestRemoveResultsConstruction.py TestRemoveResultsPart.py + Test17000.py ) diff --git a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp index dc754bf94..bfcbde007 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp @@ -170,9 +170,9 @@ bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape& theBaseShapes, } } } - if (aToShape) + if (aToShape && !aToShape->isPlanar()) theBoundaryShapes.push_back(aToShape); - if (aFromShape) + if (aFromShape && !aFromShape->isPlanar()) theBoundaryShapes.push_back(aFromShape); // Generating result for each base shape. diff --git a/src/FeaturesPlugin/Test/Test17000.py b/src/FeaturesPlugin/Test/Test17000.py new file mode 100644 index 000000000..bdba0f3a5 --- /dev/null +++ b/src/FeaturesPlugin/Test/Test17000.py @@ -0,0 +1,246 @@ +# Copyright (C) 2019 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 +# + +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, "ep_base", "0.65") +model.addParameter(Part_1_doc, "ep_voiles", "0.1") +model.addParameter(Part_1_doc, "ep_poteau", "0.15") +model.addParameter(Part_1_doc, "h_ouverture", "0.95") +model.addParameter(Part_1_doc, "h_apres_ouverture", "0.6") +model.addParameter(Part_1_doc, "ep_dalles", "0.12") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_1 = Sketch_1.addLine(-0.375, 3.325, 0.275, 3.325) +SketchLine_2 = Sketch_1.addLine(0.275, 3.325, 0.275, 0.325) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_3 = Sketch_1.addLine(0.275, 0.325, 3.625, 0.325) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_4 = Sketch_1.addLine(3.625, 0.325, 3.625, 1.325) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_5 = Sketch_1.addLine(3.625, 1.325, 4.275, 1.325) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchLine_6 = Sketch_1.addLine(4.275, 1.325, 4.275, -0.325) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchLine_7 = Sketch_1.addLine(4.275, -0.325, -0.375, -0.325) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchLine_8 = Sketch_1.addLine(-0.375, -0.325, -0.375, 3.325) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.endPoint()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_8.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_4.result()) +SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_6.result()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) +SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_8.result(), 3.65) +SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), "ep_base") +SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_6.result(), 1.65) +SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_5.result()) +SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_7.result(), 4.65) +SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_5.result()) +SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_7.result(), "ep_base", True) +SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_9 = SketchProjection_1.createdFeature() +SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_9.result(), "0.275+ep_voiles/2", True) +SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchLine_10 = SketchProjection_2.createdFeature() +SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_10.result(), "0.325+ep_voiles/2", True) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 0, 0.3) +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face")) +SketchLine_11 = Sketch_2.addLine(2.26, -2.31, 1.64, -2.31) +SketchLine_12 = Sketch_2.addLine(1.64, -2.31, 1.64, -1.69) +SketchLine_13 = Sketch_2.addLine(1.64, -1.69, 2.26, -1.69) +SketchLine_14 = Sketch_2.addLine(2.26, -1.69, 2.26, -2.31) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result()) +SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_12.result()) +SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_13.result()) +SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_14.result()) +SketchConstraintEqual_2 = Sketch_2.setEqual(SketchLine_11.result(), SketchLine_12.result()) +SketchPoint_1 = Sketch_2.addPoint(1.925, -1.875) +SketchConstraintDistance_4 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_12.result(), "0.210+ep_poteau/2", True) +SketchConstraintDistance_5 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_13.result(), "0.11+ep_poteau/2", True) +SketchConstraintLength_5 = Sketch_2.setLength(SketchLine_11.result(), 0.62) +SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_15 = SketchProjection_3.createdFeature() +SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchLine_16 = SketchProjection_4.createdFeature() +SketchConstraintDistance_6 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_16.result(), "1.8+ep_poteau/2+ep_voiles/2", True) +SketchConstraintDistance_7 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_15.result(), "1.75+ep_poteau/2+ep_voiles/2", True) +model.do() +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r")], model.selection(), 0, 0.02) +Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")) +SketchLine_17 = Sketch_3.addLine(0, 2.95, 0, 1.7) +SketchProjection_5 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchLine_18 = SketchProjection_5.createdFeature() +SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_17.startPoint(), SketchLine_18.result()) +SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_18.result()) +SketchLine_19 = Sketch_3.addLine(0, 1.2, 0, 0) +SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_19.startPoint(), SketchLine_18.result()) +SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_18).startPoint(), SketchLine_19.endPoint()) +SketchLine_20 = Sketch_3.addLine(0, 0, 0.95, 0) +SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_18).startPoint(), SketchLine_20.startPoint()) +SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_21 = SketchProjection_6.createdFeature() +SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_21.result()) +SketchLine_22 = Sketch_3.addLine(2.525, 0, 3.975, 0) +SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchLine_21.result()) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_21.result()) +SketchLine_23 = Sketch_3.addLine(3.975, 0, 3.975, 0.95) +SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) +SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_23.result()) +SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_23.result(), "1-ep_voiles/2") +SketchConstraintLength_7 = Sketch_3.setLength(SketchLine_22.result(), "1.5-ep_voiles/2") +SketchConstraintLength_8 = Sketch_3.setLength(SketchLine_20.result(), "1-ep_voiles/2") +SketchConstraintLength_9 = Sketch_3.setLength(SketchLine_19.result(), "1.25-ep_voiles/2") +SketchConstraintLength_10 = Sketch_3.setLength(SketchLine_17.result(), 1.25) +SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"), False) +SketchLine_24 = SketchProjection_7.createdFeature() +SketchConstraintDistance_8 = Sketch_3.setDistance(SketchLine_17.startPoint(), SketchLine_24.result(), 0.375, True) +SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_6"), False) +SketchLine_25 = SketchProjection_8.createdFeature() +SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_22.endPoint(), SketchLine_25.result(), "0.25+ep_voiles/2", True) +model.do() +Edge_1_objects = [model.selection("EDGE", "Sketch_3/SketchLine_17"), model.selection("EDGE", "Sketch_3/SketchLine_19"), model.selection("EDGE", "Sketch_3/SketchLine_20"), model.selection("EDGE", "Sketch_3/SketchLine_22"), model.selection("EDGE", "Sketch_3/SketchLine_23")] +Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects) +Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Edge_1")], model.selection("EDGE", "PartSet/OZ"), "h_ouverture", 0) +Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_3_1_1/Generated_Edge&Sketch_3/SketchLine_17_StartVertex]e[Extrusion_3_1_1/To_Edge]e"), model.selection("VERTEX", "[Extrusion_3_1_3/Generated_Edge&Sketch_3/SketchLine_20_StartVertex]e[Extrusion_3_1_3/To_Edge]e"), model.selection("VERTEX", "[Extrusion_3_1_4/Generated_Edge&Sketch_3/SketchLine_22_EndVertex]e[Extrusion_3_1_4/To_Edge]e")) +Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) +SketchLine_26 = Sketch_4.addLine(0, 2.95, 0, 0) +SketchProjection_9 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_3_1_1/Generated_Edge&Sketch_3/SketchLine_17_StartVertex]e[Extrusion_3_1_1/To_Edge]e"), False) +SketchPoint_2 = SketchProjection_9.createdFeature() +SketchConstraintCoincidence_22 = Sketch_4.setCoincident(SketchLine_26.startPoint(), SketchPoint_2.result()) +SketchProjection_10 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_3_1_3/Generated_Edge&Sketch_3/SketchLine_20_StartVertex]e[Extrusion_3_1_3/To_Edge]e"), False) +SketchPoint_3 = SketchProjection_10.createdFeature() +SketchConstraintCoincidence_23 = Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchPoint_3.result()) +SketchLine_27 = Sketch_4.addLine(0, 0, 3.975, 0) +SketchConstraintCoincidence_24 = Sketch_4.setCoincident(SketchLine_26.endPoint(), SketchLine_27.startPoint()) +SketchProjection_11 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_3_1_4/Generated_Edge&Sketch_3/SketchLine_22_EndVertex]e[Extrusion_3_1_4/To_Edge]e"), False) +SketchPoint_4 = SketchProjection_11.createdFeature() +SketchConstraintCoincidence_25 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchPoint_4.result()) +SketchLine_28 = Sketch_4.addLine(3.975, 0, 3.975, 0.95) +SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint()) +SketchProjection_12 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_3_1_5/Generated_Edge&Sketch_3/SketchLine_23_EndVertex]e[Extrusion_3_1_5/To_Edge]e"), False) +SketchPoint_5 = SketchProjection_12.createdFeature() +SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchLine_28.endPoint(), SketchPoint_5.result()) +model.do() +Edge_2_objects = [model.selection("EDGE", "Sketch_4/SketchLine_26"), model.selection("EDGE", "Sketch_4/SketchLine_27"), model.selection("EDGE", "Sketch_4/SketchLine_28")] +Edge_2 = model.addEdge(Part_1_doc, Edge_2_objects) +Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Edge_2")], model.selection("EDGE", "PartSet/OZ"), "h_apres_ouverture-ep_dalles/2", 0) +Plane_5 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_4_1_1/Generated_Edge&Sketch_4/SketchLine_26_StartVertex]e[Extrusion_4_1_1/To_Edge]e"), model.selection("VERTEX", "[Extrusion_4_1_1/Generated_Edge&Sketch_4/SketchLine_26_EndVertex]e[Extrusion_4_1_1/To_Edge]e"), model.selection("VERTEX", "[Extrusion_4_1_2/Generated_Edge&Sketch_4/SketchLine_27_EndVertex]e[Extrusion_4_1_2/To_Edge]e")) +Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2")) +SketchLine_29 = Sketch_5.addLine(0, 2.95, 0, 0) +SketchProjection_13 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_4_1_1/Generated_Edge&Sketch_4/SketchLine_26_StartVertex]e[Extrusion_4_1_1/To_Edge]e"), False) +SketchPoint_6 = SketchProjection_13.createdFeature() +SketchConstraintCoincidence_28 = Sketch_5.setCoincident(SketchLine_29.startPoint(), SketchPoint_6.result()) +SketchProjection_14 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_4_1_1/Generated_Edge&Sketch_4/SketchLine_26_EndVertex]e[Extrusion_4_1_1/To_Edge]e"), False) +SketchPoint_7 = SketchProjection_14.createdFeature() +SketchConstraintCoincidence_29 = Sketch_5.setCoincident(SketchLine_29.endPoint(), SketchPoint_7.result()) +SketchLine_30 = Sketch_5.addLine(0, 0, 3.975, 0) +SketchConstraintCoincidence_30 = Sketch_5.setCoincident(SketchLine_29.endPoint(), SketchLine_30.startPoint()) +SketchProjection_15 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_4_1_2/Generated_Edge&Sketch_4/SketchLine_27_EndVertex]e[Extrusion_4_1_2/To_Edge]e"), False) +SketchPoint_8 = SketchProjection_15.createdFeature() +SketchConstraintCoincidence_31 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchPoint_8.result()) +SketchLine_31 = Sketch_5.addLine(3.975, 0, 3.975, 0.95) +SketchConstraintCoincidence_32 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint()) +SketchProjection_16 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_4_1_3/Generated_Edge&Sketch_4/SketchLine_28_EndVertex]e[Extrusion_4_1_3/To_Edge]e"), False) +SketchPoint_9 = SketchProjection_16.createdFeature() +SketchConstraintCoincidence_33 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchPoint_9.result()) +SketchLine_32 = Sketch_5.addLine(3.975, 0.95, 0, 2.95) +SketchConstraintCoincidence_34 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint()) +SketchConstraintCoincidence_35 = Sketch_5.setCoincident(SketchLine_29.startPoint(), SketchLine_32.endPoint()) +SketchLine_33 = Sketch_5.addLine(1.85, 2.019182389937107, 1.85, 0) +SketchConstraintCoincidence_36 = Sketch_5.setCoincident(SketchLine_33.startPoint(), SketchLine_32.result()) +SketchConstraintCoincidence_37 = Sketch_5.setCoincident(SketchLine_33.endPoint(), SketchLine_30.result()) +SketchLine_34 = Sketch_5.addLine(2.075, 1.905974842767296, 2.075, 0) +SketchConstraintCoincidence_38 = Sketch_5.setCoincident(SketchLine_34.startPoint(), SketchLine_32.result()) +SketchConstraintCoincidence_39 = Sketch_5.setCoincident(SketchLine_34.endPoint(), SketchLine_30.result()) +SketchConstraintVertical_8 = Sketch_5.setVertical(SketchLine_33.result()) +SketchConstraintVertical_9 = Sketch_5.setVertical(SketchLine_34.result()) +SketchConstraintDistance_10 = Sketch_5.setDistance(SketchLine_33.startPoint(), SketchLine_29.result(), 1.85, True) +SketchConstraintDistance_11 = Sketch_5.setDistance(SketchLine_34.startPoint(), SketchLine_31.result(), 1.9, True) +model.do() +Face_1_objects = [model.selection("FACE", "Sketch_5/Face-SketchLine_29r-SketchLine_30f-SketchLine_33r-SketchLine_32f"), model.selection("FACE", "Sketch_5/Face-SketchLine_30f-SketchLine_34r-SketchLine_32f-SketchLine_33f"), model.selection("FACE", "Sketch_5/Face-SketchLine_30f-SketchLine_31f-SketchLine_32f-SketchLine_34f")] +Face_1 = model.addFace(Part_1_doc, Face_1_objects) +LinearCopy_1_objects = [model.selection("COMPOUND", "Extrusion_3_1"), model.selection("COMPOUND", "Extrusion_4_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_1_2"), model.selection("FACE", "Face_1_3")] +LinearCopy_1 = model.addMultiTranslation(Part_1_doc, LinearCopy_1_objects, model.selection("EDGE", "PartSet/OZ"), "h_ouverture+h_apres_ouverture-ep_dalles/2", 3) +Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_2/SketchPoint_1")]) +Extrusion_5 = model.addExtrusion(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("EDGE", "PartSet/OZ"), model.selection("FACE", "LinearCopy_1_3_3"), 0, model.selection("FACE", "Sketch_2/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r"), 0) +Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("EDGE", "Extrusion_5_1"), model.selection("COMPOUND", "LinearCopy_1_1"), model.selection("COMPOUND", "LinearCopy_1_2"), model.selection("COMPOUND", "LinearCopy_1_3"), model.selection("COMPOUND", "LinearCopy_1_4"), model.selection("COMPOUND", "LinearCopy_1_5")] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects) +Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Partition_1_1_2")]) +Group_1.setName("base") +Group_1.result().setName("base") +Group_1.result().setColor(170, 0, 0) +Group_2_objects = [model.selection("EDGE", "Partition_1_1_2/Modified_Edge&Sketch_2/SketchPoint_1"), model.selection("EDGE", "Partition_1_1_3"), model.selection("EDGE", "Partition_1_1_4"), model.selection("EDGE", "Partition_1_1_5")] +Group_2 = model.addGroup(Part_1_doc, Group_2_objects) +Group_2.setName("poteau") +Group_2.result().setName("poteau") +Group_2.result().setColor(0, 170, 0) +Group_3_objects = [model.selection("FACE", "Partition_1_1_38"), model.selection("FACE", "Partition_1_1_32"), model.selection("FACE", "Partition_1_1_37"), model.selection("FACE", "Partition_1_1_31"), model.selection("FACE", "Partition_1_1_36"), model.selection("FACE", "Partition_1_1_30")] +Group_3 = model.addGroup(Part_1_doc, Group_3_objects) +Group_3.setName("dalles") +Group_3.result().setName("dalles") +Group_3.result().setColor(97, 97, 116) +Group_4_objects = [model.selection("FACE", "Partition_1_1_29"), model.selection("FACE", "Partition_1_1_20"), model.selection("FACE", "Partition_1_1_26"), model.selection("FACE", "Partition_1_1_15"), model.selection("FACE", "Partition_1_1_23"), model.selection("FACE", "Partition_1_1_10"), model.selection("FACE", "Partition_1_1_7"), model.selection("FACE", "Partition_1_1_21"), model.selection("FACE", "Partition_1_1_6"), model.selection("FACE", "Partition_1_1_12"), model.selection("FACE", "Partition_1_1_24"), model.selection("FACE", "Partition_1_1_11"), model.selection("FACE", "Partition_1_1_17"), model.selection("FACE", "Partition_1_1_27"), model.selection("FACE", "Partition_1_1_16"), model.selection("FACE", "Partition_1_1_28"), model.selection("FACE", "Partition_1_1_18"), model.selection("FACE", "Partition_1_1_19"), model.selection("FACE", "Partition_1_1_25"), model.selection("FACE", "Partition_1_1_13"), model.selection("FACE", "Partition_1_1_14"), model.selection("FACE", "Partition_1_1_22"), model.selection("FACE", "Partition_1_1_8"), model.selection("FACE", "Partition_1_1_9")] +Group_4 = model.addGroup(Part_1_doc, Group_4_objects) +Group_4.setName("voiles") +Group_4.result().setName("voiles") +Group_5_objects = [model.selection("FACE", "Partition_1_1_35"), model.selection("FACE", "Partition_1_1_34"), model.selection("FACE", "Partition_1_1_33")] +Group_5 = model.addGroup(Part_1_doc, Group_5_objects) +Group_5.setName("poutre_centrale") +Group_5.result().setName("poutre_centrale") +Group_5.result().setColor(0, 85, 255) +Group_6_objects = [model.selection("EDGE", "Partition_1_1_38/Modified_Edge&Sketch_5/SketchLine_32"), model.selection("EDGE", "Partition_1_1_35/Modified_Edge&Sketch_5/SketchLine_32"), model.selection("EDGE", "Partition_1_1_32/Modified_Edge&Sketch_5/SketchLine_32"), model.selection("EDGE", "Partition_1_1_37/Modified_Edge&Sketch_5/SketchLine_32"), model.selection("EDGE", "Partition_1_1_34/Modified_Edge&Sketch_5/SketchLine_32"), model.selection("EDGE", "Partition_1_1_31/Modified_Edge&Sketch_5/SketchLine_32"), model.selection("EDGE", "Partition_1_1_36/Modified_Edge&Sketch_5/SketchLine_32"), model.selection("EDGE", "Partition_1_1_33/Modified_Edge&Sketch_5/SketchLine_32"), model.selection("EDGE", "Partition_1_1_30/Modified_Edge&Sketch_5/SketchLine_32")] +Group_6 = model.addGroup(Part_1_doc, Group_6_objects) +Group_6.setName("poutres_transversales") +Group_6.result().setName("poutres_transversales") +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [38]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [2]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [49]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.EDGE, [247]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [499]) + +import math +from GeomAlgoAPI import * +aResultArea = GeomAlgoAPI_ShapeTools_area(Partition_1.results()[0].resultSubShapePair()[0].shape()) +anExpectedArea = 70.18465 +assert(math.fabs(aResultArea-anExpectedArea)/anExpectedArea<1e-7) + +assert(Partition_1.feature().error() == '') +for gr in [Group_1, Group_2, Group_3, Group_4, Group_5, Group_6]: + assert(gr.feature().error() == ''), "The group {0} is in error: {1}".format(gr.name(), gr.feature().error()) + +assert(model.checkPythonDump()) -- 2.39.2