From: dbv Date: Wed, 26 Sep 2018 10:46:08 +0000 (+0300) Subject: Issue #2562: CEA 2018-1 Fuse X-Git-Tag: CEA_2018-2~66^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=36775b35e778db87675594e5897badcedfb3a135;p=modules%2Fshaper.git Issue #2562: CEA 2018-1 Fuse Added possibility to select all types of shapes in Fuse feature. --- diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index b118cd42e..907c7f260 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -351,4 +351,18 @@ ADD_UNIT_TESTS(TestExtrusion.py TestPartitionSubCompsolidWithPlane3.py TestPartitionSubCompsolidWithPlane4.py TestPartitionSubCompsolidWithPlane5.py + TestBooleanFuse_Vertex_Vertex.py + TestBooleanFuse_VertexCompound_VertexCompound.py + TestBooleanFuse_Edge_Edge.py + TestBooleanFuse_EdgeCompound_EdgeCompound.py + TestBooleanFuse_Wire_Wire.py + TestBooleanFuse_WireCompound_WireCompound.py + TestBooleanFuse_Face_Face.py + TestBooleanFuse_FaceCompound_FaceCompound.py + TestBooleanFuse_Shell_Shell.py + TestBooleanFuse_ShellCompound_ShellCompound.py + TestBooleanFuse_Solid_Solid.py + TestBooleanFuse_SolidCompound_SolidCompound.py + TestBooleanFuse_CompSolid_CompSolid.py + TestBooleanFuse_CompSolidCompound_CompSolidCompound.py ) diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp index 341eb82ba..0f1ac4f72 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp @@ -317,54 +317,63 @@ void FeaturesPlugin_BooleanFuse::execute() } //================================================================================================== -void FeaturesPlugin_BooleanFuse::loadNamingDS(std::shared_ptr theResultBody, - const std::shared_ptr theBaseShape, - const ListOfShape& theTools, - const std::shared_ptr theResultShape, - GeomAlgoAPI_MakeShape& theMakeShape, - GeomAPI_DataMapOfShapeShape& theMapOfShapes) +void FeaturesPlugin_BooleanFuse::loadNamingDS(ResultBodyPtr theResultBody, + const GeomShapePtr theBaseShape, + const ListOfShape& theTools, + const GeomShapePtr theResultShape, + GeomAlgoAPI_MakeShape& theMakeShape, + GeomAPI_DataMapOfShapeShape& theMapOfShapes) { //load result if (theBaseShape->isEqual(theResultShape)) { theResultBody->store(theResultShape, false); } else { - const int aModifyTag = 1; - const int aModifyEdgeTag = 2; - const int aModifyFaceTag = 3; + const int aModifyVTag = 1; + const int aModifyETag = 2; + const int aModifyFTag = 3; const int aDeletedTag = 4; /// sub solids will be placed at labels 5, 6, etc. if result is compound of solids const int aSubsolidsTag = 5; theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag); - const std::string aModName = "Modified"; + const std::string aModVName = "Modified_Vertex"; const std::string aModEName = "Modified_Edge"; const std::string aModFName = "Modified_Face"; + theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::VERTEX, + aModifyVTag, aModVName, theMapOfShapes, false, + false, true); theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::EDGE, - aModifyEdgeTag, aModEName, theMapOfShapes, false, + aModifyETag, aModEName, theMapOfShapes, false, false, true); theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE, - aModifyFaceTag, aModFName, theMapOfShapes, false, + aModifyFTag, aModFName, theMapOfShapes, false, false, true); + + theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape, + GeomAPI_Shape::VERTEX, aDeletedTag); + theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape, + GeomAPI_Shape::EDGE, aDeletedTag); theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE, aDeletedTag); - int aTag; - std::string aName; - for (ListOfShape::const_iterator - anIter = theTools.begin(); anIter != theTools.end(); anIter++) { - if ((*anIter)->shapeType() <= GeomAPI_Shape::FACE) { - aTag = aModifyFaceTag; - aName = aModFName; - } else { - aTag = aModifyEdgeTag; - aName = aModEName; - } - theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, - aName == aModEName ? GeomAPI_Shape::EDGE - : GeomAPI_Shape::FACE, - aTag, aName, theMapOfShapes, false, false, true); + for (ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++) + { + theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX, + aModifyVTag, aModVName, theMapOfShapes, false, + false, true); + + theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE, + aModifyETag, aModEName, theMapOfShapes, false, + false, true); + + theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE, + aModifyFTag, aModFName, theMapOfShapes, false, + false, true); + + theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX, aDeletedTag); + theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE, aDeletedTag); theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE, aDeletedTag); } } diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolidCompound_CompSolidCompound.py b/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolidCompound_CompSolidCompound.py new file mode 100644 index 000000000..ca8aae00d --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolidCompound_CompSolidCompound.py @@ -0,0 +1,93 @@ +## 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(-81.42367066895368, 33.08919382504288, -49.89365351629502, 58.72898799313894) +SketchLine_2 = Sketch_1.addLine(-49.89365351629502, 58.72898799313894, -14.89879931389364, 32.04974271012008) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_3 = Sketch_1.addLine(-14.89879931389364, 32.04974271012008, -45.04288164665522, 2.598627787307022) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_4 = Sketch_1.addLine(-45.04288164665522, 2.598627787307022, -81.42367066895368, 33.08919382504288) +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(-49.89365351629502, 58.72898799313894, -45.04288164665522, 2.598627787307022) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_5.endPoint()) +SketchLine_6 = Sketch_1.addLine(40.88507718696397, 37.93996569468268, 70.33619210977699, 65.31217838765009) +SketchLine_7 = Sketch_1.addLine(70.33619210977699, 65.31217838765009, 91.81818181818181, 33.43567753001717) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchLine_8 = Sketch_1.addLine(91.81818181818181, 33.43567753001717, 59.24871355060034, 6.756432246998279) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchLine_9 = Sketch_1.addLine(59.24871355060034, 6.756432246998279, 40.88507718696397, 37.93996569468268) +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(70.33619210977699, 65.31217838765009, 59.24871355060034, 6.756432246998279) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_10.endPoint()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_11 = Sketch_2.addLine(-24.25385934819896, -5.370497427101204, -36.03430531732418, 28.93138936535163) +SketchLine_12 = Sketch_2.addLine(-36.03430531732418, 28.93138936535163, -6.23670668953688, 16.80445969125213) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchLine_13 = Sketch_2.addLine(-6.23670668953688, 16.80445969125213, -4.850771869639785, -14.37907375643225) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchLine_14 = Sketch_2.addLine(-4.850771869639785, -14.37907375643225, -24.25385934819896, -5.370497427101204) +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(-24.25385934819896, -5.370497427101204, -6.23670668953688, 16.80445969125213) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_15.endPoint()) +SketchLine_16 = Sketch_2.addLine(32.22298456260721, 12.30017152658662, 55.78387650085761, 33.78216123499142) +SketchLine_17 = Sketch_2.addLine(55.78387650085761, 33.78216123499142, 51.27958833619211, 2.252144082332767) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchLine_18 = Sketch_2.addLine(51.27958833619211, 2.252144082332767, 27.71869639794167, -15.41852487135506) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) +SketchLine_19 = Sketch_2.addLine(27.71869639794167, -15.41852487135506, 32.22298456260721, 12.30017152658662) +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(32.22298456260721, 12.30017152658662, 51.27958833619211, 2.252144082332767) +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(), 100, 0) +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 50, -20) +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")]) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")], True) +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Fuse_1, 1) +model.testNbSubResults(Fuse_1, [2]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [2]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [24]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [108]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [216]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_CompSolid.py b/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_CompSolid.py new file mode 100644 index 000000000..a5d5577e0 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_CompSolid.py @@ -0,0 +1,69 @@ +## 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(-87.19866468842729, 38.44668397626113, -52.3191988130564, 59.05727744807122) +SketchLine_2 = Sketch_1.addLine(-52.3191988130564, 59.05727744807122, -10.30529673590503, 36.86125370919882) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_3 = Sketch_1.addLine(-10.30529673590503, 36.86125370919882, -59.45363501483681, 10.70165430267062) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_4 = Sketch_1.addLine(-59.45363501483681, 10.70165430267062, -87.19866468842729, 38.44668397626113) +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(-52.3191988130564, 59.05727744807122, -59.45363501483681, 10.70165430267062) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_5.endPoint()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_6 = Sketch_2.addLine(-44.00943641618498, -5.404667630057807, -42.4652456647399, 37.06057803468208) +SketchLine_7 = Sketch_2.addLine(-42.4652456647399, 37.06057803468208, -11.58143063583817, 13.12562138728323) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchLine_8 = Sketch_2.addLine(-11.58143063583817, 13.12562138728323, -16.2140028901734, -17.75819364161849) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchLine_9 = Sketch_2.addLine(-16.2140028901734, -17.75819364161849, -44.00943641618498, -5.404667630057807) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_6.startPoint(), SketchLine_9.endPoint()) +SketchLine_10 = Sketch_2.addLine(-44.00943641618498, -5.404667630057807, -11.58143063583817, 13.12562138728323) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_6.startPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_10.endPoint()) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1"), model.selection("COMPOUND", "Sketch_2")], model.selection(), 10, 0) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_1_2")], True) +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Fuse_1, 1) +model.testNbSubResults(Fuse_1, [1]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [11]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [54]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [108]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_EdgeCompound_EdgeCompound.py b/src/FeaturesPlugin/Test/TestBooleanFuse_EdgeCompound_EdgeCompound.py new file mode 100644 index 000000000..14a1cb140 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_EdgeCompound_EdgeCompound.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")) +SketchLine_1 = Sketch_1.addLine(-71.60846560846564, -5.878306878306883, -32.06349206349206, 30.99470899470901) +SketchLine_2 = Sketch_1.addLine(17.63492063492066, -11.75661375661376, 49.16402116402119, 24.04761904761905) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_3 = Sketch_2.addLine(-70.53968253968257, 29.92592592592593, -31.52910052910054, -5.343915343915344) +SketchLine_4 = Sketch_2.addLine(14.96296296296294, 26.18518518518519, 50.23280423280426, -8.015873015873021) +model.do() +Edge_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_4")] +Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects) +Compound_1 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2")]) +Compound_2 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Edge_1_3"), model.selection("EDGE", "Edge_1_4")]) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Fuse_1, 1) +model.testNbSubResults(Fuse_1, [8]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [8]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [16]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_Edge_Edge.py b/src/FeaturesPlugin/Test/TestBooleanFuse_Edge_Edge.py new file mode 100644 index 000000000..3a3a78be3 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_Edge_Edge.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")) +SketchLine_1 = Sketch_1.addLine(-37.40740740740741, -11.75661375661376, 41.14814814814816, 42.75132275132275) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_2 = Sketch_2.addLine(-24.04761904761907, 40.07936507936508, 39.54497354497357, -14.96296296296296) +model.do() +Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_2")]) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_1")]) +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Fuse_1, 1) +model.testNbSubResults(Fuse_1, [4]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [4]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [8]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_FaceCompound_FaceCompound.py b/src/FeaturesPlugin/Test/TestBooleanFuse_FaceCompound_FaceCompound.py new file mode 100644 index 000000000..d9cebddfd --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_FaceCompound_FaceCompound.py @@ -0,0 +1,55 @@ +## 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(-35.3684929577465, 31.98214788732393, 24.26807713993482) +SketchCircle_2 = Sketch_1.addCircle(51.92395774647893, 31.22962676056337, 25.62994603225585) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_3 = Sketch_2.addCircle(-36.12101408450705, -7.148950704225357, 25.24032590912034) +SketchCircle_4 = Sketch_2.addCircle(51.92395774647893, -12.41659859154929, 31.3630728131964) +model.do() +Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")]) +Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")]) +Face_3 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")]) +Face_4 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f")]) +Compound_1 = model.addCompound(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")]) +Compound_2 = model.addCompound(Part_1_doc, [model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_4_1")]) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")], True) +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Fuse_1, 1) +model.testNbSubResults(Fuse_1, [2]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [2]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [4]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [8]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_Face_Face.py b/src/FeaturesPlugin/Test/TestBooleanFuse_Face_Face.py new file mode 100644 index 000000000..a7f012ab2 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_Face_Face.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")) +SketchCircle_1 = Sketch_1.addCircle(-12.81989708404803, 27.54545454545454, 25.29331046312177) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_2 = Sketch_2.addCircle(22.86792452830187, 26.50600343053173, 30.90704565816075) +model.do() +Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")]) +Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")]) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")], True) +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Fuse_1, 1) +model.testNbSubResults(Fuse_1, [1]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [1]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [2]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [4]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_ShellCompound_ShellCompound.py b/src/FeaturesPlugin/Test/TestBooleanFuse_ShellCompound_ShellCompound.py new file mode 100644 index 000000000..f275588b9 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_ShellCompound_ShellCompound.py @@ -0,0 +1,93 @@ +## 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(-83.2865672209026, 26.7937406175772, -53.58748123515441, 47.45397434679335) +SketchLine_2 = Sketch_1.addLine(-53.58748123515441, 47.45397434679335, -26.47092446555818, 25.50247600950118) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_3 = Sketch_1.addLine(-26.47092446555818, 25.50247600950118, -53.58748123515441, 5.487874584323028) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_4 = Sketch_1.addLine(-53.58748123515441, 5.487874584323028, -83.2865672209026, 26.7937406175772) +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(-53.58748123515441, 47.45397434679335, -53.58748123515441, 5.487874584323028) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_5.endPoint()) +SketchLine_6 = Sketch_1.addLine(24.53402755344418, 35.83259287410926, 55.52437814726837, 51.32776817102136) +SketchLine_7 = Sketch_1.addLine(55.52437814726837, 51.32776817102136, 87.16036104513063, 32.60443135391922) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchLine_8 = Sketch_1.addLine(87.16036104513063, 32.60443135391922, 53.58748123515437, 16.46362375296911) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchLine_9 = Sketch_1.addLine(53.58748123515437, 16.46362375296911, 24.53402755344418, 35.83259287410926) +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(55.52437814726837, 51.32776817102136, 53.58748123515437, 16.46362375296911) +SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_10.endPoint()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_11 = Sketch_2.addLine(-85.86909643705464, 4.842242280285022, -62.62633349168645, 26.7937406175772) +SketchLine_12 = Sketch_2.addLine(-62.62633349168645, 26.7937406175772, -65.20886270783846, -2.259713064133024) +SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchLine_13 = Sketch_2.addLine(-65.20886270783846, -2.259713064133024, -83.9321995249406, -14.52672684085511) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) +SketchLine_14 = Sketch_2.addLine(-83.9321995249406, -14.52672684085511, -85.86909643705464, 4.842242280285022) +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(-85.86909643705464, 4.842242280285022, -65.20886270783846, -2.259713064133024) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_15.endPoint()) +SketchLine_16 = Sketch_2.addLine(31.63598289786226, 11.9441976247031, 44.54862897862235, 33.25006365795723) +SketchLine_17 = Sketch_2.addLine(44.54862897862235, 33.25006365795723, 52.29621662707837, 8.070403800475056) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) +SketchLine_18 = Sketch_2.addLine(52.29621662707837, 8.070403800475056, 32.28161520190027, -12.58982992874109) +SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) +SketchLine_19 = Sketch_2.addLine(32.28161520190027, -12.58982992874109, 31.63598289786226, 11.9441976247031) +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(31.63598289786226, 11.9441976247031, 52.29621662707837, 8.070403800475056) +SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_20.endPoint()) +model.do() +Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_4r-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_2r-SketchLine_3r-SketchLine_5f"), model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_9r-SketchLine_10r"), model.selection("FACE", "Sketch_1/Face-SketchLine_7r-SketchLine_8r-SketchLine_10f"), model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_12r-SketchLine_15f"), model.selection("FACE", "Sketch_2/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r"), model.selection("FACE", "Sketch_2/Face-SketchLine_16r-SketchLine_17r-SketchLine_20f"), model.selection("FACE", "Sketch_2/Face-SketchLine_18r-SketchLine_19r-SketchLine_20r")] +Shell_1 = model.addShell(Part_1_doc, Shell_1_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_1_3"), model.selection("SHELL", "Shell_1_4")]) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Fuse_1, 1) +model.testNbSubResults(Fuse_1, [4]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [8]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [5]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [2]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_Shell_Shell.py b/src/FeaturesPlugin/Test/TestBooleanFuse_Shell_Shell.py new file mode 100644 index 000000000..495756723 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_Shell_Shell.py @@ -0,0 +1,69 @@ +## 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(-82.64093491686459, 27.4393729216152, -55.52437814726841, 47.45397434679335) +SketchLine_2 = Sketch_1.addLine(-55.52437814726841, 47.45397434679335, -29.69908598574823, 30.02190213776723) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_3 = Sketch_1.addLine(-29.69908598574823, 30.02190213776723, -54.2331135391924, 7.424771496437049) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_4 = Sketch_1.addLine(-54.2331135391924, 7.424771496437049, -82.64093491686459, 27.4393729216152) +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(-55.52437814726841, 47.45397434679335, -54.2331135391924, 7.424771496437049) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_5.endPoint()) +model.do() +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_6 = Sketch_2.addLine(-84.57783182897859, 11.29856532066509, -63.91759809976246, 28.73063752969122) +SketchLine_7 = Sketch_2.addLine(-63.91759809976246, 28.73063752969122, -60.68943657957245, -4.196609976247029) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchLine_8 = Sketch_2.addLine(-60.68943657957245, -4.196609976247029, -84.57783182897859, -14.52672684085511) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchLine_9 = Sketch_2.addLine(-84.57783182897859, -14.52672684085511, -84.57783182897859, 11.29856532066509) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_6.startPoint(), SketchLine_9.endPoint()) +SketchLine_10 = Sketch_2.addLine(-84.57783182897859, 11.29856532066509, -60.68943657957245, -4.196609976247029) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_6.startPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_10.endPoint()) +model.do() +Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_4r-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_2r-SketchLine_3r-SketchLine_5f"), model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7r-SketchLine_10f"), model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_9r-SketchLine_10r")] +Shell_1 = model.addShell(Part_1_doc, Shell_1_objects) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_1_2")], True) +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Fuse_1, 1) +model.testNbSubResults(Fuse_1, [2]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [4]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [18]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [36]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_SolidCompound_SolidCompound.py b/src/FeaturesPlugin/Test/TestBooleanFuse_SolidCompound_SolidCompound.py new file mode 100644 index 000000000..3cd98f2ef --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_SolidCompound_SolidCompound.py @@ -0,0 +1,98 @@ +## 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.93407123287669, 40.82195171232873, -80.80221369863011, 40.82195171232873) +SketchLine_2 = Sketch_1.addLine(-80.80221369863011, 40.82195171232873, -80.80221369863011, -8.837742123287665) +SketchLine_3 = Sketch_1.addLine(-80.80221369863011, -8.837742123287665, -26.93407123287669, -8.837742123287665) +SketchLine_4 = Sketch_1.addLine(-26.93407123287669, -8.837742123287665, -26.93407123287669, 40.82195171232873) +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(91.74418013698632, 40.82195171232873, 36.19265821917805, 40.82195171232873) +SketchLine_6 = Sketch_1.addLine(36.19265821917805, 40.82195171232873, 36.19265821917805, -15.57125993150685) +SketchLine_7 = Sketch_1.addLine(36.19265821917805, -15.57125993150685, 91.74418013698632, -15.57125993150685) +SketchLine_8 = Sketch_1.addLine(91.74418013698632, -15.57125993150685, 91.74418013698632, 40.82195171232873) +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(), 100, 0) +Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) +SketchLine_9 = Sketch_2.addLine(-14.30872534246576, 22.30477773972602, -41.24279657534246, 22.30477773972602) +SketchLine_10 = Sketch_2.addLine(-41.24279657534246, 22.30477773972602, -41.24279657534246, 1.262534589041107) +SketchLine_11 = Sketch_2.addLine(-41.24279657534246, 1.262534589041107, -14.30872534246576, 1.262534589041107) +SketchLine_12 = Sketch_2.addLine(-14.30872534246576, 1.262534589041107, -14.30872534246576, 22.30477773972602) +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(123.7283897260274, 22.30477773972602, 74.91038561643839, 22.30477773972602) +SketchLine_14 = Sketch_2.addLine(74.91038561643839, 22.30477773972602, 74.91038561643839, -0.4208448630136968) +SketchLine_15 = Sketch_2.addLine(74.91038561643839, -0.4208448630136968, 123.7283897260274, -0.4208448630136968) +SketchLine_16 = Sketch_2.addLine(123.7283897260274, -0.4208448630136968, 123.7283897260274, 22.30477773972602) +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_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 40, -20) +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")]) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Fuse_1, 1) +model.testNbSubResults(Fuse_1, [2]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [2]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [22]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [96]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [192]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_Solid_Solid.py b/src/FeaturesPlugin/Test/TestBooleanFuse_Solid_Solid.py new file mode 100644 index 000000000..809ff19f6 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_Solid_Solid.py @@ -0,0 +1,71 @@ +## 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(-22.17495711835335, 33.08919382504288, -50.93310463121783, 33.08919382504288) +SketchLine_2 = Sketch_1.addLine(-50.93310463121783, 33.08919382504288, -50.93310463121783, 7.102915951972556) +SketchLine_3 = Sketch_1.addLine(-50.93310463121783, 7.102915951972556, -22.17495711835335, 7.102915951972556) +SketchLine_4 = Sketch_1.addLine(-22.17495711835335, 7.102915951972556, -22.17495711835335, 33.08919382504288) +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() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 50, 0) +Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) +SketchLine_5 = Sketch_2.addLine(-38.01624011480907, 11.11021000825241, -18.03083750064881, 11.11021000825241) +SketchLine_6 = Sketch_2.addLine(-18.03083750064881, 11.11021000825241, -18.03083750064881, 22.05701811772883) +SketchLine_7 = Sketch_2.addLine(-18.03083750064881, 22.05701811772883, -38.01624011480907, 22.05701811772883) +SketchLine_8 = Sketch_2.addLine(-38.01624011480907, 22.05701811772883, -38.01624011480907, 11.11021000825241) +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() +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 30, -20) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")]) +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Fuse_1, 1) +model.testNbSubResults(Fuse_1, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [11]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [48]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [96]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_VertexCompound_VertexCompound.py b/src/FeaturesPlugin/Test/TestBooleanFuse_VertexCompound_VertexCompound.py new file mode 100644 index 000000000..3a497f317 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_VertexCompound_VertexCompound.py @@ -0,0 +1,51 @@ +## 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(-22.97883597883597, 19.23809523809524) +SketchPoint_2 = Sketch_1.addPoint(18.16931216931219, 17.1005291005291) +SketchPoint_3 = Sketch_1.addPoint(-19.77248677248678, -16.03174603174603) +SketchPoint_4 = Sketch_1.addPoint(21.37566137566138, -16.03174603174603) +model.do() +Vertex_1_objects = [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_3"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_4"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2")] +Vertex_1 = model.addVertex(Part_1_doc, Vertex_1_objects) +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_1_3"), model.selection("VERTEX", "Vertex_1_4")]) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Fuse_1, 1) +model.testNbSubResults(Fuse_1, [4]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [4]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_Vertex_Vertex.py b/src/FeaturesPlugin/Test/TestBooleanFuse_Vertex_Vertex.py new file mode 100644 index 000000000..70ce3aad8 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_Vertex_Vertex.py @@ -0,0 +1,46 @@ +## 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(-6.078627161807992, -0.4501231771005025) +SketchPoint_2 = Sketch_1.addPoint(7.482208269631659, 3.929326826374309) +model.do() +Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1")]) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_1_2")]) +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Fuse_1, 1) +model.testNbSubResults(Fuse_1, [2]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [2]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_WireCompound_WireCompound.py b/src/FeaturesPlugin/Test/TestBooleanFuse_WireCompound_WireCompound.py new file mode 100644 index 000000000..b7473f690 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_WireCompound_WireCompound.py @@ -0,0 +1,64 @@ +## 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(-74.539241607565, 22.811578250591, -50.12121418439715, 49.79992434988179) +SketchLine_2 = Sketch_1.addLine(-50.12121418439715, 49.79992434988179, -29.55866477541372, 23.45415791962174) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_3 = Sketch_1.addLine(15.42191205673757, 24.09673758865247, 34.69930212765959, 49.15734468085105) +SketchLine_4 = Sketch_1.addLine(34.69930212765959, 49.15734468085105, 59.75990921985817, 26.02447659574467) +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(-79.03729929078014, 52.37024302600472, -50.76379385342788, 26.6670562647754) +SketchLine_6 = Sketch_2.addLine(-50.76379385342788, 26.6670562647754, -25.70318676122931, 53.65540236406619) +SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchLine_7 = Sketch_2.addLine(13.49417304964538, 51.08508368794326, 35.98446146572105, 27.95221560283687) +SketchLine_8 = Sketch_2.addLine(35.98446146572105, 27.95221560283687, 53.3341125295508, 47.87218534278959) +SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +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_6")]) +Wire_4 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_8")]) +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")]) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")]) +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Fuse_1, 1) +model.testNbSubResults(Fuse_1, [4]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [16]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [32]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_Wire_Wire.py b/src/FeaturesPlugin/Test/TestBooleanFuse_Wire_Wire.py new file mode 100644 index 000000000..0cb778f8e --- /dev/null +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_Wire_Wire.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")) +SketchLine_1 = Sketch_1.addLine(-31.34514549929152, 46.39906406145125, -4.124361249906777, 13.81661018718769) +SketchLine_2 = Sketch_1.addLine(-4.124361249906777, 13.81661018718769, 21.85911462450594, 45.98662793646056) +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(-23.92129524945932, 7.630068312327553, -4.124361249906777, 34.02598031173091) +SketchLine_4 = Sketch_2.addLine(-4.124361249906777, 34.02598031173091, 14.43526437467373, 6.392759937355498) +SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +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_4")]) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")]) +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Fuse_1, 1) +model.testNbSubResults(Fuse_1, [2]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [8]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [16]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/boolean_fuse_widget.xml b/src/FeaturesPlugin/boolean_fuse_widget.xml index 149c79b84..952ff6eb0 100644 --- a/src/FeaturesPlugin/boolean_fuse_widget.xml +++ b/src/FeaturesPlugin/boolean_fuse_widget.xml @@ -28,7 +28,7 @@ email : webmaster.salome@opencascade.com @@ -41,7 +41,7 @@ email : webmaster.salome@opencascade.com @@ -51,7 +51,7 @@ email : webmaster.salome@opencascade.com