Salome HOME
projects
/
modules
/
shaper.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Issue #2027 Sketcher Trim Feature: coincidence unit test case
[modules/shaper.git]
/
src
/
SketchPlugin
/
Test
/
TestMultiTranslation.py
diff --git
a/src/SketchPlugin/Test/TestMultiTranslation.py
b/src/SketchPlugin/Test/TestMultiTranslation.py
index 0d3971e27e640289d955646ce9a345c258086c79..639fd4e30a2a69cce9da2856b84ff45146156a57 100644
(file)
--- a/
src/SketchPlugin/Test/TestMultiTranslation.py
+++ b/
src/SketchPlugin/Test/TestMultiTranslation.py
@@
-15,6
+15,7
@@
"""
from GeomDataAPI import *
from ModelAPI import *
"""
from GeomDataAPI import *
from ModelAPI import *
+from salome.shaper import model
#=========================================================================
# Auxiliary functions
#=========================================================================
# Auxiliary functions
@@
-24,9
+25,9
@@
def createSketch(theSketch):
allFeatures = []
# Create arc
aSketchArc = theSketch.addFeature("SketchArc")
allFeatures = []
# Create arc
aSketchArc = theSketch.addFeature("SketchArc")
- aCenter = geomDataAPI_Point2D(aSketchArc.attribute("
ArcCenter
"))
- aStartPoint = geomDataAPI_Point2D(aSketchArc.attribute("
ArcStartP
oint"))
- aEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("
ArcEndP
oint"))
+ aCenter = geomDataAPI_Point2D(aSketchArc.attribute("
center_point
"))
+ aStartPoint = geomDataAPI_Point2D(aSketchArc.attribute("
start_p
oint"))
+ aEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("
end_p
oint"))
aCenter.setValue(5., 5.)
aStartPoint.setValue(10., 5.)
aEndPoint.setValue(5., 10.)
aCenter.setValue(5., 5.)
aStartPoint.setValue(10., 5.)
aEndPoint.setValue(5., 10.)
@@
-65,9
+66,9
@@
def checkTranslation(theObjects, theNbObjects, theDeltaX, theDeltaY):
anAttributes.append('StartPoint')
anAttributes.append('EndPoint')
elif (feat.getKind() == "SketchArc"):
anAttributes.append('StartPoint')
anAttributes.append('EndPoint')
elif (feat.getKind() == "SketchArc"):
- anAttributes.append('
ArcCenter
')
- anAttributes.append('
ArcStartP
oint')
- anAttributes.append('
ArcEndP
oint')
+ anAttributes.append('
center_point
')
+ anAttributes.append('
start_p
oint')
+ anAttributes.append('
end_p
oint')
for attr in anAttributes:
aPoint1 = geomDataAPI_Point2D(feat.attribute(attr))
for attr in anAttributes:
aPoint1 = geomDataAPI_Point2D(feat.attribute(attr))
@@
-106,6
+107,7
@@
aSession.finishOperation()
aSession.startOperation()
aFeaturesList = createSketch(aSketchFeature)
aSession.finishOperation()
aSession.startOperation()
aFeaturesList = createSketch(aSketchFeature)
aSession.finishOperation()
+assert(model.dof(aSketchFeature) == 5)
#=========================================================================
# Global variables
#=========================================================================
#=========================================================================
# Global variables
#=========================================================================
@@
-125,6
+127,7
@@
aTransLineEndPoint = geomDataAPI_Point2D(aTransLine.attribute("EndPoint"))
aTransLineStartPoint.setValue(START_X, START_Y)
aTransLineEndPoint.setValue(START_X + DELTA_X, START_Y + DELTA_Y)
aSession.finishOperation()
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
#=========================================================================
#=========================================================================
# Create the Translation constraint
#=========================================================================
@@
-146,6
+149,7
@@
aNbCopies = aMultiTranslation.integer("MultiTranslationObjects")
aNbCopies.setValue(2)
aMultiTranslation.execute()
aSession.finishOperation()
aNbCopies.setValue(2)
aMultiTranslation.execute()
aSession.finishOperation()
+assert(model.dof(aSketchFeature) == 9)
#=========================================================================
# Verify the objects are moved for the specified distance
#=========================================================================
#=========================================================================
# Verify the objects are moved for the specified distance
#=========================================================================
@@
-159,6
+163,7
@@
aNbCopies.setValue(3)
aSession.finishOperation()
aTranslated = aMultiTranslation.reflist("ConstraintEntityB")
checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y)
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
#=========================================================================
# Create new feature and add it into the Rotation
@@
-172,6
+177,7
@@
assert(aResult is not None)
aTransList.append(aResult)
aSession.finishOperation()
checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y)
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
#=========================================================================
#=========================================================================
# Move line and check the copies are moved too
#=========================================================================
@@
-180,6
+186,7
@@
aStartPoint = geomDataAPI_Point2D(aLine.attribute("StartPoint"))
aStartPoint.setValue(12., 5.)
aSession.finishOperation()
checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y)
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
#=========================================================================
#=========================================================================
# Change number of copies and verify Rotation
#=========================================================================
@@
-187,6
+194,7
@@
aSession.startOperation()
aNbCopies.setValue(2)
aSession.finishOperation()
checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y)
aNbCopies.setValue(2)
aSession.finishOperation()
checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y)
+assert(model.dof(aSketchFeature) == 13)
#=========================================================================
# Remove a feature from the Rotation
#=========================================================================
# Remove a feature from the Rotation
@@
-196,6
+204,7
@@
aRemoveIt = aTransList.object(0)
aTransList.remove(aRemoveIt)
aSession.finishOperation()
checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y)
aTransList.remove(aRemoveIt)
aSession.finishOperation()
checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y)
+assert(model.dof(aSketchFeature) == 13)
#=========================================================================
# Clear the list of rotated features
#=========================================================================
# Clear the list of rotated features
@@
-207,9
+216,9
@@
checkTranslation(aTranslated, 1, DELTA_X, DELTA_Y)
aTransList.append(aResult)
aSession.finishOperation()
checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y)
aTransList.append(aResult)
aSession.finishOperation()
checkTranslation(aTranslated, aNbCopies.value(), DELTA_X, DELTA_Y)
+assert(model.dof(aSketchFeature) == 13)
#=========================================================================
# End of test
#=========================================================================
#=========================================================================
# End of test
#=========================================================================
-import model
assert(model.checkPythonDump())
assert(model.checkPythonDump())