SketchPlugin_ConstraintVertical
static const std::string MY_CONSTRAINT_VERTICAL_ID("SketchConstraintVertical");
- data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::type());
+ data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId());
"""
from GeomDataAPI import *
from ModelAPI import *
+from salome.shaper import model
+
#=========================================================================
# Initialization of the test
#=========================================================================
#=========================================================================
aSession.startOperation()
aSketchCommonFeature = aDocument.addFeature("Sketch")
-aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+aSketchFeature = featureToCompositeFeature(aSketchCommonFeature)
origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSession.finishOperation()
aLineStartPoint.setValue(0., 15.)
aLineEndPoint.setValue(20., 25.)
aSession.finishOperation()
+assert (model.dof(aSketchFeature) == 4)
#=========================================================================
# Assign vertical constraint for a line
#=========================================================================
aVerticalConstraint.execute()
aSession.finishOperation()
assert(aLineStartPoint.x() == aLineEndPoint.x())
+assert (model.dof(aSketchFeature) == 3)
#=========================================================================
# Move one of boundary points of a line
#=========================================================================
aLineStartPoint.y() + deltaY)
aSession.finishOperation()
assert(aLineStartPoint.x() == aLineEndPoint.x())
+assert (model.dof(aSketchFeature) == 3)
#=========================================================================
# Move other boundary point of a line
#=========================================================================
aLineEndPoint.y() + deltaY)
aSession.finishOperation()
assert(aLineStartPoint.x() == aLineEndPoint.x())
+assert (model.dof(aSketchFeature) == 3)
#=========================================================================
# End of test
#=========================================================================
+
+assert(model.checkPythonDump())