From: sbh Date: Tue, 28 Oct 2014 16:44:11 +0000 (+0300) Subject: The data() methods removed from tests X-Git-Tag: V_0.5~66^2~5^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9b747bafb63c89aa4e2d7436da22c42e3a74f800;p=modules%2Fshaper.git The data() methods removed from tests --- diff --git a/src/ConstructionPlugin/Test/TestPointName.py b/src/ConstructionPlugin/Test/TestPointName.py index 740bd52df..df76871f2 100644 --- a/src/ConstructionPlugin/Test/TestPointName.py +++ b/src/ConstructionPlugin/Test/TestPointName.py @@ -6,10 +6,11 @@ aDoc = aSession.moduleDocument() aSession.startOperation() aFeature = aDoc.addFeature("Point") aFeatureData = aFeature.data() +assert(aFeatureData is not None) aFeatureData.real("x").setValue(0.) aFeatureData.real("y").setValue(0.) aFeatureData.real("z").setValue(0.) -aFeatureName = aFeatureData.name() +aFeatureName = aFeature.name() aFeature.execute() aSession.finishOperation() diff --git a/src/ModelAPI/Test/TestUndoRedo.py b/src/ModelAPI/Test/TestUndoRedo.py index 1d0a37209..26f54acb5 100644 --- a/src/ModelAPI/Test/TestUndoRedo.py +++ b/src/ModelAPI/Test/TestUndoRedo.py @@ -6,13 +6,12 @@ assert(not aSession.canRedo()) aSession.startOperation() aFeature = aDoc.addFeature("Point") -aFeatureData = aFeature.data() # Since validators are introduced we have to initialize all # the feature's attributes -aFeatureData.real("x").setValue(1.) -aFeatureData.real("y").setValue(-1.) -aFeatureData.real("z").setValue(0.) -aFeatureName = aFeatureData.name() +aFeature.real("x").setValue(1.) +aFeature.real("y").setValue(-1.) +aFeature.real("z").setValue(0.) +aFeatureName = aFeature.name() assert(aFeatureName == "Point_1") aFeature.execute() diff --git a/src/SketchPlugin/Test/TestConstraintConcidence.py b/src/SketchPlugin/Test/TestConstraintConcidence.py index da616ce62..dedb420a5 100644 --- a/src/SketchPlugin/Test/TestConstraintConcidence.py +++ b/src/SketchPlugin/Test/TestConstraintConcidence.py @@ -22,7 +22,7 @@ from ModelAPI import * # Initialization of the test #========================================================================= -__updated__ = "2014-07-28" +__updated__ = "2014-10-28" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -31,37 +31,34 @@ aDocument = aSession.moduleDocument() #========================================================================= aSession.startOperation() aSketchFeature = aDocument.addFeature("Sketch") -aSketchFeatureData = aSketchFeature.data() -origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin")) +origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) origin.setValue(0, 0, 0) -dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX")) +dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX")) dirx.setValue(1, 0, 0) -diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY")) +diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY")) diry.setValue(0, 1, 0) -norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm")) +norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() #========================================================================= # Create a line and an arc #========================================================================= aSession.startOperation() -aSketchReflist = aSketchFeatureData.reflist("Features") +aSketchReflist = aSketchFeature.reflist("Features") aSketchArc = aDocument.addFeature("SketchArc") aSketchReflist.append(aSketchArc) -aSketchArcData = aSketchArc.data() -anArcCentr = geomDataAPI_Point2D(aSketchArcData.attribute("ArcCenter")) +anArcCentr = geomDataAPI_Point2D(aSketchArc.attribute("ArcCenter")) anArcStartPoint = geomDataAPI_Point2D( - aSketchArcData.attribute("ArcStartPoint")) -anArcEndPoint = geomDataAPI_Point2D(aSketchArcData.attribute("ArcEndPoint")) + aSketchArc.attribute("ArcStartPoint")) +anArcEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("ArcEndPoint")) aSketchFeature = aDocument.addFeature("SketchConstraintCoincidence") anArcCentr.setValue(10., 10.) anArcStartPoint.setValue(0., 50.) anArcEndPoint.setValue(50., 0.) aSketchLine = aDocument.addFeature("SketchLine") aSketchReflist.append(aSketchLine) -aSketchLineData = aSketchLine.data() -aLineStartPoint = geomDataAPI_Point2D(aSketchLineData.attribute("StartPoint")) -aLineEndPoint = geomDataAPI_Point2D(aSketchLineData.attribute("EndPoint")) +aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) +aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) # Lets initialize line start at circle's end: aLineStartPoint.setValue(50., 0.) aLineEndPoint.setValue(100., 25.) @@ -72,9 +69,8 @@ aSession.finishOperation() aSession.startOperation() aConstraint = aDocument.addFeature("SketchConstraintCoincidence") aSketchReflist.append(aConstraint) -aConstraintData = aConstraint.data() -reflistA = aConstraintData.refattr("ConstraintEntityA") -reflistB = aConstraintData.refattr("ConstraintEntityB") +reflistA = aConstraint.refattr("ConstraintEntityA") +reflistB = aConstraint.refattr("ConstraintEntityB") reflistA.setAttr(anArcEndPoint) reflistB.setAttr(aLineStartPoint) aSession.finishOperation() diff --git a/src/SketchPlugin/Test/TestConstraintDistance.py b/src/SketchPlugin/Test/TestConstraintDistance.py index 987851972..4c50263b2 100644 --- a/src/SketchPlugin/Test/TestConstraintDistance.py +++ b/src/SketchPlugin/Test/TestConstraintDistance.py @@ -46,14 +46,13 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature) -aSketchFeatureData = aSketchFeature.data() -origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin")) +origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) origin.setValue(0, 0, 0) -dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX")) +dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX")) dirx.setValue(1, 0, 0) -diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY")) +diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY")) diry.setValue(0, 1, 0) -norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm")) +norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() #========================================================================= @@ -61,14 +60,12 @@ aSession.finishOperation() #========================================================================= aSession.startOperation() aSketchPoint = aSketchFeature.addFeature("SketchPoint") -aSketchPointData = aSketchPoint.data() aSketchPointCoords = geomDataAPI_Point2D( - aSketchPointData.attribute("PointCoordindates")) + aSketchPoint.attribute("PointCoordindates")) aSketchPointCoords.setValue(50., 50.) aSketchLine = aSketchFeature.addFeature("SketchLine") -aLineAStartPoint = geomDataAPI_Point2D( - aSketchLine.data().attribute("StartPoint")) -aLineAEndPoint = geomDataAPI_Point2D(aSketchLine.data().attribute("EndPoint")) +aLineAStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) +aLineAEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) aLineAStartPoint.setValue(0., 25.) aLineAEndPoint.setValue(100., 25.) aSession.finishOperation() @@ -78,10 +75,9 @@ aSession.finishOperation() assert (distance(aSketchPointCoords, aLineAStartPoint) != 25.) aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintDistance") -aConstraintData = aConstraint.data() -aDistance = aConstraintData.real("ConstraintValue") -refattrA = aConstraintData.refattr("ConstraintEntityA") -refattrB = aConstraintData.refattr("ConstraintEntityB") +aDistance = aConstraint.real("ConstraintValue") +refattrA = aConstraint.refattr("ConstraintEntityA") +refattrB = aConstraint.refattr("ConstraintEntityB") assert (not aDistance.isInitialized()) assert (not refattrA.isInitialized()) assert (not refattrB.isInitialized()) diff --git a/src/SketchPlugin/Test/TestConstraintLength.py b/src/SketchPlugin/Test/TestConstraintLength.py index b4872a6b1..48acf2c6b 100644 --- a/src/SketchPlugin/Test/TestConstraintLength.py +++ b/src/SketchPlugin/Test/TestConstraintLength.py @@ -25,14 +25,13 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature) -aSketchFeatureData = aSketchFeature.data() -origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin")) +origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) origin.setValue(0, 0, 0) -dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX")) +dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX")) dirx.setValue(1, 0, 0) -diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY")) +diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY")) diry.setValue(0, 1, 0) -norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm")) +norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() #========================================================================= @@ -40,9 +39,8 @@ aSession.finishOperation() #========================================================================= aSession.startOperation() aSketchLineA = aSketchFeature.addFeature("SketchLine") -aLineAStartPoint = geomDataAPI_Point2D( - aSketchLineA.data().attribute("StartPoint")) -aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.data().attribute("EndPoint")) +aLineAStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint")) +aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint")) aLineAStartPoint.setValue(0., 25.) aLineAEndPoint.setValue(100., 25.) aSession.finishOperation() @@ -51,9 +49,8 @@ aSession.finishOperation() #========================================================================= aSession.startOperation() aLengthConstraint = aSketchFeature.addFeature("SketchConstraintLength") -aConstraintData = aLengthConstraint.data() -refattrA = aConstraintData.refattr("ConstraintEntityA") -aLength = aConstraintData.real("ConstraintValue") +refattrA = aLengthConstraint.refattr("ConstraintEntityA") +aLength = aLengthConstraint.real("ConstraintValue") assert (not refattrA.isInitialized()) assert (not aLength.isInitialized()) diff --git a/src/SketchPlugin/Test/TestConstraintParallel.py b/src/SketchPlugin/Test/TestConstraintParallel.py index cf9a3fb8b..18fbc6832 100644 --- a/src/SketchPlugin/Test/TestConstraintParallel.py +++ b/src/SketchPlugin/Test/TestConstraintParallel.py @@ -25,14 +25,13 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature) -aSketchFeatureData = aSketchFeature.data() -origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin")) +origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) origin.setValue(0, 0, 0) -dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX")) +dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX")) dirx.setValue(1, 0, 0) -diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY")) +diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY")) diry.setValue(0, 1, 0) -norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm")) +norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() #========================================================================= @@ -41,18 +40,14 @@ aSession.finishOperation() aSession.startOperation() # line A aSketchLineA = aSketchFeature.addFeature("SketchLine") -aLineAStartPoint = geomDataAPI_Point2D( - aSketchLineA.data().attribute("StartPoint")) -aLineAEndPoint = geomDataAPI_Point2D( - aSketchLineA.data().attribute("EndPoint")) +aLineAStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint")) +aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint")) aSketchLineB = aSketchFeature.addFeature("SketchLine") aLineAStartPoint.setValue(0., 25) aLineAEndPoint.setValue(85., 25) # line B -aLineBStartPoint = geomDataAPI_Point2D( - aSketchLineB.data().attribute("StartPoint")) -aLineBEndPoint = geomDataAPI_Point2D( - aSketchLineB.data().attribute("EndPoint")) +aLineBStartPoint = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint")) +aLineBEndPoint = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint")) aLineBStartPoint.setValue(0., 50) aLineBEndPoint.setValue(80., 75) aSession.finishOperation() @@ -63,8 +58,7 @@ aSession.finishOperation() for eachFeature in [aSketchLineA, aSketchLineB]: aSession.startOperation() aLengthConstraint = aSketchFeature.addFeature("SketchConstraintLength") - aLengthConstraintData = aLengthConstraint.data() - refattrA = aLengthConstraintData.refattr("ConstraintEntityA") + refattrA = aLengthConstraint.refattr("ConstraintEntityA") aResultA = modelAPI_ResultConstruction(eachFeature.firstResult()) assert (aResultA is not None) refattrA.setObject(aResultA) @@ -84,9 +78,8 @@ assert (aLineBEndPoint.y() == 75) #========================================================================= aSession.startOperation() aParallelConstraint = aSketchFeature.addFeature("SketchConstraintParallel") -aConstraintData = aParallelConstraint.data() -refattrA = aConstraintData.refattr("ConstraintEntityA") -refattrB = aConstraintData.refattr("ConstraintEntityB") +refattrA = aParallelConstraint.refattr("ConstraintEntityA") +refattrB = aParallelConstraint.refattr("ConstraintEntityB") # aResultA is already defined for the length constraint aResultA = modelAPI_ResultConstruction(eachFeature.firstResult()) aResultB = modelAPI_ResultConstruction(aSketchLineB.firstResult()) diff --git a/src/SketchPlugin/Test/TestConstraintPerpendicular.py b/src/SketchPlugin/Test/TestConstraintPerpendicular.py index b6aff2963..38b605f23 100644 --- a/src/SketchPlugin/Test/TestConstraintPerpendicular.py +++ b/src/SketchPlugin/Test/TestConstraintPerpendicular.py @@ -32,14 +32,13 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature) -aSketchFeatureData = aSketchFeature.data() -origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin")) +origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) origin.setValue(0, 0, 0) -dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX")) +dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX")) dirx.setValue(1, 0, 0) -diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY")) +diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY")) diry.setValue(0, 1, 0) -norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm")) +norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() #========================================================================= @@ -48,18 +47,14 @@ aSession.finishOperation() aSession.startOperation() # line A aSketchLineA = aSketchFeature.addFeature("SketchLine") -aLineAStartPoint = geomDataAPI_Point2D( - aSketchLineA.data().attribute("StartPoint")) -aLineAEndPoint = geomDataAPI_Point2D( - aSketchLineA.data().attribute("EndPoint")) +aLineAStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint")) +aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint")) # line B aSketchLineB = aSketchFeature.addFeature("SketchLine") aLineAStartPoint.setValue(0., 25) aLineAEndPoint.setValue(85., 25) -aLineBStartPoint = geomDataAPI_Point2D( - aSketchLineB.data().attribute("StartPoint")) -aLineBEndPoint = geomDataAPI_Point2D( - aSketchLineB.data().attribute("EndPoint")) +aLineBStartPoint = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint")) +aLineBEndPoint = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint")) aLineBStartPoint.setValue(25., 40.) aLineBEndPoint.setValue(25., 125.) aSession.finishOperation() @@ -71,8 +66,7 @@ aSession.finishOperation() for eachFeature in [aSketchLineA, aSketchLineB]: aSession.startOperation() aLengthConstraint = aSketchFeature.addFeature("SketchConstraintLength") - aLengthConstraintData = aLengthConstraint.data() - refattrA = aLengthConstraintData.refattr("ConstraintEntityA") + refattrA = aLengthConstraint.refattr("ConstraintEntityA") aResultA = modelAPI_ResultConstruction(eachFeature.firstResult()) assert (aResultA is not None) refattrA.setObject(aResultA) @@ -94,9 +88,8 @@ assert (aLineBEndPoint.y() == 125) aSession.startOperation() aPerpendicularConstraint = aSketchFeature.addFeature( "SketchConstraintPerpendicular") -aConstraintData = aPerpendicularConstraint.data() -refattrA = aConstraintData.refattr("ConstraintEntityA") -refattrB = aConstraintData.refattr("ConstraintEntityB") +refattrA = aPerpendicularConstraint.refattr("ConstraintEntityA") +refattrB = aPerpendicularConstraint.refattr("ConstraintEntityB") # aResultA is already defined for the length constraint aResultB = modelAPI_ResultConstruction(aSketchLineB.firstResult()) assert (aResultB is not None) diff --git a/src/SketchPlugin/Test/TestConstraintRadius.py b/src/SketchPlugin/Test/TestConstraintRadius.py index 2623047ca..afe60ba4f 100644 --- a/src/SketchPlugin/Test/TestConstraintRadius.py +++ b/src/SketchPlugin/Test/TestConstraintRadius.py @@ -34,14 +34,13 @@ aDocument = aSession.moduleDocument() aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature) -aSketchFeatureData = aSketchFeature.data() -origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin")) +origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) origin.setValue(0, 0, 0) -dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX")) +dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX")) dirx.setValue(1, 0, 0) -diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY")) +diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY")) diry.setValue(0, 1, 0) -norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm")) +norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() #========================================================================= @@ -49,22 +48,18 @@ aSession.finishOperation() #========================================================================= aSession.startOperation() aSketchArc = aSketchFeature.addFeature("SketchArc") -aSketchArcData = aSketchArc.data() -anArcCentr = geomDataAPI_Point2D(aSketchArcData.attribute("ArcCenter")) +anArcCentr = geomDataAPI_Point2D(aSketchArc.attribute("ArcCenter")) anArcCentr.setValue(10., 10.) -anArcStartPoint = geomDataAPI_Point2D( - aSketchArcData.attribute("ArcStartPoint")) +anArcStartPoint = geomDataAPI_Point2D(aSketchArc.attribute("ArcStartPoint")) anArcStartPoint.setValue(0., 50.) -anArcEndPoint = geomDataAPI_Point2D(aSketchArcData.attribute("ArcEndPoint")) +anArcEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("ArcEndPoint")) anArcEndPoint.setValue(50., 0.) aSession.finishOperation() # Circle aSession.startOperation() aSketchCircle = aSketchFeature.addFeature("SketchCircle") -aSketchCircleData = aSketchCircle.data() -anCircleCentr = geomDataAPI_Point2D( - aSketchCircleData.attribute("CircleCenter")) -aCircleRadius = aSketchCircleData.real("CircleRadius") +anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("CircleCenter")) +aCircleRadius = aSketchCircle.real("CircleRadius") anCircleCentr.setValue(-25., -25) aCircleRadius.setValue(25.) aSession.finishOperation() @@ -73,9 +68,8 @@ aSession.finishOperation() #========================================================================= aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintRadius") -aConstraintData = aConstraint.data() -aRadius = aConstraintData.real("ConstraintValue") -aRefObject = aConstraintData.refattr("ConstraintEntityA") +aRadius = aConstraint.real("ConstraintValue") +aRefObject = aConstraint.refattr("ConstraintEntityA") aResult = aSketchArc.firstResult() assert (aResult is not None) aRefObject.setObject(modelAPI_ResultConstruction(aResult)) @@ -88,9 +82,8 @@ assert (aRefObject.isInitialized()) #========================================================================= aSession.startOperation() aConstraint = aSketchFeature.addFeature("SketchConstraintRadius") -aConstraintData = aConstraint.data() -aRadius = aConstraintData.real("ConstraintValue") -aRefObject = aConstraintData.refattr("ConstraintEntityA") +aRadius = aConstraint.real("ConstraintValue") +aRefObject = aConstraint.refattr("ConstraintEntityA") aResult = aSketchCircle.firstResult() assert (aResult is not None) aRefObject.setObject(modelAPI_ResultConstruction(aResult)) diff --git a/src/SketchPlugin/Test/TestSketchArcCircle.py b/src/SketchPlugin/Test/TestSketchArcCircle.py index cde34109e..8ce7a3186 100644 --- a/src/SketchPlugin/Test/TestSketchArcCircle.py +++ b/src/SketchPlugin/Test/TestSketchArcCircle.py @@ -33,14 +33,13 @@ aSession.startOperation() #aSketchFeature = aDocument.addFeature("Sketch") aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature) -aSketchFeatureData = aSketchFeature.data() -origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin")) +origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) origin.setValue(0, 0, 0) -dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX")) +dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX")) dirx.setValue(1, 0, 0) -diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY")) +diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY")) diry.setValue(0, 1, 0) -norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm")) +norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() #========================================================================= @@ -49,32 +48,31 @@ aSession.finishOperation() # 2. #========================================================================= aSession.startOperation() -aSketchReflist = aSketchFeatureData.reflist("Features") +aSketchReflist = aSketchFeature.reflist("Features") assert (not aSketchReflist.isInitialized()) assert (aSketchReflist.size() == 0) assert (len(aSketchReflist.list()) == 0) aSketchArc = aSketchFeature.addFeature("SketchArc") assert (aSketchArc.getKind() == "SketchArc") -aSketchArcData = aSketchArc.data() -anArcCentr = geomDataAPI_Point2D(aSketchArcData.attribute("ArcCenter")) +anArcCentr = geomDataAPI_Point2D(aSketchArc.attribute("ArcCenter")) assert (anArcCentr.x() == 0) assert (anArcCentr.y() == 0) assert (not anArcCentr.isInitialized()) anArcCentr.setValue(10., 10.) anArcStartPoint = geomDataAPI_Point2D( - aSketchArcData.attribute("ArcStartPoint")) + aSketchArc.attribute("ArcStartPoint")) assert (anArcStartPoint.x() == 0) assert (anArcStartPoint.y() == 0) assert (not anArcStartPoint.isInitialized()) anArcStartPoint.setValue(0., 50.) -anArcEndPoint = geomDataAPI_Point2D(aSketchArcData.attribute("ArcEndPoint")) +anArcEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("ArcEndPoint")) assert (anArcEndPoint.x() == 0) assert (anArcEndPoint.y() == 0) assert (not anArcEndPoint.isInitialized()) anArcEndPoint.setValue(50., 0.) aSession.finishOperation() # check that values have been changed -aSketchReflist = aSketchFeatureData.reflist("Features") +aSketchReflist = aSketchFeature.reflist("Features") assert (aSketchReflist.size() == 1) assert (len(aSketchReflist.list()) == 1) assert (anArcCentr.x() == 10.0) @@ -127,19 +125,17 @@ assert (not aShape.isNull()) # 2. ModelAPI_AttributeDouble attribute #========================================================================= aSession.startOperation() -aSketchReflist = aSketchFeatureData.reflist("Features") +aSketchReflist = aSketchFeature.reflist("Features") # Arc is already added assert (aSketchReflist.size() == 1) assert (len(aSketchReflist.list()) == 1) aSketchCircle = aSketchFeature.addFeature("SketchCircle") assert (aSketchCircle.getKind() == "SketchCircle") -aSketchCircleData = aSketchCircle.data() -anCircleCentr = geomDataAPI_Point2D( - aSketchCircleData.attribute("CircleCenter")) +anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("CircleCenter")) assert (anCircleCentr.x() == 0) assert (anCircleCentr.y() == 0) assert (not anCircleCentr.isInitialized()) -aCircleRadius = aSketchCircleData.real("CircleRadius") +aCircleRadius = aSketchCircle.real("CircleRadius") assert (type(aCircleRadius) == ModelAPI_AttributeDouble) # ModelAPI_AttributeDouble.type() is checked in ModelAPI_TestConstants assert (aCircleRadius.attributeType() == ModelAPI_AttributeDouble.type()) diff --git a/src/SketchPlugin/Test/TestSketchPointLine.py b/src/SketchPlugin/Test/TestSketchPointLine.py index 20a85e3da..df3f7cd64 100644 --- a/src/SketchPlugin/Test/TestSketchPointLine.py +++ b/src/SketchPlugin/Test/TestSketchPointLine.py @@ -15,30 +15,29 @@ aSession.startOperation() aSketchCommonFeature = aDocument.addFeature("Sketch") aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature) assert (aSketchFeature.getKind() == "Sketch") -aSketchFeatureData = aSketchFeature.data() -origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin")) +origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) origin.setValue(0, 0, 0) -dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX")) +dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX")) dirx.setValue(1, 0, 0) -diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY")) +diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY")) diry.setValue(0, 1, 0) -norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm")) +norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) norm.setValue(0, 0, 1) aSession.finishOperation() # check that values have been changed -origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin")) +origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) assert (origin.x() == 0) assert (origin.y() == 0) assert (origin.z() == 0) -dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX")) +dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX")) assert (dirx.x() == 1) assert (dirx.y() == 0) assert (dirx.z() == 0) -diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY")) +diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY")) assert (diry.x() == 0) assert (diry.y() == 1) assert (diry.z() == 0) -norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm")) +norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) assert (norm.x() == 0) assert (norm.y() == 0) assert (norm.z() == 1) @@ -46,15 +45,14 @@ assert (norm.z() == 1) # Creation of a point #========================================================================= aSession.startOperation() -aSketchReflist = aSketchFeatureData.reflist("Features") +aSketchReflist = aSketchFeature.reflist("Features") assert (not aSketchReflist.isInitialized()) assert(aSketchReflist.size() == 0) assert (len(aSketchReflist.list()) == 0) # aSketchPoint = aDocument.addFeature("SketchPoint") aSketchPoint = aSketchFeature.addFeature("SketchPoint") assert (aSketchPoint.getKind() == "SketchPoint") -aSketchPointData = aSketchPoint.data() -coords = geomDataAPI_Point2D(aSketchPointData.attribute("PointCoordindates")) +coords = geomDataAPI_Point2D(aSketchPoint.attribute("PointCoordindates")) assert (coords.x() == 0) assert (coords.y() == 0) assert (not coords.isInitialized()) @@ -63,11 +61,10 @@ coords.setValue(10., 10.) assert (coords.isInitialized()) aSession.finishOperation() # check that values have been changed -aSketchReflist = aSketchFeatureData.reflist("Features") +aSketchReflist = aSketchFeature.reflist("Features") assert (aSketchReflist.size() == 1) assert (len(aSketchReflist.list()) == 1) -aSketchPointData = aSketchPoint.data() -coords = geomDataAPI_Point2D(aSketchPointData.attribute("PointCoordindates")) +coords = geomDataAPI_Point2D(aSketchPoint.attribute("PointCoordindates")) assert (coords.x() == 10.0) assert (coords.y() == 10.0) #========================================================================= @@ -79,9 +76,8 @@ aSketchLine = aSketchFeature.addFeature("SketchLine") assert (aSketchLine.getKind() == "SketchLine") assert (aSketchReflist.size() == 2) assert (len(aSketchReflist.list()) == 2) -aSketchLineData = aSketchLine.data() -aLineStartPoint = geomDataAPI_Point2D(aSketchLineData.attribute("StartPoint")) -aLineEndPoint = geomDataAPI_Point2D(aSketchLineData.attribute("EndPoint")) +aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) +aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) assert (aLineStartPoint.x() == 0) assert (aLineStartPoint.y() == 0) assert (not aLineStartPoint.isInitialized()) @@ -95,9 +91,8 @@ assert (aLineStartPoint.isInitialized()) assert (aLineEndPoint.isInitialized()) aSession.finishOperation() # check that values have been changed -aSketchLineData = aSketchLine.data() -aLineStartPoint = geomDataAPI_Point2D(aSketchLineData.attribute("StartPoint")) -aLineEndPoint = geomDataAPI_Point2D(aSketchLineData.attribute("EndPoint")) +aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) +aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint")) assert (aLineStartPoint.x() == 50.0) assert (aLineStartPoint.y() == 50.0) assert (aLineEndPoint.x() == 60.0)