]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2750: Wrong GUI of Filling property panel
authorazv <azv@opencascade.com>
Tue, 27 Nov 2018 13:11:45 +0000 (16:11 +0300)
committerazv <azv@opencascade.com>
Tue, 27 Nov 2018 13:11:57 +0000 (16:11 +0300)
Update unit tests and high-level API.

src/BuildAPI/BuildAPI_Filling.cpp
src/BuildAPI/BuildAPI_Filling.h
src/BuildPlugin/CMakeLists.txt
src/BuildPlugin/Test/TestFilling.py [new file with mode: 0644]
src/BuildPlugin/Test/TestFilling_ByEdges.py
src/BuildPlugin/Test/TestFilling_ByWires.py
src/BuildPlugin/Test/TestFilling_Mixed.py

index 8951bd8d43ef2f03dbcebccf152d9443a73f864e..22f25611669b39d871e6dc3c56e0b2b4f841c713 100644 (file)
@@ -33,8 +33,10 @@ BuildAPI_Filling::BuildAPI_Filling(const std::shared_ptr<ModelAPI_Feature>& theF
                                    const std::list<ModelHighAPI_Selection>& theBaseObjects)
   : ModelHighAPI_Interface(theFeature)
 {
-  if(initialize())
+  if (initialize()) {
+    setAdvancedOptions(false);
     setBase(theBaseObjects);
+  }
 }
 
 BuildAPI_Filling::BuildAPI_Filling(const std::shared_ptr<ModelAPI_Feature>& theFeature,
@@ -48,7 +50,7 @@ BuildAPI_Filling::BuildAPI_Filling(const std::shared_ptr<ModelAPI_Feature>& 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
index 8ccab1feedc18603db06367f702d1e4c830293d2..73d5df74f10d2d20d03ac4e31bd6306eb6bb41c4 100644 (file)
@@ -114,7 +114,7 @@ public:
 
 private:
   void execIfBaseNotEmpty();
-  void setAdvancedOptions();
+  void setAdvancedOptions(bool isEnabled = true);
 };
 
 /// Pointer on Face object.
index d99d69f68f1a0d26372648c8174d0a180d8beaee..e13afc3bf5aeba239130e09facef4172ff071883 100644 (file)
@@ -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 (file)
index 0000000..3ea33ff
--- /dev/null
@@ -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<mailto: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()
index 08b3aea568de66ef5e91feb80c73f9a9f867a272..3b056f060752cf953d7ab8be6bcacd0f29eaf97b 100644 (file)
@@ -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()
index 1529a3c09f6fb07813b6fd00b0cf5048c0535c9f..09382bdff47c65d565607ccce352e983da4c9fcc 100644 (file)
@@ -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()
index c020982eddcd79f83774a80fc6cb19133c9a0429..6d5d50976b52729857acad750fe9b45a9a5ea9a1 100644 (file)
@@ -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()