Salome HOME
Copyright update 2022
[modules/shaper.git] / src / FeaturesPlugin / Test / TestRemoveSubShapes.py
index 4d36094ff14aa91eec659cc098d37b46990e1b75..f315836d52b8f4f653f703e025016d5ab0aadd0d 100644 (file)
@@ -1,3 +1,22 @@
+# Copyright (C) 2014-2022  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
+#
+
 #=========================================================================
 # Initialization of the test
 #=========================================================================
@@ -59,7 +78,7 @@ anExtrusionFeature.real("to_offset").setValue(0) #TODO: remove
 anExtrusionFeature.real("from_offset").setValue(0) #TODO: remove
 anExtrusionFeature.execute()
 aSession.finishOperation()
-anExtrusionResult = modelAPI_ResultCompSolid(modelAPI_ResultBody(anExtrusionFeature.firstResult()))
+anExtrusionResult = modelAPI_ResultBody(anExtrusionFeature.firstResult())
 
 #=========================================================================
 # Remove sub-shapes
@@ -67,10 +86,11 @@ anExtrusionResult = modelAPI_ResultCompSolid(modelAPI_ResultBody(anExtrusionFeat
 aSession.startOperation()
 aRemoveSubShapesFeature = aPart.addFeature("Remove_SubShapes")
 aRemoveSubShapesFeature.selection("base_shape").setValue(anExtrusionResult, None)
-aRemoveSubShapesFeature.selectionList("subshapes").removeLast();
+aRemoveSubShapesFeature.string("creation_method").setValue("by_keep_subshapes")
+aRemoveSubShapesFeature.selectionList("subshapes_to_keep").removeLast();
 aSession.finishOperation()
 assert (len(aRemoveSubShapesFeature.results()) > 0)
-anUnionResult = modelAPI_ResultCompSolid(modelAPI_ResultBody(aRemoveSubShapesFeature.firstResult()))
+anUnionResult = modelAPI_ResultBody(aRemoveSubShapesFeature.firstResult())
 assert (anUnionResult.numberOfSubs() == 2)
 
 from salome.shaper import model