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)
# Circle
aSession.startOperation()
aSketchCircle = aSketchFeature.addFeature("SketchCircle")
anCircleCentr.setValue(-25., -25.)
aCircleRadius.setValue(25.)
aSession.finishOperation()
+assert (model.dof(aSketchFeature) == 8)
#=========================================================================
# A constraint to make equal radii of arc and circle
#=========================================================================
anArcVecY = anArcStartPoint.y() - anArcCentr.y()
anArcRadius = math.sqrt(anArcVecX**2 + anArcVecY**2)
assert (math.fabs(aCircRadius - anArcRadius) <= 1.e-10)
+assert (model.dof(aSketchFeature) == 7)
#=========================================================================
# A constraint to make equal radii of arc and external circle
#=========================================================================
anExtCircleRadius.setValue(10.)
anExtCircle.selection("External").selectSubShape("EDGE", "Sketch_1/Edge-SketchCircle_1_2")
aSession.finishOperation()
+assert (model.dof(aSketchFeature) == 7)
aSession.startOperation()
aConstraintEqRad2 = aSketchFeature.addFeature("SketchConstraintEqual")
aRefObjectA = aConstraintEqRad2.refattr("ConstraintEntityA")
anArcVecY = anArcStartPoint.y() - anArcCentr.y()
anArcRadius = math.sqrt(anArcVecX**2 + anArcVecY**2)
assert (math.fabs(anExtCircleRadius.value() - anArcRadius) <= 1.e-10)
+assert (model.dof(aSketchFeature) == 6)
#=========================================================================
# Creation of two different lines
aLine2StartPoint.setValue(0., 0.)
aLine2EndPoint.setValue(-1., 10.)
aSession.finishOperation()
+assert (model.dof(aSketchFeature) == 14)
#=========================================================================
# A constraint to make equal lengths of lines
#=========================================================================
aLine1Len = lineLength(aSketchLine1)
aLine2Len = lineLength(aSketchLine2)
assert (math.fabs(aLine1Len - aLine2Len) < 1.e-10)
+assert (model.dof(aSketchFeature) == 13)
#=========================================================================
# A constraint to make equal length of line with external line
#=========================================================================
anExtLine.selection("External").selectSubShape("EDGE", "Sketch_1/Edge-SketchLine_1")
anExtLineLen = lineLength(anExtLine)
aSession.finishOperation()
+assert (model.dof(aSketchFeature) == 13)
aSession.startOperation()
aConstraintEqLen2 = aSketchFeature.addFeature("SketchConstraintEqual")
aRefObjectA = aConstraintEqLen2.refattr("ConstraintEntityA")
aLine2Len = lineLength(aSketchLine2)
assert (math.fabs(aLine1Len - anExtLineLen) < 1.e-10)
assert (math.fabs(aLine2Len - anExtLineLen) < 1.e-10)
+assert (model.dof(aSketchFeature) == 12)
#=========================================================================
# End of test
#=========================================================================
-from salome.shaper import model
assert(model.checkPythonDump())