"""
from GeomDataAPI import *
from ModelAPI import *
+from salome.shaper import model
#=========================================================================
# Auxiliary functions
allFeatures = []
# Create arc
aSketchArc = theSketch.addFeature("SketchArc")
- aCenter = geomDataAPI_Point2D(aSketchArc.attribute("ArcCenter"))
- aStartPoint = geomDataAPI_Point2D(aSketchArc.attribute("ArcStartPoint"))
- aEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("ArcEndPoint"))
+ aCenter = geomDataAPI_Point2D(aSketchArc.attribute("center_point"))
+ aStartPoint = geomDataAPI_Point2D(aSketchArc.attribute("start_point"))
+ aEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("end_point"))
aCenter.setValue(5., 5.)
aStartPoint.setValue(10., 5.)
aEndPoint.setValue(5., 10.)
anAttributes.append('StartPoint')
anAttributes.append('EndPoint')
elif (feat.getKind() == "SketchArc"):
- anAttributes.append('ArcCenter')
- anAttributes.append('ArcStartPoint')
- anAttributes.append('ArcEndPoint')
+ anAttributes.append('center_point')
+ anAttributes.append('start_point')
+ anAttributes.append('end_point')
for attr in anAttributes:
aPoint1 = geomDataAPI_Point2D(feat.attribute(attr))
aSession.startOperation()
aFeaturesList = createSketch(aSketchFeature)
aSession.finishOperation()
+assert(model.dof(aSketchFeature) == 5)
#=========================================================================
# Global variables
#=========================================================================
aTransLineStartPoint.setValue(START_X, START_Y)
aTransLineEndPoint.setValue(START_X + DELTA_X, START_Y + DELTA_Y)
aSession.finishOperation()
+assert(model.dof(aSketchFeature) == 9)
#=========================================================================
# Create the Translation constraint
#=========================================================================
aNbCopies.setValue(2)
aMultiTranslation.execute()
aSession.finishOperation()
+assert(model.dof(aSketchFeature) == 9)
#=========================================================================
# Verify the objects are moved for the specified distance
#=========================================================================
aSession.finishOperation()
aTranslated = aMultiTranslation.reflist("ConstraintEntityB")
checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y)
+assert(model.dof(aSketchFeature) == 9)
#=========================================================================
# Create new feature and add it into the Rotation
aTransList.append(aResult)
aSession.finishOperation()
checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y)
+assert(model.dof(aSketchFeature) == 13)
#=========================================================================
# Move line and check the copies are moved too
#=========================================================================
aStartPoint.setValue(12., 5.)
aSession.finishOperation()
checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y)
+assert(model.dof(aSketchFeature) == 13)
#=========================================================================
# Change number of copies and verify Rotation
#=========================================================================
aNbCopies.setValue(2)
aSession.finishOperation()
checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y)
+assert(model.dof(aSketchFeature) == 13)
#=========================================================================
# Remove a feature from the Rotation
aTransList.remove(aRemoveIt)
aSession.finishOperation()
checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y)
+assert(model.dof(aSketchFeature) == 13)
#=========================================================================
# Clear the list of rotated features
aTransList.append(aResult)
aSession.finishOperation()
checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y)
+assert(model.dof(aSketchFeature) == 13)
#=========================================================================
# End of test
#=========================================================================
-import model
assert(model.checkPythonDump())