# Link arc's end and line's start points with concidence constraint
#=========================================================================
aDocument.startOperation()
-aCoincidenceConstraint = aDocument.addFeature("SketchConstraintCoincidence")
-aConstraintData = aCoincidenceConstraint.data()
+aConstraint = aDocument.addFeature("SketchConstraintCoincidence")
+aSketchReflist.append(aConstraint)
+aConstraintData = aConstraint.data()
reflistA = aConstraintData.refattr("ConstraintEntityA")
reflistB = aConstraintData.refattr("ConstraintEntityB")
reflistA.setAttr(anArcEndPoint)
aLineEndPoint.y() + deltaY)
aDocument.finishOperation()
# check that arc's points are moved also
-print ("assert anArcEndPoint.x() == %d" % anArcEndPoint.x())
-print ("assert anArcEndPoint.y() == %d" % anArcEndPoint.y())
-print ("assert aLineStartPoint.x() == %d" % aLineStartPoint.x())
-print ("assert aLineStartPoint.y() == %d" % aLineStartPoint.y())
+assert (anArcEndPoint.x() == aLineStartPoint.x())
+assert (anArcEndPoint.y() == aLineStartPoint.y())
#=========================================================================
# TODO: improve test
# 1. remove constraint, move line to check that constraint are not applied
# Make a constraint to keep the length
#=========================================================================
aDocument.startOperation()
-aCoincidenceConstraint = aDocument.addFeature("SketchConstraintLength")
-aConstraintData = aCoincidenceConstraint.data()
+aConstraint = aDocument.addFeature("SketchConstraintLength")
+aSketchReflist.append(aConstraint)
+aConstraintData = aConstraint.data()
aLength = aConstraintData.real("ConstraintValue")
refattrA = aConstraintData.refattr("ConstraintEntityA")
assert (not aLength.isInitialized())
aLineAStartPoint.setValue(aLineAStartPoint.x() + deltaX,
aLineAStartPoint.y())
aDocument.finishOperation()
-assert (aLineAStartPoint.x() == 40)
assert (aLineAStartPoint.y() == 25)
-assert (aLineAEndPoint.x() == 140)
assert (aLineAEndPoint.y() == 25)
+# length of the line is the same
+assert (aLineAEndPoint.x() - aLineAStartPoint.x() == 100)
#=========================================================================
# TODO: improve test
# 1. remove constraint, move line's start point to