From: azv Date: Tue, 27 Nov 2018 13:11:45 +0000 (+0300) Subject: Issue #2750: Wrong GUI of Filling property panel X-Git-Tag: End2018~143 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=de5a771bb968ac9f660196a88d1007ea6d9d1ff0;p=modules%2Fshaper.git Issue #2750: Wrong GUI of Filling property panel Update unit tests and high-level API. --- diff --git a/src/BuildAPI/BuildAPI_Filling.cpp b/src/BuildAPI/BuildAPI_Filling.cpp index 8951bd8d4..22f256116 100644 --- a/src/BuildAPI/BuildAPI_Filling.cpp +++ b/src/BuildAPI/BuildAPI_Filling.cpp @@ -33,8 +33,10 @@ BuildAPI_Filling::BuildAPI_Filling(const std::shared_ptr& theF const std::list& theBaseObjects) : ModelHighAPI_Interface(theFeature) { - if(initialize()) + if (initialize()) { + setAdvancedOptions(false); setBase(theBaseObjects); + } } BuildAPI_Filling::BuildAPI_Filling(const std::shared_ptr& theFeature, @@ -48,7 +50,7 @@ BuildAPI_Filling::BuildAPI_Filling(const std::shared_ptr& theF const bool theApproximate) : ModelHighAPI_Interface(theFeature) { - if(initialize()) { + if (initialize()) { setOrientationMethod(theOrientCorrection); setMinDegree(theMinDegree); setMaxDegree(theMaxDegree); @@ -133,9 +135,9 @@ void BuildAPI_Filling::setApproximation(const bool theApproximate) execIfBaseNotEmpty(); } -void BuildAPI_Filling::setAdvancedOptions() +void BuildAPI_Filling::setAdvancedOptions(bool isEnabled) { - feature()->string(BuildPlugin_Filling::ADVANCED_OPTIONS_ID())->setValue("true"); + feature()->string(BuildPlugin_Filling::ADVANCED_OPTIONS_ID())->setValue(isEnabled ? "true" : ""); } void BuildAPI_Filling::dump(ModelHighAPI_Dumper& theDumper) const diff --git a/src/BuildAPI/BuildAPI_Filling.h b/src/BuildAPI/BuildAPI_Filling.h index 8ccab1fee..73d5df74f 100644 --- a/src/BuildAPI/BuildAPI_Filling.h +++ b/src/BuildAPI/BuildAPI_Filling.h @@ -114,7 +114,7 @@ public: private: void execIfBaseNotEmpty(); - void setAdvancedOptions(); + void setAdvancedOptions(bool isEnabled = true); }; /// Pointer on Face object. diff --git a/src/BuildPlugin/CMakeLists.txt b/src/BuildPlugin/CMakeLists.txt index d99d69f68..e13afc3bf 100644 --- a/src/BuildPlugin/CMakeLists.txt +++ b/src/BuildPlugin/CMakeLists.txt @@ -115,6 +115,7 @@ ADD_UNIT_TESTS(TestVertex.py TestCompSolid.py TestCompound.py TestSubShapes.py + TestFilling.py TestFilling_ByEdges.py TestFilling_ByWires.py TestFilling_Mixed.py diff --git a/src/BuildPlugin/Test/TestFilling.py b/src/BuildPlugin/Test/TestFilling.py new file mode 100644 index 000000000..3ea33ff83 --- /dev/null +++ b/src/BuildPlugin/Test/TestFilling.py @@ -0,0 +1,40 @@ +## Copyright (C) 2017-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 salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Point_2 = model.addPoint(Part_1_doc, 10, 0, 0) +Point_3 = model.addPoint(Part_1_doc, 20, 10, 0) +Point_4 = model.addPoint(Part_1_doc, 0, 20, 10) +Point_5 = model.addPoint(Part_1_doc, 30, 0, 10) +Polyline_1 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")], False) +Polyline_2 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_4")], False) +Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Polyline_1_1/Generated_Edge&Point_1/Point_1"), model.selection("EDGE", "Polyline_2_1/Generated_Edge&Point_3/Point_3")]) +Filling_2 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Polyline_1_1/Generated_Edge&Point_1/Point_1"), model.selection("EDGE", "Polyline_2_1/Generated_Edge&Point_3/Point_3")], "curve_info", 5, 8, 0, 0.0001, 0.0001, True) +model.do() + +assert(Filling_1.feature().error() == "") +assert(Filling_2.feature().error() == "") + +model.end() diff --git a/src/BuildPlugin/Test/TestFilling_ByEdges.py b/src/BuildPlugin/Test/TestFilling_ByEdges.py index 08b3aea56..3b056f060 100644 --- a/src/BuildPlugin/Test/TestFilling_ByEdges.py +++ b/src/BuildPlugin/Test/TestFilling_ByEdges.py @@ -82,6 +82,7 @@ aSession.finishOperation() # Create filling aSession.startOperation() aFillingFeature = aPart.addFeature("Filling") +aFillingFeature.string("advanced_options").setValue("") aBaseObjectsList = aFillingFeature.selectionList("base_objects") aBaseObjectsList.append(aSketch1Result, anArc.lastResult().shape()) aSession.finishOperation() diff --git a/src/BuildPlugin/Test/TestFilling_ByWires.py b/src/BuildPlugin/Test/TestFilling_ByWires.py index 1529a3c09..09382bdff 100644 --- a/src/BuildPlugin/Test/TestFilling_ByWires.py +++ b/src/BuildPlugin/Test/TestFilling_ByWires.py @@ -104,6 +104,7 @@ aSession.finishOperation() # Create filling aSession.startOperation() aFillingFeature = aPart.addFeature("Filling") +aFillingFeature.string("advanced_options").setValue("") aBaseObjectsList = aFillingFeature.selectionList("base_objects") aBaseObjectsList.append(aWire1.lastResult(), None) aSession.finishOperation() diff --git a/src/BuildPlugin/Test/TestFilling_Mixed.py b/src/BuildPlugin/Test/TestFilling_Mixed.py index c020982ed..6d5d50976 100644 --- a/src/BuildPlugin/Test/TestFilling_Mixed.py +++ b/src/BuildPlugin/Test/TestFilling_Mixed.py @@ -89,6 +89,7 @@ aSession.finishOperation() # Create filling aSession.startOperation() aFillingFeature = aPart.addFeature("Filling") +aFillingFeature.string("advanced_options").setValue("") aBaseObjectsList = aFillingFeature.selectionList("base_objects") aBaseObjectsList.append(aSketch1Result, anArc.lastResult().shape()) aSession.finishOperation()