from GeomDataAPI import *
from ModelAPI import *
import math
+from salome.shaper import model
+
#=========================================================================
# Initialization of the test
#=========================================================================
aLineAStartPoint.setValue(0., 25.)
aLineAEndPoint.setValue(100., 25.)
aSession.finishOperation()
+assert (model.dof(aSketchFeature) == 6)
#=========================================================================
# Make a constraint to keep the distance
#=========================================================================
refattrA.setAttr(aSketchPointCoords)
refattrB.setAttr(aLineAStartPoint)
aSession.finishOperation()
+assert (model.dof(aSketchFeature) == 5)
# set flyout point then abort operation, after that check the Distance is correct
aSession.startOperation()
aFlyoutPoint = geomDataAPI_Point2D(aConstraint.attribute("ConstraintFlyoutValuePnt"))
assert (refattrB.isInitialized())
assert (aDistance.isInitialized())
assert math.fabs(aDistance.value() - aDist) < 1.e-4, "Distance values are different: {0} != {1}".format(aDistance.value(), aDist)
+assert (model.dof(aSketchFeature) == 5)
#=========================================================================
# Change distance value
#=========================================================================
aDistance.setValue(PT_PT_DIST)
aSession.finishOperation()
assert (math.fabs(distancePointPoint(aSketchPointCoords, aLineAStartPoint) - PT_PT_DIST) < 1.e-10)
+assert (model.dof(aSketchFeature) == 5)
#=========================================================================
# Move line, check that distance is constant
#=========================================================================
aLineAEndPoint.setValue(100., 40.)
aSession.finishOperation()
assert (math.fabs(distancePointPoint(aSketchPointCoords, aLineAStartPoint) - PT_PT_DIST) < 1.e-10)
+assert (model.dof(aSketchFeature) == 5)
#=========================================================================
# Remove constraint, check the points are unconstrained now
#=========================================================================
aSketchPointCoords.setValue(0., 0.)
aSession.finishOperation()
assert (math.fabs(distancePointPoint(aSketchPointCoords, aLineAStartPoint) - PT_PT_DIST) > 1.e-10)
+assert (model.dof(aSketchFeature) == 6)
#=========================================================================
# Add distance between point and line
refattrA.setObject(aLineResult)
refattrB.setAttr(aSketchPointCoords)
aSession.finishOperation()
+assert (model.dof(aSketchFeature) == 5)
# set flyout point then abort operation, after that check the Distance is correct
aSession.startOperation()
aFlyoutPoint = geomDataAPI_Point2D(aConstraint.attribute("ConstraintFlyoutValuePnt"))
assert (refattrB.isInitialized())
assert (aDistance.isInitialized())
assert math.fabs(aDistance.value() - aDist) < 1.e-4, "Distance values are different: {0} != {1}".format(aDistance.value(), aDist)
+assert (model.dof(aSketchFeature) == 5)
#=========================================================================
# Change distance value
#=========================================================================
aDistance.setValue(PT_LINE_DIST)
aSession.finishOperation()
assert (math.fabs(distancePointLine(aSketchPointCoords, aSketchLine) - PT_LINE_DIST) < 1.e-10)
+assert (model.dof(aSketchFeature) == 5)
#=========================================================================
# Set distance between line boundaries
#=========================================================================
refattrB.setAttr(aLineAEndPoint)
aSession.finishOperation()
assert (math.fabs(distancePointPoint(aLineAStartPoint, aLineAEndPoint) - PT_LINE_DIST) < 1.e-10)
+assert (model.dof(aSketchFeature) == 5)
#=========================================================================
# End of test
#=========================================================================
-from salome.shaper import model
assert(model.checkPythonDump())