From: sbh Date: Tue, 28 Oct 2014 12:45:56 +0000 (+0300) Subject: Bring batch tests to valid state X-Git-Tag: V_0.5~66^2~5^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=db01498dd5845ccb8d62912ae09aff5669f51a0e;p=modules%2Fshaper.git Bring batch tests to valid state --- diff --git a/src/ModelAPI/ModelAPI.i b/src/ModelAPI/ModelAPI.i index 7ff2bfc8e..ba16e8f1c 100644 --- a/src/ModelAPI/ModelAPI.i +++ b/src/ModelAPI/ModelAPI.i @@ -8,6 +8,7 @@ #include "ModelAPI_Session.h" #include "ModelAPI_Object.h" #include "ModelAPI_Feature.h" + #include "ModelAPI_CompositeFeature.h" #include "ModelAPI_Data.h" #include "ModelAPI_Attribute.h" #include "ModelAPI_AttributeDocRef.h" @@ -26,12 +27,12 @@ #include "ModelAPI_ResultBody.h" #include "ModelAPI_ResultPart.h" - template boost::shared_ptr castTo(boost::shared_ptr theObject) + template + boost::shared_ptr boost_cast(boost::shared_ptr theObject) { - return boost::dynamic_pointer_cast(theObject); + return boost::dynamic_pointer_cast(theObject); } - %} // to avoid error on this @@ -52,6 +53,7 @@ %shared_ptr(ModelAPI_Session) %shared_ptr(ModelAPI_Object) %shared_ptr(ModelAPI_Feature) +%shared_ptr(ModelAPI_CompositeFeature) %shared_ptr(ModelAPI_Data) %shared_ptr(ModelAPI_Attribute) %shared_ptr(ModelAPI_AttributeDocRef) @@ -76,6 +78,7 @@ %include "ModelAPI_Session.h" %include "ModelAPI_Object.h" %include "ModelAPI_Feature.h" +%include "ModelAPI_CompositeFeature.h" %include "ModelAPI_Data.h" %include "ModelAPI_Attribute.h" %include "ModelAPI_AttributeDocRef.h" @@ -97,7 +100,10 @@ %template(ObjectList) std::list >; %template(ResultList) std::list >; -template boost::shared_ptr castTo(boost::shared_ptr theObject); -%template(modelAPI_ResultConstruction) castTo; -%template(modelAPI_ResultBody) castTo; -%template(modelAPI_ResultPart) castTo; +template boost::shared_ptr boost_cast(boost::shared_ptr theObject); +%template(modelAPI_CompositeFeature) boost_cast; +%template(modelAPI_ResultConstruction) boost_cast; +%template(modelAPI_ResultBody) boost_cast; +%template(modelAPI_ResultPart) boost_cast; + + diff --git a/src/SketchPlugin/Test/TestConstraintDistance.py b/src/SketchPlugin/Test/TestConstraintDistance.py index 2d84321be..987851972 100644 --- a/src/SketchPlugin/Test/TestConstraintDistance.py +++ b/src/SketchPlugin/Test/TestConstraintDistance.py @@ -26,7 +26,7 @@ import math # Initialization of the test #========================================================================= -__updated__ = "2014-07-29" +__updated__ = "2014-10-28" def distance(pointA, pointB): @@ -44,7 +44,8 @@ aDocument = aSession.moduleDocument() # Creation of a sketch #========================================================================= aSession.startOperation() -aSketchFeature = aDocument.addFeature("Sketch") +aSketchCommonFeature = aDocument.addFeature("Sketch") +aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature) aSketchFeatureData = aSketchFeature.data() origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin")) origin.setValue(0, 0, 0) @@ -59,15 +60,12 @@ aSession.finishOperation() # Create a point and a line #========================================================================= aSession.startOperation() -aSketchReflist = aSketchFeatureData.reflist("Features") -aSketchPoint = aDocument.addFeature("SketchPoint") -aSketchReflist.append(aSketchPoint) +aSketchPoint = aSketchFeature.addFeature("SketchPoint") aSketchPointData = aSketchPoint.data() aSketchPointCoords = geomDataAPI_Point2D( aSketchPointData.attribute("PointCoordindates")) aSketchPointCoords.setValue(50., 50.) -aSketchLine = aDocument.addFeature("SketchLine") -aSketchReflist.append(aSketchLine) +aSketchLine = aSketchFeature.addFeature("SketchLine") aLineAStartPoint = geomDataAPI_Point2D( aSketchLine.data().attribute("StartPoint")) aLineAEndPoint = geomDataAPI_Point2D(aSketchLine.data().attribute("EndPoint")) @@ -79,8 +77,7 @@ aSession.finishOperation() #========================================================================= assert (distance(aSketchPointCoords, aLineAStartPoint) != 25.) aSession.startOperation() -aConstraint = aDocument.addFeature("SketchConstraintDistance") -aSketchReflist.append(aConstraint) +aConstraint = aSketchFeature.addFeature("SketchConstraintDistance") aConstraintData = aConstraint.data() aDistance = aConstraintData.real("ConstraintValue") refattrA = aConstraintData.refattr("ConstraintEntityA") diff --git a/src/SketchPlugin/Test/TestConstraintLength.py b/src/SketchPlugin/Test/TestConstraintLength.py index 28f032e4a..b4872a6b1 100644 --- a/src/SketchPlugin/Test/TestConstraintLength.py +++ b/src/SketchPlugin/Test/TestConstraintLength.py @@ -15,7 +15,7 @@ from ModelAPI import * # Initialization of the test #========================================================================= -__updated__ = "2014-09-26" +__updated__ = "2014-10-28" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -23,7 +23,8 @@ aDocument = aSession.moduleDocument() # Creation of a sketch #========================================================================= aSession.startOperation() -aSketchFeature = aDocument.addFeature("Sketch") +aSketchCommonFeature = aDocument.addFeature("Sketch") +aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature) aSketchFeatureData = aSketchFeature.data() origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin")) origin.setValue(0, 0, 0) @@ -38,9 +39,7 @@ aSession.finishOperation() # Create a line with length 100 #========================================================================= aSession.startOperation() -aSketchReflist = aSketchFeatureData.reflist("Features") -aSketchLineA = aDocument.addFeature("SketchLine") -aSketchReflist.append(aSketchLineA) +aSketchLineA = aSketchFeature.addFeature("SketchLine") aLineAStartPoint = geomDataAPI_Point2D( aSketchLineA.data().attribute("StartPoint")) aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.data().attribute("EndPoint")) @@ -51,8 +50,7 @@ aSession.finishOperation() # Make a constraint to keep the length #========================================================================= aSession.startOperation() -aLengthConstraint = aDocument.addFeature("SketchConstraintLength") -aSketchReflist.append(aLengthConstraint) +aLengthConstraint = aSketchFeature.addFeature("SketchConstraintLength") aConstraintData = aLengthConstraint.data() refattrA = aConstraintData.refattr("ConstraintEntityA") aLength = aConstraintData.real("ConstraintValue") diff --git a/src/SketchPlugin/Test/TestConstraintParallel.py b/src/SketchPlugin/Test/TestConstraintParallel.py index aa244cee7..cf9a3fb8b 100644 --- a/src/SketchPlugin/Test/TestConstraintParallel.py +++ b/src/SketchPlugin/Test/TestConstraintParallel.py @@ -15,7 +15,7 @@ from ModelAPI import * # Initialization of the test #========================================================================= -__updated__ = "2014-09-26" +__updated__ = "2014-10-28" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -23,7 +23,8 @@ aDocument = aSession.moduleDocument() # Creation of a sketch #========================================================================= aSession.startOperation() -aSketchFeature = aDocument.addFeature("Sketch") +aSketchCommonFeature = aDocument.addFeature("Sketch") +aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature) aSketchFeatureData = aSketchFeature.data() origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin")) origin.setValue(0, 0, 0) @@ -38,19 +39,16 @@ aSession.finishOperation() # Create two lines which are not parallel #========================================================================= aSession.startOperation() -aSketchReflist = aSketchFeatureData.reflist("Features") # line A -aSketchLineA = aDocument.addFeature("SketchLine") -aSketchReflist.append(aSketchLineA) +aSketchLineA = aSketchFeature.addFeature("SketchLine") aLineAStartPoint = geomDataAPI_Point2D( aSketchLineA.data().attribute("StartPoint")) aLineAEndPoint = geomDataAPI_Point2D( aSketchLineA.data().attribute("EndPoint")) -aSketchLineB = aDocument.addFeature("SketchLine") +aSketchLineB = aSketchFeature.addFeature("SketchLine") aLineAStartPoint.setValue(0., 25) aLineAEndPoint.setValue(85., 25) # line B -aSketchReflist.append(aSketchLineB) aLineBStartPoint = geomDataAPI_Point2D( aSketchLineB.data().attribute("StartPoint")) aLineBEndPoint = geomDataAPI_Point2D( @@ -64,8 +62,7 @@ aSession.finishOperation() #========================================================================= for eachFeature in [aSketchLineA, aSketchLineB]: aSession.startOperation() - aLengthConstraint = aDocument.addFeature("SketchConstraintLength") - aSketchReflist.append(aLengthConstraint) + aLengthConstraint = aSketchFeature.addFeature("SketchConstraintLength") aLengthConstraintData = aLengthConstraint.data() refattrA = aLengthConstraintData.refattr("ConstraintEntityA") aResultA = modelAPI_ResultConstruction(eachFeature.firstResult()) @@ -86,8 +83,7 @@ assert (aLineBEndPoint.y() == 75) # Link lines with parallel constraint #========================================================================= aSession.startOperation() -aParallelConstraint = aDocument.addFeature("SketchConstraintParallel") -aSketchReflist.append(aParallelConstraint) +aParallelConstraint = aSketchFeature.addFeature("SketchConstraintParallel") aConstraintData = aParallelConstraint.data() refattrA = aConstraintData.refattr("ConstraintEntityA") refattrB = aConstraintData.refattr("ConstraintEntityB") diff --git a/src/SketchPlugin/Test/TestConstraintPerpendicular.py b/src/SketchPlugin/Test/TestConstraintPerpendicular.py index 192f1d9ac..b6aff2963 100644 --- a/src/SketchPlugin/Test/TestConstraintPerpendicular.py +++ b/src/SketchPlugin/Test/TestConstraintPerpendicular.py @@ -22,7 +22,7 @@ from ModelAPI import * # Initialization of the test #========================================================================= -__updated__ = "2014-09-26" +__updated__ = "2014-10-28" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -30,7 +30,8 @@ aDocument = aSession.moduleDocument() # Creation of a sketch #========================================================================= aSession.startOperation() -aSketchFeature = aDocument.addFeature("Sketch") +aSketchCommonFeature = aDocument.addFeature("Sketch") +aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature) aSketchFeatureData = aSketchFeature.data() origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin")) origin.setValue(0, 0, 0) @@ -45,19 +46,16 @@ aSession.finishOperation() # Create two lines which are already perpendicular #========================================================================= aSession.startOperation() -aSketchReflist = aSketchFeatureData.reflist("Features") # line A -aSketchLineA = aDocument.addFeature("SketchLine") -aSketchReflist.append(aSketchLineA) +aSketchLineA = aSketchFeature.addFeature("SketchLine") aLineAStartPoint = geomDataAPI_Point2D( aSketchLineA.data().attribute("StartPoint")) aLineAEndPoint = geomDataAPI_Point2D( aSketchLineA.data().attribute("EndPoint")) -aSketchLineB = aDocument.addFeature("SketchLine") +# line B +aSketchLineB = aSketchFeature.addFeature("SketchLine") aLineAStartPoint.setValue(0., 25) aLineAEndPoint.setValue(85., 25) -# line B -aSketchReflist.append(aSketchLineB) aLineBStartPoint = geomDataAPI_Point2D( aSketchLineB.data().attribute("StartPoint")) aLineBEndPoint = geomDataAPI_Point2D( @@ -72,8 +70,7 @@ aSession.finishOperation() for eachFeature in [aSketchLineA, aSketchLineB]: aSession.startOperation() - aLengthConstraint = aDocument.addFeature("SketchConstraintLength") - aSketchReflist.append(aLengthConstraint) + aLengthConstraint = aSketchFeature.addFeature("SketchConstraintLength") aLengthConstraintData = aLengthConstraint.data() refattrA = aLengthConstraintData.refattr("ConstraintEntityA") aResultA = modelAPI_ResultConstruction(eachFeature.firstResult()) @@ -95,9 +92,8 @@ assert (aLineBEndPoint.y() == 125) # Link lines with perpendicular constraint #========================================================================= aSession.startOperation() -aPerpendicularConstraint = aDocument.addFeature( +aPerpendicularConstraint = aSketchFeature.addFeature( "SketchConstraintPerpendicular") -aSketchReflist.append(aPerpendicularConstraint) aConstraintData = aPerpendicularConstraint.data() refattrA = aConstraintData.refattr("ConstraintEntityA") refattrB = aConstraintData.refattr("ConstraintEntityB") diff --git a/src/SketchPlugin/Test/TestConstraintRadius.py b/src/SketchPlugin/Test/TestConstraintRadius.py index 630beb124..2623047ca 100644 --- a/src/SketchPlugin/Test/TestConstraintRadius.py +++ b/src/SketchPlugin/Test/TestConstraintRadius.py @@ -24,7 +24,7 @@ import math # Initialization of the test #========================================================================= -__updated__ = "2014-09-26" +__updated__ = "2014-10-28" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -32,7 +32,8 @@ aDocument = aSession.moduleDocument() # Creation of a sketch #========================================================================= aSession.startOperation() -aSketchFeature = aDocument.addFeature("Sketch") +aSketchCommonFeature = aDocument.addFeature("Sketch") +aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature) aSketchFeatureData = aSketchFeature.data() origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin")) origin.setValue(0, 0, 0) @@ -47,9 +48,7 @@ aSession.finishOperation() # Creation of an arc and a circle #========================================================================= aSession.startOperation() -aSketchReflist = aSketchFeatureData.reflist("Features") -aSketchArc = aDocument.addFeature("SketchArc") -aSketchReflist.append(aSketchArc) +aSketchArc = aSketchFeature.addFeature("SketchArc") aSketchArcData = aSketchArc.data() anArcCentr = geomDataAPI_Point2D(aSketchArcData.attribute("ArcCenter")) anArcCentr.setValue(10., 10.) @@ -61,8 +60,7 @@ anArcEndPoint.setValue(50., 0.) aSession.finishOperation() # Circle aSession.startOperation() -aSketchCircle = aDocument.addFeature("SketchCircle") -aSketchReflist.append(aSketchCircle) +aSketchCircle = aSketchFeature.addFeature("SketchCircle") aSketchCircleData = aSketchCircle.data() anCircleCentr = geomDataAPI_Point2D( aSketchCircleData.attribute("CircleCenter")) @@ -74,8 +72,7 @@ aSession.finishOperation() # Make a constraint to keep the radius of the arc #========================================================================= aSession.startOperation() -aConstraint = aDocument.addFeature("SketchConstraintRadius") -aSketchReflist.append(aConstraint) +aConstraint = aSketchFeature.addFeature("SketchConstraintRadius") aConstraintData = aConstraint.data() aRadius = aConstraintData.real("ConstraintValue") aRefObject = aConstraintData.refattr("ConstraintEntityA") @@ -90,8 +87,7 @@ assert (aRefObject.isInitialized()) # Make a constraint to keep the radius of the circle #========================================================================= aSession.startOperation() -aConstraint = aDocument.addFeature("SketchConstraintRadius") -aSketchReflist.append(aConstraint) +aConstraint = aSketchFeature.addFeature("SketchConstraintRadius") aConstraintData = aConstraint.data() aRadius = aConstraintData.real("ConstraintValue") aRefObject = aConstraintData.refattr("ConstraintEntityA") diff --git a/src/SketchPlugin/Test/TestSketchArcCircle.py b/src/SketchPlugin/Test/TestSketchArcCircle.py index 4223d5c35..cde34109e 100644 --- a/src/SketchPlugin/Test/TestSketchArcCircle.py +++ b/src/SketchPlugin/Test/TestSketchArcCircle.py @@ -22,7 +22,7 @@ from GeomDataAPI import * from ModelAPI import * -__updated__ = "2014-07-25" +__updated__ = "2014-10-28" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -30,7 +30,9 @@ aDocument = aSession.moduleDocument() # Creation of a sketch #========================================================================= aSession.startOperation() -aSketchFeature = aDocument.addFeature("Sketch") +#aSketchFeature = aDocument.addFeature("Sketch") +aSketchCommonFeature = aDocument.addFeature("Sketch") +aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature) aSketchFeatureData = aSketchFeature.data() origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin")) origin.setValue(0, 0, 0) @@ -44,23 +46,23 @@ aSession.finishOperation() #========================================================================= # Creation of an arc # 1. Test SketchPlugin_Arc attributes -# 2. +# 2. #========================================================================= aSession.startOperation() aSketchReflist = aSketchFeatureData.reflist("Features") assert (not aSketchReflist.isInitialized()) assert (aSketchReflist.size() == 0) assert (len(aSketchReflist.list()) == 0) -aSketchArc = aDocument.addFeature("SketchArc") +aSketchArc = aSketchFeature.addFeature("SketchArc") assert (aSketchArc.getKind() == "SketchArc") -aSketchReflist.append(aSketchArc) aSketchArcData = aSketchArc.data() anArcCentr = geomDataAPI_Point2D(aSketchArcData.attribute("ArcCenter")) assert (anArcCentr.x() == 0) assert (anArcCentr.y() == 0) assert (not anArcCentr.isInitialized()) -anArcCentr.setValue(10.,10.) -anArcStartPoint = geomDataAPI_Point2D(aSketchArcData.attribute("ArcStartPoint")) +anArcCentr.setValue(10., 10.) +anArcStartPoint = geomDataAPI_Point2D( + aSketchArcData.attribute("ArcStartPoint")) assert (anArcStartPoint.x() == 0) assert (anArcStartPoint.y() == 0) assert (not anArcStartPoint.isInitialized()) @@ -81,15 +83,16 @@ assert (anArcStartPoint.x() == 0.0) assert (anArcStartPoint.y() == 50.0) assert (anArcEndPoint.x() == 50.0) assert (anArcEndPoint.y() == 0.0) -#=============================================================================== +#========================================================================= # Edit the arc: # 1. Move whole arc -# 2. Change the start point -#=============================================================================== +# 2. Change the start point +#========================================================================= aSession.startOperation() deltaX, deltaY = 5., 10. anArcCentr.setValue(anArcCentr.x() + deltaX, anArcCentr.y() + deltaY) -anArcStartPoint.setValue(anArcStartPoint.x() + deltaX, anArcStartPoint.y() + deltaY) +anArcStartPoint.setValue( + anArcStartPoint.x() + deltaX, anArcStartPoint.y() + deltaY) anArcEndPoint.setValue(anArcEndPoint.x() + deltaX, anArcEndPoint.y() + deltaY) aSession.finishOperation() assert (anArcCentr.x() == 15) @@ -111,32 +114,32 @@ assert (anArcStartPoint.y() == 60) assert (anArcEndPoint.x() != aPrevEndPointX) assert (anArcEndPoint.y() != aPrevEndPointY) #========================================================================= -# Check results of the Arc +# Check results of the Arc #========================================================================= aResult = aSketchArc.firstResult() aResultConstruction = modelAPI_ResultConstruction(aResult) aShape = aResultConstruction.shape() assert (aShape is not None) assert (not aShape.isNull()) -#=============================================================================== +#========================================================================= # Create a circle # 1. Test SketchPlugin_Circle.h attributes # 2. ModelAPI_AttributeDouble attribute -#=============================================================================== +#========================================================================= aSession.startOperation() aSketchReflist = aSketchFeatureData.reflist("Features") # Arc is already added assert (aSketchReflist.size() == 1) assert (len(aSketchReflist.list()) == 1) -aSketchCircle = aDocument.addFeature("SketchCircle") +aSketchCircle = aSketchFeature.addFeature("SketchCircle") assert (aSketchCircle.getKind() == "SketchCircle") -aSketchReflist.append(aSketchCircle) aSketchCircleData = aSketchCircle.data() -anCircleCentr = geomDataAPI_Point2D(aSketchCircleData.attribute("CircleCenter")) +anCircleCentr = geomDataAPI_Point2D( + aSketchCircleData.attribute("CircleCenter")) assert (anCircleCentr.x() == 0) assert (anCircleCentr.y() == 0) assert (not anCircleCentr.isInitialized()) -aCircleRadius = aSketchCircleData.real("CircleRadius"); +aCircleRadius = aSketchCircleData.real("CircleRadius") assert (type(aCircleRadius) == ModelAPI_AttributeDouble) # ModelAPI_AttributeDouble.type() is checked in ModelAPI_TestConstants assert (aCircleRadius.attributeType() == ModelAPI_AttributeDouble.type()) @@ -147,11 +150,11 @@ assert (anCircleCentr.x() == -25) assert (anCircleCentr.y() == -25) assert (aCircleRadius.value() == 25) aSession.finishOperation() -#=============================================================================== +#========================================================================= # Edit the Cricle # 1. Check that changing the centr of a circle does not affects radius # 2. and vise versa; also check that int is acceptable as well as a real -#=============================================================================== +#========================================================================= aSession.startOperation() anCircleCentr.setValue(10, 60) aSession.finishOperation() @@ -164,6 +167,6 @@ aSession.finishOperation() assert (anCircleCentr.x() == 10) assert (anCircleCentr.y() == 60) assert (aCircleRadius.value() == 20) -#=============================================================================== +#========================================================================= # End of test -#=============================================================================== +#========================================================================= diff --git a/src/SketchPlugin/Test/TestSketchPointLine.py b/src/SketchPlugin/Test/TestSketchPointLine.py index dd90e27fd..20a85e3da 100644 --- a/src/SketchPlugin/Test/TestSketchPointLine.py +++ b/src/SketchPlugin/Test/TestSketchPointLine.py @@ -4,7 +4,7 @@ from GeomDataAPI import * from ModelAPI import * -__updated__ = "2014-07-24" +__updated__ = "2014-10-28" aSession = ModelAPI_Session.get() aDocument = aSession.moduleDocument() @@ -12,7 +12,8 @@ aDocument = aSession.moduleDocument() # Creation of a sketch #========================================================================= aSession.startOperation() -aSketchFeature = aDocument.addFeature("Sketch") +aSketchCommonFeature = aDocument.addFeature("Sketch") +aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature) assert (aSketchFeature.getKind() == "Sketch") aSketchFeatureData = aSketchFeature.data() origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin")) @@ -49,9 +50,9 @@ aSketchReflist = aSketchFeatureData.reflist("Features") assert (not aSketchReflist.isInitialized()) assert(aSketchReflist.size() == 0) assert (len(aSketchReflist.list()) == 0) -aSketchPoint = aDocument.addFeature("SketchPoint") +# aSketchPoint = aDocument.addFeature("SketchPoint") +aSketchPoint = aSketchFeature.addFeature("SketchPoint") assert (aSketchPoint.getKind() == "SketchPoint") -aSketchReflist.append(aSketchPoint) aSketchPointData = aSketchPoint.data() coords = geomDataAPI_Point2D(aSketchPointData.attribute("PointCoordindates")) assert (coords.x() == 0) @@ -69,18 +70,18 @@ aSketchPointData = aSketchPoint.data() coords = geomDataAPI_Point2D(aSketchPointData.attribute("PointCoordindates")) assert (coords.x() == 10.0) assert (coords.y() == 10.0) -#=============================================================================== +#========================================================================= # Creation of a line -#=============================================================================== +#========================================================================= aSession.startOperation() -aSketchLine = aDocument.addFeature("SketchLine") +# aSketchLine = aDocument.addFeature("SketchLine") +aSketchLine = aSketchFeature.addFeature("SketchLine") assert (aSketchLine.getKind() == "SketchLine") -aSketchReflist.append(aSketchLine) assert (aSketchReflist.size() == 2) assert (len(aSketchReflist.list()) == 2) aSketchLineData = aSketchLine.data() aLineStartPoint = geomDataAPI_Point2D(aSketchLineData.attribute("StartPoint")) -aLineEndPoint= geomDataAPI_Point2D(aSketchLineData.attribute("EndPoint")) +aLineEndPoint = geomDataAPI_Point2D(aSketchLineData.attribute("EndPoint")) assert (aLineStartPoint.x() == 0) assert (aLineStartPoint.y() == 0) assert (not aLineStartPoint.isInitialized()) @@ -96,15 +97,16 @@ aSession.finishOperation() # check that values have been changed aSketchLineData = aSketchLine.data() aLineStartPoint = geomDataAPI_Point2D(aSketchLineData.attribute("StartPoint")) -aLineEndPoint= geomDataAPI_Point2D(aSketchLineData.attribute("EndPoint")) +aLineEndPoint = geomDataAPI_Point2D(aSketchLineData.attribute("EndPoint")) assert (aLineStartPoint.x() == 50.0) assert (aLineStartPoint.y() == 50.0) assert (aLineEndPoint.x() == 60.0) assert (aLineEndPoint.y() == 60.0) -#=============================================================================== +#========================================================================= # Check the results -#=============================================================================== +#========================================================================= aResult = aSketchLine.firstResult() +assert (aResult is not None) aResultConstruction = modelAPI_ResultConstruction(aResult) aShape = aResultConstruction.shape() assert (aShape is not None)