from GeomDataAPI import *
from ModelAPI import *
import math
+from salome.shaper import model
+
#=========================================================================
# Initialization of the test
#=========================================================================
anArcEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("ArcEndPoint"))
anArcEndPoint.setValue(50., 0.)
aSession.finishOperation()
+assert (model.dof(aSketchFeature) == 5)
# Test changing the arc start/end point
aSession.startOperation()
anArcStartPoint.setValue(anArcStartPoint.x(), 40.)
anArcEndPoint.setValue(50., 0.)
assert (math.hypot(anArcEndPoint.x() - 50., anArcEndPoint.y() - 0.) < 1.e-10)
aSession.finishOperation()
+assert (model.dof(aSketchFeature) == 5)
# Circle
aSession.startOperation()
aSketchCircle = aSketchFeature.addFeature("SketchCircle")
anCircleCentr.setValue(-25., -25)
aCircleRadius.setValue(25.)
aSession.finishOperation()
+assert (model.dof(aSketchFeature) == 8)
# Change the radius of the arc
aSession.startOperation()
RADIUS = 40
anArcRadius = aSketchArc.real("ArcRadius")
anArcRadius.setValue(RADIUS)
aSession.finishOperation()
+assert (model.dof(aSketchFeature) == 8)
#=========================================================================
# Make a constraint to keep the radius of the arc
#=========================================================================
aSession.finishOperation()
assert (aRadius.isInitialized())
assert (aRefObject.isInitialized())
+assert (model.dof(aSketchFeature) == 7)
#=========================================================================
# Make a constraint to keep the radius of the circle
#=========================================================================
aSession.finishOperation()
assert (aRadius.isInitialized())
assert (aRefObject.isInitialized())
+assert (model.dof(aSketchFeature) == 6)
#=========================================================================
# Perform some actions and checks:
# 1. Check that constraints does not changes values
assert (anArcEndPoint.y() != anArcPrevEndPointY)
assert (math.fabs(distancePointPoint(anArcCentr, anArcStartPoint) - RADIUS) < 1.e-10)
assert (math.fabs(distancePointPoint(anArcCentr, anArcEndPoint) - RADIUS) < 1.e-10)
+assert (model.dof(aSketchFeature) == 6)
#=========================================================================
# 4. Move the centr or the point of the arc
# 5. Check radius is the same
assert (anCircleCentr.x() == 100)
assert (anCircleCentr.y() == 100)
assert (aCircleRadius.value() == 25)
+assert (model.dof(aSketchFeature) == 6)
#=========================================================================
# End of test
#=========================================================================
-from salome.shaper import model
assert(model.checkPythonDump())