+# Copyright (C) 2014-2023 CEA, EDF
+#
+# 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
+#
+
"""
TestCreateCircleChangeType.py
def assertNotInitializedByCenterAndPassed(theMacroCircle):
# check points
- aCenterPoint = geomDataAPI_Point2D(theMacroCircle.attribute("center_point"))
aPassedPoint = geomDataAPI_Point2D(theMacroCircle.attribute("passed_point"))
- assert (not aCenterPoint.isInitialized())
assert (not aPassedPoint.isInitialized())
# check references
aCenterPointRef = theMacroCircle.refattr("center_point_ref")
assert (not aSecondPointRef.isInitialized())
assert (not aThirdPointRef.isInitialized())
-def distancePointPoint(thePoint1, thePoint2):
- return thePoint1.pnt().distance(thePoint2.pnt())
+def verifyLastCircle(theSketch, theX, theY, theR):
+ """
+ subroutine to verify position of last circle in the sketch
+ """
+ aLastCircle = model.lastSubFeature(theSketch, "SketchCircle")
+ model.assertCircle(aLastCircle, [theX, theY], theR)
#=========================================================================
aPassedPoint.setValue(aLineEnd.pnt())
aSession.finishOperation()
-aRadius = distancePointPoint(aLineStart, aLineEnd)
-assert (aSketchFeature.numberOfSubs() == 2)
+aRadius = model.distancePointPoint(aLineStart, aLineEnd)
+NB_FEATURES_EXPECTED = 4 # line, circle and two coincidences
+assert (aSketchFeature.numberOfSubs() == NB_FEATURES_EXPECTED), "Number of features in sketch {}, expected {}".format(aSketchFeature.numberOfSubs(), NB_FEATURES_EXPECTED)
verifyLastCircle(aSketchFeature, aLineStart.x(), aLineStart.y(), aRadius)
#=========================================================================