+# 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
#=========================================================================
norm.setValue(0, 0, 1)
aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
-aCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("CircleCenter"))
-aCircleRadius = aSketchCircle.real("CircleRadius")
+aCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center"))
+aCircleRadius = aSketchCircle.real("circle_radius")
aCircleCentr.setValue(0, 0)
aCircleRadius.setValue(50)
# Make extrusion on circle
#=========================================================================
# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
# Create extrusion
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
# Create from plane
aSession.startOperation()
aFromPlaneFeature = aPart.addFeature("Plane")
-aFromPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aFromPlaneFeature.string("creation_method").setValue("by_general_equation")
+aFromPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove
aFromPlaneFeature.real("A").setValue(0.)
aFromPlaneFeature.real("B").setValue(0.)
aFromPlaneFeature.real("C").setValue(1.)
# Create to plane
aSession.startOperation()
aToPlaneFeature = aPart.addFeature("Plane")
-aToPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aToPlaneFeature.string("creation_method").setValue("by_general_equation")
+aToPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove
aToPlaneFeature.real("A").setValue(0.)
aToPlaneFeature.real("B").setValue(0.)
aToPlaneFeature.real("C").setValue(1.)
dirx.setValue(1, 0, 0)
norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
-aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/TopFace_1")
+aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face_1")
+aSession.startOperation()
aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
-anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("CircleCenter"))
-aCircleRadius = aSketchCircle.real("CircleRadius")
+anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center"))
+aCircleRadius = aSketchCircle.real("circle_radius")
anCircleCentr.setValue(0, 0)
aCircleRadius.setValue(10)
aSession.finishOperation()
+aSession.finishOperation()
aSession.startOperation()
+aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled.
+anExtrusionCutFt.selectionList("base").append(aCircleSketchFeature.firstResult(), None)
anExtrusionCutFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
anExtrusionCutFt.real("to_size").setValue(0)
anExtrusionCutFt.real("from_size").setValue(0)
aFromShape = modelAPI_ResultConstruction(aFromResult).shape()
anExtrusionCutFt.selection("from_object").setValue(aFromResult, aFromShape)
anExtrusionCutFt.real("from_offset").setValue(0)
-anExtrusionCutFt.selectionList("boolean_objects").append(modelAPI_ResultCompSolid(anExtrusionResult).subResult(1), None)
-anExtrusionCutFt.execute()
+anExtrusionCutFt.selectionList("main_objects").append(anExtrusionResult.subResult(1), None)
aSession.finishOperation()
aSession.finishOperation()
dirx.setValue(1, 0, 0)
norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
-aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/TopFace_1")
+aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face_1")
+aSession.startOperation()
aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
-anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("CircleCenter"))
-aCircleRadius = aSketchCircle.real("CircleRadius")
+anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center"))
+aCircleRadius = aSketchCircle.real("circle_radius")
anCircleCentr.setValue(0, 0)
aCircleRadius.setValue(10)
aSession.finishOperation()
+aSession.finishOperation()
aSession.startOperation()
+aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled.
+anRevolutionFuseFt.selectionList("base").append(aCircleSketchFeature.firstResult(), None)
anRevolutionFuseFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge)
anRevolutionFuseFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
anRevolutionFuseFt.real("from_angle").setValue(0) #TODO: remove
anRevolutionFuseFt.real("to_offset").setValue(0)
anRevolutionFuseFt.selection("from_object").setValue(None, None)
anRevolutionFuseFt.real("from_offset").setValue(0)
-anRevolutionFuseFt.selectionList("boolean_objects").append(modelAPI_ResultCompSolid(anExtrusionResult).subResult(1), None)
-anRevolutionFuseFt.execute()
+anRevolutionFuseFt.selectionList("main_objects").append(anExtrusionResult.subResult(1), None)
aSession.finishOperation()
aSession.finishOperation()
aCurrentResult = modelAPI_ResultBody(anRevolutionFuseFt.firstResult())
assert (aCurrentResult is not None)
+from salome.shaper import model
+assert(model.checkPythonDump())