From 0f5ecf0887261ef44c302dd1414924713fc481e1 Mon Sep 17 00:00:00 2001 From: dbv Date: Mon, 20 Aug 2018 15:41:46 +0300 Subject: [PATCH] Issue #2563: CEA 2018-1 Common Added some unit tests. --- src/FeaturesPlugin/CMakeLists.txt | 22 ++ ...mon_CompSolidCompound_CompSolidCompound.py | 113 ++++++++ ...estBooleanCommon_CompSolidCompound_Face.py | 104 +++++++ ...stBooleanCommon_CompSolidCompound_Shell.py | 108 ++++++++ .../TestBooleanCommon_CompSolid_CompSolid.py | 87 ++++++ .../Test/TestBooleanCommon_CompSolid_Face.py | 83 ++++++ .../Test/TestBooleanCommon_CompSolid_Shell.py | 87 ++++++ ...BooleanCommon_EdgeCompound_EdgeCompound.py | 59 ++++ .../Test/TestBooleanCommon_Edge_Edge.py | 50 ++++ ...BooleanCommon_FaceCompound_FaceCompound.py | 113 ++++++++ .../Test/TestBooleanCommon_Face_Face.py | 78 ++++++ ...oleanCommon_ShellCompound_ShellCompound.py | 131 +++++++++ .../Test/TestBooleanCommon_Shell_Shell.py | 87 ++++++ .../TestBooleanCommon_SolidCompound_Face.py | 96 +++++++ .../TestBooleanCommon_SolidCompound_Shell.py | 102 +++++++ ...oleanCommon_SolidCompound_SolidCompound.py | 113 ++++++++ .../Test/TestBooleanCommon_Solid_Face.py | 48 ++++ .../Test/TestBooleanCommon_Solid_Shell.py | 65 +++++ .../Test/TestBooleanCommon_Solid_Solid.py | 43 +++ ...eanCommon_VertexCompound_VertexCompound.py | 53 ++++ .../Test/TestBooleanCommon_Vertex_Vertex.py | 66 +++++ ...BooleanCommon_WireCompound_WireCompound.py | 91 ++++++ .../Test/TestBooleanCommon_Wire_Wire.py | 68 +++++ src/FeaturesPlugin/Test/_Test2394.py | 258 ++++++++++++++++++ 24 files changed, 2125 insertions(+) create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_CompSolidCompound.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Face.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Shell.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_CompSolid.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Face.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Shell.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_EdgeCompound_EdgeCompound.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_Edge_Edge.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_FaceCompound_FaceCompound.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_Face_Face.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_ShellCompound_ShellCompound.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_Shell_Shell.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Face.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Shell.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_SolidCompound.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Face.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Shell.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Solid.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_VertexCompound_VertexCompound.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_Vertex_Vertex.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_WireCompound_WireCompound.py create mode 100644 src/FeaturesPlugin/Test/TestBooleanCommon_Wire_Wire.py create mode 100644 src/FeaturesPlugin/Test/_Test2394.py diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index a4d80e857..8361d95d1 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -301,4 +301,26 @@ ADD_UNIT_TESTS(TestExtrusion.py TestBooleanSmash_Face_Face.py TestBooleanFuse_SimpleMode.py TestBooleanFuse_RemoveEdges.py + TestBooleanCommon_Vertex_Vertex.py + TestBooleanCommon_VertexCompound_VertexCompound.py + TestBooleanCommon_Edge_Edge.py + TestBooleanCommon_EdgeCompound_EdgeCompound.py + TestBooleanCommon_Wire_Wire.py + TestBooleanCommon_WireCompound_WireCompound.py + TestBooleanCommon_Face_Face.py + TestBooleanCommon_FaceCompound_FaceCompound.py + TestBooleanCommon_Shell_Shell.py + TestBooleanCommon_ShellCompound_ShellCompound.py + TestBooleanCommon_Solid_Face.py + TestBooleanCommon_Solid_Shell.py + TestBooleanCommon_Solid_Solid.py + TestBooleanCommon_SolidCompound_Face.py + TestBooleanCommon_SolidCompound_Shell.py + TestBooleanCommon_SolidCompound_SolidCompound.py + TestBooleanCommon_CompSolid_Face.py + TestBooleanCommon_CompSolid_Shell.py + TestBooleanCommon_CompSolid_CompSolid.py + TestBooleanCommon_CompSolidCompound_Face.py + TestBooleanCommon_CompSolidCompound_Shell.py + TestBooleanCommon_CompSolidCompound_CompSolidCompound.py ) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_CompSolidCompound.py b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_CompSolidCompound.py new file mode 100644 index 000000000..7403d06d7 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_CompSolidCompound.py @@ -0,0 +1,113 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(-20.89528643446688, 23.53376279136156, -12.17630887873155, 30.26420160631515) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-12.17630887873155, 30.26420160631515, -3.763260360039565, 22.15708212466651) +SketchLine_2.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_3 = Sketch_1.addLine(-3.763260360039565, 22.15708212466651, -11.56445080464485, 13.8969981244962) +SketchLine_3.result().setColor(225, 0, 0) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_4 = Sketch_1.addLine(-11.56445080464485, 13.8969981244962, -20.89528643446688, 23.53376279136156) +SketchLine_4.result().setColor(225, 0, 0) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint()) +SketchLine_5 = Sketch_1.addLine(-20.89528643446688, 23.53376279136156, -3.763260360039565, 22.15708212466651) +SketchLine_5.result().setColor(225, 0, 0) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_5.endPoint()) +SketchLine_6 = Sketch_1.addLine(7.862043047607545, 23.07486923579655, 15.35730445516949, 31.02902419892351) +SketchLine_6.result().setColor(225, 0, 0) +SketchLine_7 = Sketch_1.addLine(15.35730445516949, 31.02902419892351, 24.53517556646984, 20.93336597649314) +SketchLine_7.result().setColor(225, 0, 0) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchLine_8 = Sketch_1.addLine(24.53517556646984, 20.93336597649314, 17.03991415890789, 12.67328197632283) +SketchLine_8.result().setColor(225, 0, 0) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchLine_9 = Sketch_1.addLine(17.03991415890789, 12.67328197632283, 7.862043047607545, 23.07486923579655) +SketchLine_9.result().setColor(225, 0, 0) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_9.endPoint()) +SketchLine_10 = Sketch_1.addLine(7.862043047607545, 23.07486923579655, 24.53517556646984, 20.93336597649314) +SketchLine_10.result().setColor(225, 0, 0) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_10.endPoint()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_11 = Sketch_2.addLine(-6.516621693429666, 11.60253034667112, -9.88184110090646, 19.09779175423307) +SketchLine_11.result().setColor(225, 0, 0) +SketchLine_12 = Sketch_2.addLine(-9.88184110090646, 19.09779175423307, -1.162863545171131, 18.94482723571139) +SketchLine_12.result().setColor(225, 0, 0) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchLine_13 = Sketch_2.addLine(-1.162863545171131, 18.94482723571139, 0.8256751956106094, 13.43810456893119) +SketchLine_13.result().setColor(225, 0, 0) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchLine_14 = Sketch_2.addLine(0.8256751956106094, 13.43810456893119, -6.516621693429666, 11.60253034667112) +SketchLine_14.result().setColor(225, 0, 0) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_14.endPoint()) +SketchLine_15 = Sketch_2.addLine(-1.162863545171131, 18.94482723571139, -6.516621693429666, 11.60253034667112) +SketchLine_15.result().setColor(225, 0, 0) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_15.endPoint()) +SketchLine_16 = Sketch_2.addLine(6.332397862390824, 16.34443042084296, 15.35730445516949, 18.79186271718972) +SketchLine_16.result().setColor(225, 0, 0) +SketchLine_17 = Sketch_2.addLine(15.35730445516949, 18.79186271718972, 12.75690764030107, 10.22584967997607) +SketchLine_17.result().setColor(225, 0, 0) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchLine_18 = Sketch_2.addLine(12.75690764030107, 10.22584967997607, 6.179433343869151, 7.778417383629304) +SketchLine_18.result().setColor(225, 0, 0) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) +SketchLine_19 = Sketch_2.addLine(6.179433343869151, 7.778417383629304, 6.332397862390824, 16.34443042084296) +SketchLine_19.result().setColor(225, 0, 0) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchLine_19.endPoint()) +SketchLine_20 = Sketch_2.addLine(6.332397862390824, 16.34443042084296, 12.75690764030107, 10.22584967997607) +SketchLine_20.result().setColor(225, 0, 0) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_20.endPoint()) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10) +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 5, 5) +Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_1_2")]) +Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_2_1"), model.selection("COMPSOLID", "Extrusion_2_2")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [2]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [2]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [10]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [36]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [72]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Face.py b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Face.py new file mode 100644 index 000000000..5e761e566 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Face.py @@ -0,0 +1,104 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(-21.66024096385543, 40.92621620645053, -77.63614457831326, 40.92621620645053) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-77.63614457831326, 40.92621620645053, -77.63614457831326, 1.907518733308514) +SketchLine_2.result().setColor(225, 0, 0) +SketchLine_3 = Sketch_1.addLine(-77.63614457831326, 1.907518733308514, -21.66024096385543, 1.907518733308514) +SketchLine_3.result().setColor(225, 0, 0) +SketchLine_4 = Sketch_1.addLine(-21.66024096385543, 1.907518733308514, -21.66024096385543, 40.92621620645053) +SketchLine_4.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +SketchLine_5 = Sketch_1.addLine(65.46746987951809, 41.25025618940838, 10.46506024096384, 41.25025618940838) +SketchLine_5.result().setColor(225, 0, 0) +SketchLine_6 = Sketch_1.addLine(10.46506024096384, 41.25025618940838, 10.46506024096384, -1.337003177360179) +SketchLine_6.result().setColor(225, 0, 0) +SketchLine_7 = Sketch_1.addLine(10.46506024096384, -1.337003177360179, 65.46746987951809, -1.337003177360179) +SketchLine_7.result().setColor(225, 0, 0) +SketchLine_8 = Sketch_1.addLine(65.46746987951809, -1.337003177360179, 65.46746987951809, 41.25025618940838) +SketchLine_8.result().setColor(225, 0, 0) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) +SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) +SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) +SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result()) +SketchLine_9 = Sketch_1.addLine(-54.27228915662651, 40.92621620645053, -55.24578313253012, 1.907518733308514) +SketchLine_9.result().setColor(225, 0, 0) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_3.result()) +SketchLine_10 = Sketch_1.addLine(31.88192771084336, 41.25025618940838, 30.42168674698797, -1.337003177360179) +SketchLine_10.result().setColor(225, 0, 0) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.startPoint(), SketchLine_5.result()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.result()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_11 = Sketch_2.addLine(19.22650602409638, 27.01445783132531, -12.83325439216414, 27.01445783132531) +SketchLine_11.result().setColor(225, 0, 0) +SketchLine_12 = Sketch_2.addLine(-12.83325439216414, 27.01445783132531, -12.83325439216414, 11.0281619215649) +SketchLine_12.result().setColor(225, 0, 0) +SketchLine_13 = Sketch_2.addLine(-12.83325439216414, 11.0281619215649, 19.22650602409638, 11.0281619215649) +SketchLine_13.result().setColor(225, 0, 0) +SketchLine_14 = Sketch_2.addLine(19.22650602409638, 11.0281619215649, 19.22650602409638, 27.01445783132531) +SketchLine_14.result().setColor(225, 0, 0) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_16 = 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()) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10) +Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_14f")]) +Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_1_2")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("COMPOUND", "Compound_1_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [1]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [4]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [8]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Shell.py b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Shell.py new file mode 100644 index 000000000..74c10c929 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolidCompound_Shell.py @@ -0,0 +1,108 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(-21.66024096385543, 40.92621620645053, -77.63614457831326, 40.92621620645053) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-77.63614457831326, 40.92621620645053, -77.63614457831326, 1.907518733308514) +SketchLine_2.result().setColor(225, 0, 0) +SketchLine_3 = Sketch_1.addLine(-77.63614457831326, 1.907518733308514, -21.66024096385543, 1.907518733308514) +SketchLine_3.result().setColor(225, 0, 0) +SketchLine_4 = Sketch_1.addLine(-21.66024096385543, 1.907518733308514, -21.66024096385543, 40.92621620645053) +SketchLine_4.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +SketchLine_5 = Sketch_1.addLine(65.46746987951809, 41.25025618940838, 10.46506024096384, 41.25025618940838) +SketchLine_5.result().setColor(225, 0, 0) +SketchLine_6 = Sketch_1.addLine(10.46506024096384, 41.25025618940838, 10.46506024096384, -1.337003177360179) +SketchLine_6.result().setColor(225, 0, 0) +SketchLine_7 = Sketch_1.addLine(10.46506024096384, -1.337003177360179, 65.46746987951809, -1.337003177360179) +SketchLine_7.result().setColor(225, 0, 0) +SketchLine_8 = Sketch_1.addLine(65.46746987951809, -1.337003177360179, 65.46746987951809, 41.25025618940838) +SketchLine_8.result().setColor(225, 0, 0) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) +SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) +SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) +SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result()) +SketchLine_9 = Sketch_1.addLine(-54.27228915662651, 40.92621620645053, -55.24578313253012, 1.907518733308514) +SketchLine_9.result().setColor(225, 0, 0) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_3.result()) +SketchLine_10 = Sketch_1.addLine(31.88192771084336, 41.25025618940838, 30.42168674698797, -1.337003177360179) +SketchLine_10.result().setColor(225, 0, 0) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.startPoint(), SketchLine_5.result()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.result()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_11 = Sketch_2.addLine(19.22650602409638, 26.41583731352732, -12.83325439216414, 26.41583731352732) +SketchLine_11.result().setColor(225, 0, 0) +SketchLine_12 = Sketch_2.addLine(-12.83325439216414, 26.41583731352732, -12.83325439216414, 12.07337391600091) +SketchLine_12.result().setColor(225, 0, 0) +SketchLine_13 = Sketch_2.addLine(-12.83325439216414, 12.07337391600091, 19.22650602409638, 12.07337391600091) +SketchLine_13.result().setColor(225, 0, 0) +SketchLine_14 = Sketch_2.addLine(19.22650602409638, 12.07337391600091, 19.22650602409638, 26.41583731352732) +SketchLine_14.result().setColor(225, 0, 0) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_16 = 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()) +SketchLine_15 = Sketch_2.addLine(0.2648302996693306, 26.41583731352732, -0.2234771832481639, 12.07337391600092) +SketchLine_15.result().setColor(225, 0, 0) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_15.startPoint(), SketchLine_11.result()) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_13.result()) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10) +Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_1_2")]) +Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchLine_13f-SketchLine_14f-SketchLine_15f"), model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_15r")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("COMPOUND", "Compound_1_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [1]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [4]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [8]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_CompSolid.py b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_CompSolid.py new file mode 100644 index 000000000..7e8a9b906 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_CompSolid.py @@ -0,0 +1,87 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(47.26932589060148, 52.61651755566245, -44.41221948537944, 52.61651755566245) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-44.41221948537944, 52.61651755566245, -44.41221948537944, -26.74931734128092) +SketchLine_2.result().setColor(225, 0, 0) +SketchLine_3 = Sketch_1.addLine(-44.41221948537944, -26.74931734128092, 47.26932589060148, -26.74931734128092) +SketchLine_3.result().setColor(225, 0, 0) +SketchLine_4 = Sketch_1.addLine(47.26932589060148, -26.74931734128092, 47.26932589060148, 52.61651755566245) +SketchLine_4.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +SketchLine_5 = Sketch_1.addLine(7.069530544036858, 52.61651755566245, 10.55455403994589, -26.74931734128092) +SketchLine_5.result().setColor(225, 0, 0) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_6 = Sketch_2.addLine(95.24043941744291, 32.97847252814945, 25.14447162912627, 32.97847252814945) +SketchLine_6.result().setColor(225, 0, 0) +SketchLine_7 = Sketch_2.addLine(25.14447162912627, 32.97847252814945, 25.14447162912627, -11.61656767103746) +SketchLine_7.result().setColor(225, 0, 0) +SketchLine_8 = Sketch_2.addLine(25.14447162912627, -11.61656767103746, 95.24043941744291, -11.61656767103746) +SketchLine_8.result().setColor(225, 0, 0) +SketchLine_9 = Sketch_2.addLine(95.24043941744291, -11.61656767103746, 95.24043941744291, 32.97847252814945) +SketchLine_9.result().setColor(225, 0, 0) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result()) +SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_7.result()) +SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result()) +SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result()) +SketchLine_10 = Sketch_2.addLine(63.78513134811883, 32.97847252814945, 65.47170548447893, -11.61656767103746) +SketchLine_10.result().setColor(225, 0, 0) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_8.result()) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10) +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 5, 5) +Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_2_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [1]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [6]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [24]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [48]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Face.py b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Face.py new file mode 100644 index 000000000..c81d3ab52 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Face.py @@ -0,0 +1,83 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(21.16527496861552, 26.63979884904572, -22.80735826270614, 26.63979884904572) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-22.80735826270614, 26.63979884904572, -22.80735826270614, -13.87637783487681) +SketchLine_2.result().setColor(225, 0, 0) +SketchLine_3 = Sketch_1.addLine(-22.80735826270614, -13.87637783487681, 21.16527496861552, -13.87637783487681) +SketchLine_3.result().setColor(225, 0, 0) +SketchLine_4 = Sketch_1.addLine(21.16527496861552, -13.87637783487681, 21.16527496861552, 26.63979884904572) +SketchLine_4.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +SketchLine_5 = Sketch_1.addLine(-2.257333687264361, 26.63979884904572, -2.257333687264361, -13.87637783487681) +SketchLine_5.result().setColor(225, 0, 0) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_6 = Sketch_2.addLine(29.6987556208597, 11.4175813298688, 13.10955704685832, 11.4175813298688) +SketchLine_6.result().setColor(225, 0, 0) +SketchLine_7 = Sketch_2.addLine(13.10955704685832, 11.4175813298688, 13.10955704685832, -4.852594194632538) +SketchLine_7.result().setColor(225, 0, 0) +SketchLine_8 = Sketch_2.addLine(13.10955704685832, -4.852594194632538, 29.6987556208597, -4.852594194632538) +SketchLine_8.result().setColor(225, 0, 0) +SketchLine_9 = Sketch_2.addLine(29.6987556208597, -4.852594194632538, 29.6987556208597, 11.4175813298688) +SketchLine_9.result().setColor(225, 0, 0) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result()) +SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_7.result()) +SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result()) +SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result()) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10) +Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [1]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [4]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [8]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Shell.py b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Shell.py new file mode 100644 index 000000000..6666e20f8 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_CompSolid_Shell.py @@ -0,0 +1,87 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(15.15938358623833, 14.4352070421809, -11.43137169301882, 14.4352070421809) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-11.43137169301882, 14.4352070421809, -11.43137169301882, -6.935604568322221) +SketchLine_2.result().setColor(225, 0, 0) +SketchLine_3 = Sketch_1.addLine(-11.43137169301882, -6.935604568322221, 15.15938358623833, -6.935604568322221) +SketchLine_3.result().setColor(225, 0, 0) +SketchLine_4 = Sketch_1.addLine(15.15938358623833, -6.935604568322221, 15.15938358623833, 14.4352070421809) +SketchLine_4.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +SketchLine_5 = Sketch_1.addLine(1.934351860046943, 14.4352070421809, 2.075043686921314, -6.935604568322221) +SketchLine_5.result().setColor(225, 0, 0) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_6 = Sketch_2.addLine(26.29086071781277, 6.827405438264643, 9.220324256871813, 6.827405438264643) +SketchLine_6.result().setColor(225, 0, 0) +SketchLine_7 = Sketch_2.addLine(9.220324256871813, 6.827405438264643, 9.220324256871813, -3.640935176083419) +SketchLine_7.result().setColor(225, 0, 0) +SketchLine_8 = Sketch_2.addLine(9.220324256871813, -3.640935176083419, 26.29086071781277, -3.640935176083419) +SketchLine_8.result().setColor(225, 0, 0) +SketchLine_9 = Sketch_2.addLine(26.29086071781277, -3.640935176083419, 26.29086071781277, 6.827405438264643) +SketchLine_9.result().setColor(225, 0, 0) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result()) +SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_7.result()) +SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result()) +SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result()) +SketchLine_10 = Sketch_2.addLine(18.73204224198193, 6.827405438264643, 19.20309616379092, -3.640935176083419) +SketchLine_10.result().setColor(225, 0, 0) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_8.result()) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10) +Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_10r"), model.selection("FACE", "Sketch_2/Face-SketchLine_6f-SketchLine_8f-SketchLine_9f-SketchLine_10f")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [1]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [4]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [8]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_EdgeCompound_EdgeCompound.py b/src/FeaturesPlugin/Test/TestBooleanCommon_EdgeCompound_EdgeCompound.py new file mode 100644 index 000000000..8dfee9bee --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_EdgeCompound_EdgeCompound.py @@ -0,0 +1,59 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(-77.19749092035903, 24.18794374198263, -26.50243221408208, 23.76942369170098) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-52.21940522238806, 23.98173370989996, -68.62380444441784, 24.11716249058297) +SketchLine_2.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result()) +SketchLine_3 = Sketch_1.addLine(9.658082674231901, 24.38959180621407, 76.00931510902234, 24.79203653255435) +SketchLine_3.result().setColor(225, 0, 0) +SketchLine_4 = Sketch_1.addLine(31.27467463593981, 24.52070441885453, 55.13167389667986, 24.6654059290823) +SketchLine_4.result().setColor(225, 0, 0) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_3.result()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_3.result()) +model.do() +Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")]) +Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3")]) +Compound_1 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_2_2")]) +Compound_2 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_2_1")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [2]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [2]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [4]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Edge_Edge.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Edge_Edge.py new file mode 100644 index 000000000..d1e0aca8a --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Edge_Edge.py @@ -0,0 +1,50 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(-57.23353499871462, -2.917111725546991, 40.54932729918568, 17.67239476025231) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-81.47249047471176, -8.020952206935315, 40.54932729918568, 17.67239476025231) +SketchLine_2.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.endPoint()) +model.do() +Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [1]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [2]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_FaceCompound_FaceCompound.py b/src/FeaturesPlugin/Test/TestBooleanCommon_FaceCompound_FaceCompound.py new file mode 100644 index 000000000..4b1790bb1 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_FaceCompound_FaceCompound.py @@ -0,0 +1,113 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(-26.91983967935873, 43.92184368737476, -89.26052104208418, 43.92184368737476) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-89.26052104208418, 43.92184368737476, -89.26052104208418, 10.32264529058116) +SketchLine_2.result().setColor(225, 0, 0) +SketchLine_3 = Sketch_1.addLine(-89.26052104208418, 10.32264529058116, -26.91983967935873, 10.32264529058116) +SketchLine_3.result().setColor(225, 0, 0) +SketchLine_4 = Sketch_1.addLine(-26.91983967935873, 10.32264529058116, -26.91983967935873, 43.92184368737476) +SketchLine_4.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +SketchLine_5 = Sketch_1.addLine(92.09418837675352, 44.32665330661324, 12.75150300601203, 44.32665330661324) +SketchLine_5.result().setColor(225, 0, 0) +SketchLine_6 = Sketch_1.addLine(12.75150300601203, 44.32665330661324, 12.75150300601203, 10.32264529058116) +SketchLine_6.result().setColor(225, 0, 0) +SketchLine_7 = Sketch_1.addLine(12.75150300601203, 10.32264529058116, 92.09418837675352, 10.32264529058116) +SketchLine_7.result().setColor(225, 0, 0) +SketchLine_8 = Sketch_1.addLine(92.09418837675352, 10.32264529058116, 92.09418837675352, 44.32665330661324) +SketchLine_8.result().setColor(225, 0, 0) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) +SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) +SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) +SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_9 = Sketch_2.addLine(-44.32665330661324, 21.65731462925853, -65.78156312625251, 21.65731462925853) +SketchLine_9.result().setColor(225, 0, 0) +SketchLine_10 = Sketch_2.addLine(-65.78156312625251, 21.65731462925853, -65.78156312625251, -10.72745490981964) +SketchLine_10.result().setColor(225, 0, 0) +SketchLine_11 = Sketch_2.addLine(-65.78156312625251, -10.72745490981964, -44.32665330661324, -10.72745490981964) +SketchLine_11.result().setColor(225, 0, 0) +SketchLine_12 = Sketch_2.addLine(-44.32665330661324, -10.72745490981964, -44.32665330661324, 21.65731462925853) +SketchLine_12.result().setColor(225, 0, 0) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_9.result()) +SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_10.result()) +SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_11.result()) +SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_12.result()) +SketchLine_13 = Sketch_2.addLine(64.56713426853709, 24.08617234468937, 42.70741482965934, 24.08617234468937) +SketchLine_13.result().setColor(225, 0, 0) +SketchLine_14 = Sketch_2.addLine(42.70741482965934, 24.08617234468937, 42.70741482965934, -10.32264529058116) +SketchLine_14.result().setColor(225, 0, 0) +SketchLine_15 = Sketch_2.addLine(42.70741482965934, -10.32264529058116, 64.56713426853709, -10.32264529058116) +SketchLine_15.result().setColor(225, 0, 0) +SketchLine_16 = Sketch_2.addLine(64.56713426853709, -10.32264529058116, 64.56713426853709, 24.08617234468937) +SketchLine_16.result().setColor(225, 0, 0) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_13.result()) +SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_14.result()) +SketchConstraintHorizontal_8 = Sketch_2.setHorizontal(SketchLine_15.result()) +SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_16.result()) +model.do() +Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")]) +Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_12f"), model.selection("FACE", "Sketch_2/Face-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchLine_16f")]) +Compound_1 = model.addCompound(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_1_2")]) +Compound_2 = model.addCompound(Part_1_doc, [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_2_2")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [2]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [2]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [8]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [16]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Face_Face.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Face_Face.py new file mode 100644 index 000000000..75ef3b7cc --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Face_Face.py @@ -0,0 +1,78 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(24.08617234468939, 57.68537074148297, -74.28256513026052, 57.68537074148297) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-74.28256513026052, 57.68537074148297, -74.28256513026052, 13.96593186372746) +SketchLine_2.result().setColor(225, 0, 0) +SketchLine_3 = Sketch_1.addLine(-74.28256513026052, 13.96593186372746, 24.08617234468939, 13.96593186372746) +SketchLine_3.result().setColor(225, 0, 0) +SketchLine_4 = Sketch_1.addLine(24.08617234468939, 13.96593186372746, 24.08617234468939, 57.68537074148297) +SketchLine_4.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_5 = Sketch_2.addLine(-6.679358717434877, 28.9438877755511, -34.20641282565131, 28.9438877755511) +SketchLine_5.result().setColor(225, 0, 0) +SketchLine_6 = Sketch_2.addLine(-34.20641282565131, 28.9438877755511, -34.20641282565131, -14.37074148296594) +SketchLine_6.result().setColor(225, 0, 0) +SketchLine_7 = Sketch_2.addLine(-34.20641282565131, -14.37074148296594, -6.679358717434877, -14.37074148296594) +SketchLine_7.result().setColor(225, 0, 0) +SketchLine_8 = Sketch_2.addLine(-6.679358717434877, -14.37074148296594, -6.679358717434877, 28.9438877755511) +SketchLine_8.result().setColor(225, 0, 0) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_5.result()) +SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result()) +SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result()) +SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result()) +model.do() +Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f"), model.selection("FACE", "Sketch_2/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_1_2")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [1]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [4]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [8]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_ShellCompound_ShellCompound.py b/src/FeaturesPlugin/Test/TestBooleanCommon_ShellCompound_ShellCompound.py new file mode 100644 index 000000000..fe5ec1c33 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_ShellCompound_ShellCompound.py @@ -0,0 +1,131 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(-11.4055110220441, 59.07236770836705, -90.54579158316633, 59.07236770836705) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-90.54579158316633, 59.07236770836705, -90.54579158316633, 18.29259905792451) +SketchLine_2.result().setColor(225, 0, 0) +SketchLine_3 = Sketch_1.addLine(-90.54579158316633, 18.29259905792451, -11.4055110220441, 18.29259905792451) +SketchLine_3.result().setColor(225, 0, 0) +SketchLine_4 = Sketch_1.addLine(-11.4055110220441, 18.29259905792451, -11.4055110220441, 59.07236770836705) +SketchLine_4.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +SketchLine_5 = Sketch_1.addLine(116.15, 58.70699100906781, 29.5612224448898, 58.70699100906781) +SketchLine_5.result().setColor(225, 0, 0) +SketchLine_6 = Sketch_1.addLine(29.5612224448898, 58.70699100906781, 29.5612224448898, 16.80919541788544) +SketchLine_6.result().setColor(225, 0, 0) +SketchLine_7 = Sketch_1.addLine(29.5612224448898, 16.80919541788544, 116.15, 16.80919541788544) +SketchLine_7.result().setColor(225, 0, 0) +SketchLine_8 = Sketch_1.addLine(116.15, 16.80919541788544, 116.15, 58.70699100906781) +SketchLine_8.result().setColor(225, 0, 0) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) +SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) +SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) +SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result()) +SketchLine_9 = Sketch_1.addLine(-51.44118236472945, 59.07236770836705, -50.51012024048097, 18.29259905792451) +SketchLine_9.result().setColor(225, 0, 0) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_3.result()) +SketchLine_10 = Sketch_1.addLine(72.85561122244489, 16.80919541788544, 73.32114228456915, 58.70699100906781) +SketchLine_10.result().setColor(225, 0, 0) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.startPoint(), SketchLine_7.result()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_5.result()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_11 = Sketch_2.addLine(-33.65512410802471, 32.35440881763527, -66.62101906518004, 32.35440881763527) +SketchLine_11.result().setColor(225, 0, 0) +SketchLine_12 = Sketch_2.addLine(-66.62101906518004, 32.35440881763527, -66.62101906518004, -10.93997995991984) +SketchLine_12.result().setColor(225, 0, 0) +SketchLine_13 = Sketch_2.addLine(-66.62101906518004, -10.93997995991984, -33.65512410802471, -10.93997995991984) +SketchLine_13.result().setColor(225, 0, 0) +SketchLine_14 = Sketch_2.addLine(-33.65512410802471, -10.93997995991984, -33.65512410802471, 32.35440881763527) +SketchLine_14.result().setColor(225, 0, 0) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_16 = 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()) +SketchLine_15 = Sketch_2.addLine(-66.62101906518004, 10.47444889779559, -33.6551241080247, 9.543386773547091) +SketchLine_15.result().setColor(225, 0, 0) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_15.startPoint(), SketchLine_12.result()) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_14.result()) +SketchLine_16 = Sketch_2.addLine(86.07316931157348, 30.95781563126252, 62.43123950606181, 30.95781563126252) +SketchLine_16.result().setColor(225, 0, 0) +SketchLine_17 = Sketch_2.addLine(62.43123950606181, 30.95781563126252, 62.43123950606181, -14.66422845691383) +SketchLine_17.result().setColor(225, 0, 0) +SketchLine_18 = Sketch_2.addLine(62.43123950606181, -14.66422845691383, 86.07316931157348, -14.66422845691383) +SketchLine_18.result().setColor(225, 0, 0) +SketchLine_19 = Sketch_2.addLine(86.07316931157348, -14.66422845691383, 86.07316931157348, 30.95781563126252) +SketchLine_19.result().setColor(225, 0, 0) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_16.startPoint()) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) +SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_16.result()) +SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_17.result()) +SketchConstraintHorizontal_8 = Sketch_2.setHorizontal(SketchLine_18.result()) +SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_19.result()) +SketchLine_20 = Sketch_2.addLine(62.43123950606181, 3.491482965931855, 86.07316931157347, 4.888076152304602) +SketchLine_20.result().setColor(225, 0, 0) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_20.startPoint(), SketchLine_17.result()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_19.result()) +model.do() +Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_9r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_9f"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_10f"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_7f-SketchLine_8f-SketchLine_10r")] +Shell_1 = model.addShell(Part_1_doc, Shell_1_objects) +Shell_2_objects = [model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchLine_12f-SketchLine_14f-SketchLine_15f"), model.selection("FACE", "Sketch_2/Face-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchLine_15r"), model.selection("FACE", "Sketch_2/Face-SketchLine_16f-SketchLine_17f-SketchLine_19f-SketchLine_20f"), model.selection("FACE", "Sketch_2/Face-SketchLine_17f-SketchLine_18f-SketchLine_19f-SketchLine_20r")] +Shell_2 = model.addShell(Part_1_doc, Shell_2_objects) +Compound_1 = model.addCompound(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_1_2")]) +Compound_2 = model.addCompound(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_2_2")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [2]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [4]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [16]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [32]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Shell_Shell.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Shell_Shell.py new file mode 100644 index 000000000..3d2ce8998 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Shell_Shell.py @@ -0,0 +1,87 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(-8.703406813627256, 48.70884844011781, -89.26052104208418, 48.70884844011781) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-89.26052104208418, 48.70884844011781, -89.26052104208418, 1.699676379809279) +SketchLine_2.result().setColor(225, 0, 0) +SketchLine_3 = Sketch_1.addLine(-89.26052104208418, 1.699676379809279, -8.703406813627256, 1.699676379809279) +SketchLine_3.result().setColor(225, 0, 0) +SketchLine_4 = Sketch_1.addLine(-8.703406813627256, 1.699676379809279, -8.703406813627256, 48.70884844011781) +SketchLine_4.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +SketchLine_5 = Sketch_1.addLine(-50.39879759519037, 48.70884844011781, -49.99398797595192, 1.699676379809278) +SketchLine_5.result().setColor(225, 0, 0) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_6 = Sketch_2.addLine(-27.69909819639279, -33.75100200400802, -61.96570844393754, -33.75100200400802) +SketchLine_6.result().setColor(225, 0, 0) +SketchLine_7 = Sketch_2.addLine(-61.96570844393754, -33.75100200400802, -61.96570844393754, 19.31953907815632) +SketchLine_7.result().setColor(225, 0, 0) +SketchLine_8 = Sketch_2.addLine(-61.96570844393754, 19.31953907815632, -27.69909819639279, 19.31953907815632) +SketchLine_8.result().setColor(225, 0, 0) +SketchLine_9 = Sketch_2.addLine(-27.69909819639279, 19.31953907815632, -27.69909819639279, -33.75100200400802) +SketchLine_9.result().setColor(225, 0, 0) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result()) +SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_7.result()) +SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result()) +SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result()) +SketchLine_10 = Sketch_2.addLine(-61.96570844393754, -12.80210420841683, -27.69909819639279, -13.26763527054108) +SketchLine_10.result().setColor(225, 0, 0) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchLine_7.result()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_9.result()) +model.do() +Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f")]) +Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_10f"), model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7r-SketchLine_9r-SketchLine_10r")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_2_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [2]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [8]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [16]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Face.py b/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Face.py new file mode 100644 index 000000000..f94339f30 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Face.py @@ -0,0 +1,96 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(-8.142167372244474, 30.79863310370742, -42.12686596943888, 30.79863310370742) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-42.12686596943888, 30.79863310370742, -42.12686596943888, -6.018123709919844) +SketchLine_2.result().setColor(225, 0, 0) +SketchLine_3 = Sketch_1.addLine(-42.12686596943888, -6.018123709919844, -8.142167372244474, -6.018123709919844) +SketchLine_3.result().setColor(225, 0, 0) +SketchLine_4 = Sketch_1.addLine(-8.142167372244474, -6.018123709919844, -8.142167372244474, 30.79863310370742) +SketchLine_4.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +SketchLine_5 = Sketch_1.addLine(49.91502606462924, 30.79863310370742, 15.22231291332662, 30.79863310370742) +SketchLine_5.result().setColor(225, 0, 0) +SketchLine_6 = Sketch_1.addLine(15.22231291332662, 30.79863310370742, 15.22231291332662, -5.310109155811627) +SketchLine_6.result().setColor(225, 0, 0) +SketchLine_7 = Sketch_1.addLine(15.22231291332662, -5.310109155811627, 49.91502606462924, -5.310109155811627) +SketchLine_7.result().setColor(225, 0, 0) +SketchLine_8 = Sketch_1.addLine(49.91502606462924, -5.310109155811627, 49.91502606462924, 30.79863310370742) +SketchLine_8.result().setColor(225, 0, 0) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) +SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) +SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) +SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result()) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10) +Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) +SketchLine_9 = Sketch_2.addLine(32.99903071986655, 54.47604223124301, -21.74338409862735, 54.47604223124301) +SketchLine_9.result().setColor(225, 0, 0) +SketchLine_10 = Sketch_2.addLine(-21.74338409862735, 54.47604223124301, -21.74338409862735, -10.16156298864041) +SketchLine_10.result().setColor(225, 0, 0) +SketchLine_11 = Sketch_2.addLine(-21.74338409862735, -10.16156298864041, 32.99903071986655, -10.16156298864041) +SketchLine_11.result().setColor(225, 0, 0) +SketchLine_12 = Sketch_2.addLine(32.99903071986655, -10.16156298864041, 32.99903071986655, 54.47604223124301) +SketchLine_12.result().setColor(225, 0, 0) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_9.result()) +SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_10.result()) +SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_11.result()) +SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_12.result()) +model.do() +Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_12f")]) +Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("COMPOUND", "Compound_1_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [2]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [2]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [8]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [16]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Shell.py b/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Shell.py new file mode 100644 index 000000000..4f571f1cd --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_Shell.py @@ -0,0 +1,102 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(-29.34869739478959, 31.37274549098196, -65.37675350701403, 31.37274549098196) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-65.37675350701403, 31.37274549098196, -65.37675350701403, -6.274549098196388) +SketchLine_2.result().setColor(225, 0, 0) +SketchLine_3 = Sketch_1.addLine(-65.37675350701403, -6.274549098196388, -29.34869739478959, -6.274549098196388) +SketchLine_3.result().setColor(225, 0, 0) +SketchLine_4 = Sketch_1.addLine(-29.34869739478959, -6.274549098196388, -29.34869739478959, 31.37274549098196) +SketchLine_4.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +SketchLine_5 = Sketch_1.addLine(41.08817635270542, 32.5871743486974, 11.5370741482966, 32.5871743486974) +SketchLine_5.result().setColor(225, 0, 0) +SketchLine_6 = Sketch_1.addLine(11.5370741482966, 32.5871743486974, 11.5370741482966, -8.703406813627252) +SketchLine_6.result().setColor(225, 0, 0) +SketchLine_7 = Sketch_1.addLine(11.5370741482966, -8.703406813627252, 41.08817635270542, -8.703406813627252) +SketchLine_7.result().setColor(225, 0, 0) +SketchLine_8 = Sketch_1.addLine(41.08817635270542, -8.703406813627252, 41.08817635270542, 32.5871743486974) +SketchLine_8.result().setColor(225, 0, 0) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) +SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) +SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) +SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_9 = Sketch_2.addLine(-36.83851213815001, 4.871192068212162, -37.23534778672252, 23.01200273357838) +SketchLine_9.result().setColor(225, 0, 0) +SketchLine_10 = Sketch_2.addLine(-37.23534778672252, 23.01200273357838, -8.095368404429529, 22.8820142517576) +SketchLine_10.result().setColor(225, 0, 0) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchLine_11 = Sketch_2.addLine(-8.095368404429529, 22.8820142517576, 20.86605178109317, 22.08563377543123) +SketchLine_11.result().setColor(225, 0, 0) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchLine_12 = Sketch_2.addLine(20.86605178109317, 22.08563377543123, 22.14286343998464, -2.004860047909258) +SketchLine_12.result().setColor(225, 0, 0) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchLine_13 = Sketch_2.addLine(22.14286343998464, -2.004860047909258, -4.857114760245733, -1.198368777231491) +SketchLine_13.result().setColor(225, 0, 0) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchLine_14 = Sketch_2.addLine(-4.857114760245733, -1.198368777231491, -36.83851213815001, 4.871192068212162) +SketchLine_14.result().setColor(225, 0, 0) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_9.startPoint(), SketchLine_14.endPoint()) +SketchLine_15 = Sketch_2.addLine(-4.857114760245733, -1.198368777231491, -8.095368404429529, 22.8820142517576) +SketchLine_15.result().setColor(225, 0, 0) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_15.endPoint()) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10) +Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9r-SketchLine_10r-SketchLine_14r-SketchLine_15f"), model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_15r")]) +Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("COMPOUND", "Compound_1_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [2]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [2]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [8]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [16]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_SolidCompound.py b/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_SolidCompound.py new file mode 100644 index 000000000..ec915c18a --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_SolidCompound_SolidCompound.py @@ -0,0 +1,113 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(-10.72745490981964, 42.70741482965933, -40.27855711422846, 42.70741482965933) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-40.27855711422846, 42.70741482965933, -40.27855711422846, 9.513026052104207) +SketchLine_2.result().setColor(225, 0, 0) +SketchLine_3 = Sketch_1.addLine(-40.27855711422846, 9.513026052104207, -10.72745490981964, 9.513026052104207) +SketchLine_3.result().setColor(225, 0, 0) +SketchLine_4 = Sketch_1.addLine(-10.72745490981964, 9.513026052104207, -10.72745490981964, 42.70741482965933) +SketchLine_4.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +SketchLine_5 = Sketch_1.addLine(51.61322645290581, 42.70741482965933, 15.98997995991983, 42.70741482965933) +SketchLine_5.result().setColor(225, 0, 0) +SketchLine_6 = Sketch_1.addLine(15.98997995991983, 42.70741482965933, 15.98997995991983, 8.298597194388774) +SketchLine_6.result().setColor(225, 0, 0) +SketchLine_7 = Sketch_1.addLine(15.98997995991983, 8.298597194388774, 51.61322645290581, 8.298597194388774) +SketchLine_7.result().setColor(225, 0, 0) +SketchLine_8 = Sketch_1.addLine(51.61322645290581, 8.298597194388774, 51.61322645290581, 42.70741482965933) +SketchLine_8.result().setColor(225, 0, 0) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) +SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result()) +SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) +SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_9 = Sketch_2.addLine(-17.20440881763527, 19.22845691382766, -33.80160320641282, 19.22845691382766) +SketchLine_9.result().setColor(225, 0, 0) +SketchLine_10 = Sketch_2.addLine(-33.80160320641282, 19.22845691382766, -33.80160320641282, -6.679358717434865) +SketchLine_10.result().setColor(225, 0, 0) +SketchLine_11 = Sketch_2.addLine(-33.80160320641282, -6.679358717434865, -17.20440881763527, -6.679358717434865) +SketchLine_11.result().setColor(225, 0, 0) +SketchLine_12 = Sketch_2.addLine(-17.20440881763527, -6.679358717434865, -17.20440881763527, 19.22845691382766) +SketchLine_12.result().setColor(225, 0, 0) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_9.result()) +SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_10.result()) +SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_11.result()) +SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_12.result()) +SketchLine_13 = Sketch_2.addLine(41.4929859719439, 21.25250501002005, 26.51503006012023, 21.25250501002005) +SketchLine_13.result().setColor(225, 0, 0) +SketchLine_14 = Sketch_2.addLine(26.51503006012023, 21.25250501002005, 26.51503006012023, -9.917835671342685) +SketchLine_14.result().setColor(225, 0, 0) +SketchLine_15 = Sketch_2.addLine(26.51503006012023, -9.917835671342685, 41.4929859719439, -9.917835671342685) +SketchLine_15.result().setColor(225, 0, 0) +SketchLine_16 = Sketch_2.addLine(41.4929859719439, -9.917835671342685, 41.4929859719439, 21.25250501002005) +SketchLine_16.result().setColor(225, 0, 0) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) +SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_13.result()) +SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_14.result()) +SketchConstraintHorizontal_8 = Sketch_2.setHorizontal(SketchLine_15.result()) +SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_16.result()) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10) +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 5, 5) +Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")]) +Compound_2 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [2]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [2]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [12]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [48]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [96]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Face.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Face.py new file mode 100644 index 000000000..2ae30c037 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Face.py @@ -0,0 +1,48 @@ +## 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 +## + +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("XOY")) +SketchCircle_1 = Sketch_1.addCircle(-19.01903137581643, 2.528314065029049, 44.55011038017909) +SketchCircle_1.result().setColor(225, 0, 0) +SketchCircle_1.results()[1].setColor(225, 0, 0) +model.do() +Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")]) +Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 10) +Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Sphere_1_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [1]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [1]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [2]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Shell.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Shell.py new file mode 100644 index 000000000..26b19081b --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Shell.py @@ -0,0 +1,65 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(35.42084168336675, 22.87174348697394, -27.32464929859721, 22.87174348697394) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-27.32464929859721, 22.87174348697394, -27.32464929859721, -13.08560194713185) +SketchLine_2.result().setColor(225, 0, 0) +SketchLine_3 = Sketch_1.addLine(-27.32464929859721, -13.08560194713185, 35.42084168336675, -13.08560194713185) +SketchLine_3.result().setColor(225, 0, 0) +SketchLine_4 = Sketch_1.addLine(35.42084168336675, -13.08560194713185, 35.42084168336675, 22.87174348697394) +SketchLine_4.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +SketchLine_5 = Sketch_1.addLine(4.250501002003999, 22.87174348697394, 4.250501002003999, -13.08560194713185) +SketchLine_5.result().setColor(225, 0, 0) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result()) +model.do() +Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f")]) +Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 10) +Common_1 = model.addCommon(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Sphere_1_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [2]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [5]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [10]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Solid.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Solid.py new file mode 100644 index 000000000..cd4fd2ade --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Solid_Solid.py @@ -0,0 +1,43 @@ +## 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 +## + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Box_1 = model.addBox(Part_1_doc, 10, 10, 10) +Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) +Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Cylinder_1_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [5]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [18]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [36]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_VertexCompound_VertexCompound.py b/src/FeaturesPlugin/Test/TestBooleanCommon_VertexCompound_VertexCompound.py new file mode 100644 index 000000000..498ce29bf --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_VertexCompound_VertexCompound.py @@ -0,0 +1,53 @@ +## 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 +## + +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("XOY")) +SketchPoint_1 = Sketch_1.addPoint(-28.13426853707415, 23.27655310621242) +SketchPoint_1.result().setColor(225, 0, 0) +SketchPoint_2 = Sketch_1.addPoint(10.32264529058116, 23.27655310621242) +SketchPoint_2.result().setColor(225, 0, 0) +SketchPoint_3 = Sketch_1.addPoint(47.56513026052106, 23.27655310621242) +SketchPoint_3.result().setColor(225, 0, 0) +model.do() +Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2")]) +Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_3")]) +Compound_1 = model.addCompound(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_1_2")]) +Compound_2 = model.addCompound(Part_1_doc, [model.selection("VERTEX", "Vertex_2_1"), model.selection("VERTEX", "Vertex_2_2")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [1]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Vertex_Vertex.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Vertex_Vertex.py new file mode 100644 index 000000000..3bf2a002b --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Vertex_Vertex.py @@ -0,0 +1,66 @@ +## 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 +## + +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.standardPlane("XOY")) +SketchPoint_1 = Sketch_1.addPoint(15.05904629113425, 12.50050543761873) +SketchPoint_1.result().setColor(225, 0, 0) +SketchPoint_2 = Sketch_1.addPoint(47.25352258215165, 31.63008715695855) +SketchPoint_2.result().setColor(225, 0, 0) +model.do() +Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_1_2")]) +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchPoint_3 = Sketch_2.addPoint(15.05904629113425, 12.50050543761873) +SketchPoint_3.result().setColor(225, 0, 0) +SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), False) +SketchPoint_4 = SketchProjection_1.createdFeature() +SketchPoint_4.result().setColor(170, 0, 225) +SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchPoint_4.result()) +model.do() +Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_2/Vertex-SketchPoint_3-SketchProjection_1-SketchPoint_4")]) +Vertex_3 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1")]) +Common_2 = model.addCommon(Part_1_doc, [model.selection("VERTEX", "Vertex_2_1"), model.selection("VERTEX", "Vertex_3_1")]) +model.testHaveNamingSubshapes(Common_2, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 0) +model.testNbSubResults(Common_1, []) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, []) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, []) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, []) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, []) + +model.testNbResults(Common_2, 1) +model.testNbSubResults(Common_2, [0]) +model.testNbSubShapes(Common_2, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_2, GeomAPI_Shape.FACE, [0]) +model.testNbSubShapes(Common_2, GeomAPI_Shape.EDGE, [0]) +model.testNbSubShapes(Common_2, GeomAPI_Shape.VERTEX, [1]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_WireCompound_WireCompound.py b/src/FeaturesPlugin/Test/TestBooleanCommon_WireCompound_WireCompound.py new file mode 100644 index 000000000..b8c8d5032 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_WireCompound_WireCompound.py @@ -0,0 +1,91 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(-88.6588483815807, 35.68247765805569, -60.62456998069012, -7.998839850308682) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-60.62456998069012, -7.998839850308682, -33.24225154261096, 37.63835754648991) +SketchLine_2.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_3 = Sketch_1.addLine(22.82630525917019, 37.63835754648991, 47.60078384600371, -9.954719738742909) +SketchLine_3.result().setColor(225, 0, 0) +SketchLine_4 = Sketch_1.addLine(47.60078384600371, -9.954719738742909, 74.33114232127146, 36.3344376208671) +SketchLine_4.result().setColor(225, 0, 0) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_5 = Sketch_2.addLine(-75.23467769579756, 14.76574658950986, -60.62456998069012, -7.998839850308684) +SketchLine_5.result().setColor(225, 0, 0) +SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False) +SketchLine_6 = SketchProjection_1.createdFeature() +SketchLine_6.result().setColor(170, 0, 225) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_6).endPoint(), SketchLine_5.endPoint()) +SketchLine_7 = Sketch_2.addLine(-60.62456998069012, -7.998839850308684, -47.51524103341781, 13.8500417284785) +SketchLine_7.result().setColor(225, 0, 0) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint()) +SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False) +SketchLine_8 = SketchProjection_2.createdFeature() +SketchLine_8.result().setColor(170, 0, 225) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.result()) +SketchLine_9 = Sketch_2.addLine(35.74952364371219, 12.81217486039606, 47.60078384600371, -9.954719738742909) +SketchLine_9.result().setColor(225, 0, 0) +SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), False) +SketchLine_10 = SketchProjection_3.createdFeature() +SketchLine_10.result().setColor(170, 0, 225) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_9.startPoint(), SketchLine_10.result()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_9.endPoint()) +SketchLine_11 = Sketch_2.addLine(47.60078384600371, -9.954719738742909, 64.13719888777418, 18.68151118724985) +SketchLine_11.result().setColor(225, 0, 0) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_11.startPoint()) +SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), False) +SketchLine_12 = SketchProjection_4.createdFeature() +SketchLine_12.result().setColor(170, 0, 225) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.result()) +model.do() +Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")]) +Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")]) +Wire_3 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_7")]) +Wire_4 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_11")]) +Compound_1 = model.addCompound(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")]) +Compound_2 = model.addCompound(Part_1_doc, [model.selection("WIRE", "Wire_3_1"), model.selection("WIRE", "Wire_4_1")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [2]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [4]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [8]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Wire_Wire.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Wire_Wire.py new file mode 100644 index 000000000..41da10124 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Wire_Wire.py @@ -0,0 +1,68 @@ +## 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 +## + +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("XOY")) +SketchLine_1 = Sketch_1.addLine(-44.32557091040492, 34.37855773243287, -1.296213364851963, -18.43019925529121) +SketchLine_1.result().setColor(225, 0, 0) +SketchLine_2 = Sketch_1.addLine(-1.296213364851963, -18.43019925529121, 39.1253043294554, 29.81483799275304) +SketchLine_2.result().setColor(225, 0, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_3 = Sketch_2.addLine(-15.313984501828, -1.226571041729713, -1.296213364851965, -18.43019925529121) +SketchLine_3.result().setColor(225, 0, 0) +SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False) +SketchLine_4 = SketchProjection_1.createdFeature() +SketchLine_4.result().setColor(170, 0, 225) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_3.startPoint(), SketchLine_4.result()) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_4).endPoint(), SketchLine_3.endPoint()) +SketchLine_5 = Sketch_2.addLine(-1.296213364851965, -18.43019925529121, 20.70651786493702, 7.831125115747244) +SketchLine_5.result().setColor(225, 0, 0) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_5.startPoint()) +SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False) +SketchLine_6 = SketchProjection_2.createdFeature() +SketchLine_6.result().setColor(170, 0, 225) +SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result()) +model.do() +Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")]) +Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_5")]) +Common_1 = model.addCommon(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")]) +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [2]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [4]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/_Test2394.py b/src/FeaturesPlugin/Test/_Test2394.py new file mode 100644 index 000000000..13639bba7 --- /dev/null +++ b/src/FeaturesPlugin/Test/_Test2394.py @@ -0,0 +1,258 @@ +# -*- coding: utf-8 -*- + +## Copyright (C) 2018-20xx 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 GeomAPI import * +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, "R", "58") +model.addParameter(Part_1_doc, "cote_cube", "R/2") +model.addParameter(Part_1_doc, "theta", "54") +model.addParameter(Part_1_doc, "phi", "36") +model.addParameter(Part_1_doc, "pi", "3.141592653589793") +model.addParameter(Part_1_doc, "x", "R*sin(phi/180*pi)*cos(theta/180*pi)") +model.addParameter(Part_1_doc, "y", "R*sin(phi/180*pi)*sin(theta/180*pi)") +model.addParameter(Part_1_doc, "z", "R*cos(phi/180*pi)") +model.addParameter(Part_1_doc, "haut_ext_tuyau", "5") +model.addParameter(Part_1_doc, "haut_int_tuyau", "14") +Param_Diam = model.addParameter(Part_1_doc, "diam_tuyau", "10") + +Revolution_1 = model.addRevolution(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 90, 0) +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) +SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchPoint_1 = SketchProjection_1.createdFeature() +SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_1 = SketchProjection_2.createdFeature() +SketchArc_1 = Sketch_1.addArc(0, 0, 58, 0, 0, -58, True) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center()) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint()) +SketchLine_2 = Sketch_1.addLine(0, -58, 0, 0) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_2.endPoint()) +SketchLine_3 = Sketch_1.addLine(0, 0, 58, 0) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.endPoint()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), "R") +Revolution_1.setNestedSketch(Sketch_1) + +Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 0, "cote_cube") +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_2")) +SketchLine_4 = Sketch_2.addLine(29, 0, 0, 0) +SketchLine_5 = Sketch_2.addLine(0, 0, 0, 29) +SketchLine_6 = Sketch_2.addLine(0, 29, 29, 29) +SketchLine_7 = Sketch_2.addLine(29, 29, 29, 0) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_4.result()) +SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_5.result()) +SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_6.result()) +SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_7.result()) +SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_6.result(), "cote_cube") +SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_6.result(), SketchLine_7.result()) +SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Revolution_1_1/To_Face_1"), False) +SketchLine_8 = SketchProjection_3.createdFeature() +SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_8.result()) +SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Revolution_1_1/From_Face_1"), False) +SketchLine_9 = SketchProjection_4.createdFeature() +SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchLine_9.result()) +Extrusion_1.setNestedSketch(Sketch_2) + +Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1")]) + +Point_2 = model.addPoint(Part_1_doc, "x", "y", "-z") +Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Fill_1_1_2/Modified_Face_3&Fill_1_1_2/Modified_Face_2&Fill_1_1_2/Modified_Face_1")) +Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("VERTEX", "Point_1"), True) +Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), "haut_ext_tuyau", True) +Plane_5.result().setName("Plane_2 arrivee tuyau") +Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1"), 45) +Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1"), 45) +Plane_8 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_4"), "90+45") + +Fill_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_1_1_1")], [model.selection("FACE", "Plane_5")]) +Fill_3 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_2_1_2")], [model.selection("FACE", "Plane_3")]) +Fill_4 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_3_1_2")], [model.selection("FACE", "Plane_4")]) +Fill_4.result().setColor(102, 51, 51) +Fill_4.result().subResult(0).setColor(153, 153, 76) +Fill_4.result().subResult(1).setColor(0, 204, 204) +Fill_4.result().subResult(2).setColor(51, 51, 102) +Fill_4.result().subResult(3).setColor(102, 204, 102) +Fill_4.result().subResult(4).setColor(204, 204, 0) + +Union_1 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Fill_4_1_4"), model.selection("SOLID", "Fill_4_1_2")]) + +Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("FACE", "Plane_2 arrivee tuyau")) + +Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2 arrivee tuyau")) +SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Point_2"), False) +SketchPoint_2 = SketchProjection_5.createdFeature() +SketchCircle_1 = Sketch_3.addCircle(0, 0, 10) +SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchPoint_2.result(), SketchCircle_1.center()) +SketchConstraintRadius_1 = Sketch_3.setRadius(SketchCircle_1.results()[1], "diam_tuyau") +SketchLine_10 = Sketch_3.addLine(-5, 5, 5, 5) +SketchLine_11 = Sketch_3.addLine(5, 5, 5, -5) +SketchLine_12 = Sketch_3.addLine(5, -5, -5, -5) +SketchLine_13 = Sketch_3.addLine(-5, -5, -5, 5) +SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_10.result()) +SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_11.result()) +SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_12.result()) +SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_13.result()) +SketchConstraintEqual_2 = Sketch_3.setEqual(SketchLine_10.result(), SketchLine_13.result()) +SketchLine_14 = Sketch_3.addLine(5, 5, 7.071067811865479, 7.071067811865475) +SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchCircle_1.results()[1]) +SketchLine_15 = Sketch_3.addLine(-5, -5, -7.071067811865472, -7.071067811865476) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCollinear_1 = Sketch_3.setCollinear(SketchLine_14.result(), SketchLine_15.result()) +SketchLine_16 = Sketch_3.addLine(7.071067811865478, -7.071067811865476, 5, -5) +SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_16.startPoint(), SketchCircle_1.results()[1]) +SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_16.endPoint()) +SketchLine_17 = Sketch_3.addLine(-5, 5, -7.071067811865472, 7.071067811865476) +SketchConstraintCoincidence_24 = Sketch_3.setCoincident(SketchLine_10.startPoint(), SketchLine_17.startPoint()) +SketchConstraintCoincidence_25 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchCircle_1.results()[1]) +SketchConstraintCollinear_2 = Sketch_3.setCollinear(SketchLine_17.result(), SketchLine_16.result()) +SketchConstraintEqual_3 = Sketch_3.setEqual(SketchLine_14.result(), SketchLine_15.result()) +SketchConstraintEqual_4 = Sketch_3.setEqual(SketchLine_17.result(), SketchLine_16.result()) +SketchConstraintLength_3 = Sketch_3.setLength(SketchLine_10.result(), "diam_tuyau") +model.do() + +Extrusion_2_objects = [model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_11f-SketchLine_14r-SketchLine_16r"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_10f-SketchLine_14f-SketchLine_17r"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_13f-SketchLine_15r-SketchLine_17f"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_12f-SketchLine_15f-SketchLine_16f")] +Extrusion_2 = model.addExtrusion(Part_1_doc, Extrusion_2_objects, model.selection(), 10, 0) +Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_10r-SketchLine_11r-SketchLine_12r-SketchLine_13r")], model.selection(), "haut_int_tuyau", 0) + +Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face_3")) +SketchProjection_6 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/To_Face_4"), False) +SketchPoint_3 = SketchProjection_6.createdFeature() +SketchProjection_7 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/To_Face_3"), False) +SketchPoint_4 = SketchProjection_7.createdFeature() +SketchArc_2 = Sketch_4.addArc(0, 0, -7.071067811865476, -7.071067811865472, 7.071067811865476, 7.071067811865472, True) +SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchPoint_3.result(), SketchArc_2.startPoint()) +SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchPoint_4.result(), SketchArc_2.results()[1]) +SketchLine_18 = Sketch_4.addLine(7.071067811865476, 7.071067811865472, -7.071067811865476, -7.071067811865472) +SketchConstraintCoincidence_28 = Sketch_4.setCoincident(SketchArc_2.endPoint(), SketchLine_18.startPoint()) +SketchConstraintCoincidence_29 = Sketch_4.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_18.endPoint()) +SketchProjection_8 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_2_1/Generated_Face_13&Extrusion_2_1/Generated_Face_12&Extrusion_2_1/To_Face_1"), False) +SketchPoint_5 = SketchProjection_8.createdFeature() +SketchConstraintCoincidence_30 = Sketch_4.setCoincident(SketchArc_2.endPoint(), SketchAPI_Point(SketchPoint_5).coordinates()) +model.do() + +Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchArc_2_2f-SketchLine_18r")], model.selection("EDGE", "Sketch_4/Edge-SketchLine_18"), 0, 180) + +Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_2_1")], [model.selection("SOLID", "Extrusion_3_1")]) +Cut_1.result().setName("demi-sphere") + +Plane_9 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_10&Extrusion_2_1/Generated_Face_1&Extrusion_2_1/From_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_10&Extrusion_2_1/Generated_Face_1&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_10&Extrusion_2_1/To_Face_4")) +Plane_10 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_12&Extrusion_2_1/Generated_Face_11&Extrusion_2_1/To_Face_1"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_13&Extrusion_2_1/Generated_Face_12&Extrusion_2_1/To_Face_1"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_13&Extrusion_2_1/Generated_Face_12&Extrusion_2_1/From_Face_1")) +Plane_11 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/To_Face_3"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_3&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/To_Face_3"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/From_Face_3")) +Plane_12 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_1&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/From_Face_4")) + +Recover_1 = model.addRecover(Part_1_doc, Cut_1, [Extrusion_3.result()]) + +Plane_13 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape4"), model.selection("EDGE", "Recover_1_1/Shape4&Recover_1_1/Shape6"), "90+45") +Plane_14 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape1"), model.selection("EDGE", "Recover_1_1/Shape1&Recover_1_1/Shape6"), "90+45") +Plane_15 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape2"), model.selection("EDGE", "Recover_1_1/Shape2&Recover_1_1/Shape6"), "90+45") +Plane_16 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape6"), model.selection("EDGE", "Recover_1_1/Shape3&Recover_1_1/Shape6"), 45) + +Fill_5_objects_2 = [model.selection("FACE", "Plane_6"), model.selection("FACE", "Plane_7"), model.selection("FACE", "Plane_8"), model.selection("FACE", "Plane_9"), model.selection("FACE", "Plane_10"), model.selection("FACE", "Plane_11"), model.selection("FACE", "Plane_12"), model.selection("FACE", "Plane_13")] +Fill_5 = model.addFill(Part_1_doc, [model.selection("SOLID", "demi-sphere")], Fill_5_objects_2) + +Union_2_objects = [model.selection("SOLID", "Fill_5_1_14"), model.selection("SOLID", "Fill_5_1_15"), model.selection("SOLID", "Fill_5_1_16")] +Union_2 = model.addUnion(Part_1_doc, Union_2_objects) +Union_3_objects = [model.selection("SOLID", "Fill_5_1_8/Fill_5_1_8"), model.selection("SOLID", "Fill_5_1_4/Fill_5_1_4"), model.selection("SOLID", "Fill_5_1_9/Fill_5_1_9"), model.selection("SOLID", "Fill_5_1_11/Fill_5_1_11")] +Union_3 = model.addUnion(Part_1_doc, Union_3_objects) +Union_4_objects = [model.selection("SOLID", "Fill_5_1_6/Fill_5_1_6"), model.selection("SOLID", "Fill_5_1_10/Fill_5_1_10"), model.selection("SOLID", "Fill_5_1_13/Fill_5_1_13")] +Union_4 = model.addUnion(Part_1_doc, Union_4_objects) +Union_5_objects = [model.selection("SOLID", "Fill_5_1_2/Fill_5_1_2"), model.selection("SOLID", "Fill_5_1_1/Fill_5_1_1"), model.selection("SOLID", "Fill_5_1_3/Fill_5_1_3")] +Union_5 = model.addUnion(Part_1_doc, Union_5_objects) +Union_6_objects = [model.selection("SOLID", "Fill_5_1_5/Fill_5_1_5"), model.selection("SOLID", "Fill_5_1_7/Fill_5_1_7"), model.selection("SOLID", "Fill_5_1_12/Fill_5_1_12")] +Union_6 = model.addUnion(Part_1_doc, Union_6_objects) +Union_6.result().setColor(0, 0, 204) +Union_6.result().subResult(0).setColor(204, 102, 102) +Union_6.result().subResult(1).setColor(127, 254, 127) +Union_6.result().subResult(2).setColor(102, 51, 102) +Union_6.result().subResult(3).setColor(76, 76, 153) +Union_6.result().subResult(4).setColor(0, 0, 254) + +Partition_1_objects = [model.selection("SOLID", "Recover_1_1"), model.selection("COMPSOLID", "Union_1_1"), model.selection("COMPSOLID", "Extrusion_2_1"), model.selection("COMPSOLID", "demi-sphere")] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects) +Partition_1.result().setColor(102, 0, 0) +Partition_1.result().subResult(0).setColor(255, 255, 0) +Partition_1.result().subResult(1).setColor(0, 254, 0) +Partition_1.result().subResult(2).setColor(0, 255, 255) +Partition_1.result().subResult(3).setColor(255, 85, 0) +Partition_1.result().subResult(4).setColor(153, 0, 0) +Partition_1.result().subResult(5).setColor(254, 0, 254) +Partition_1.result().subResult(6).setColor(127, 127, 254) +Partition_1.result().subResult(7).setColor(102, 204, 102) +Partition_1.result().subResult(8).setColor(127, 254, 127) +Partition_1.result().subResult(9).setColor(153, 153, 76) +Partition_1.result().subResult(10).setColor(204, 102, 102) +Partition_1.result().subResult(11).setColor(127, 254, 254) +Partition_1.result().subResult(12).setColor(255, 255, 0) +Partition_1.result().subResult(13).setColor(102, 51, 102) +Partition_1.result().subResult(14).setColor(102, 204, 204) +Partition_1.result().subResult(15).setColor(254, 127, 254) +Partition_1.result().subResult(16).setColor(153, 153, 0) +Partition_1.result().subResult(17).setColor(153, 153, 0) +Partition_1.result().subResult(18).setColor(204, 0, 204) + +Folder_1 = model.addFolder(Part_1_doc, Revolution_1, Union_1) +Folder_2 = model.addFolder(Part_1_doc, Point_3, Union_6) +model.do() + +# check the result +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [19]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [19]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [199]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.EDGE, [814]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [1628]) +model.testResultsVolumes(Partition_1, [103867.289635450288187712430953979]) + +# change parameter and check validity of the result +Param_Diam.setValue(8) +model.do() + +model.testNbResults(Partition_1, 1) +model.testNbSubResults(Partition_1, [19]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [19]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [191]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.EDGE, [744]) +model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [1488]) +model.testResultsVolumes(Partition_1, [103221.354557478349306620657444]) + +model.end() + +#assert(model.checkPythonDump()) -- 2.30.2