From ab55bcd64e3c21f7c5363168e52cf72c6953a765 Mon Sep 17 00:00:00 2001 From: dbv Date: Tue, 15 Nov 2016 16:40:54 +0300 Subject: [PATCH] Issue #1773: Script python does not work - Renamed the current method "result" by "results"; - Added the function "result" returning the first result, that is "results()[0]"; - Python Dump generate a call to "result()" instead of producing a call to "results()[0]". --- src/BuildPlugin/Test/TestWire.py | 8 +++--- .../Test/TestAxisCreation.py | 16 ++++++------ src/ConstructionPlugin/Test/TestPlane.py | 26 +++++++++---------- src/ConstructionPlugin/Test/TestPoint.py | 2 +- src/ExchangePlugin/Test/TestExport.py | 4 +-- src/FeaturesPlugin/Test/TestBoolean.py | 4 +-- src/FeaturesPlugin/Test/TestBooleanFill.py | 6 ++--- src/FeaturesPlugin/Test/TestRecover.py | 8 +++--- src/ModelAPI/Test/Test1757.py | 24 ++++++++--------- src/ModelHighAPI/ModelHighAPI_Dumper.cpp | 8 +++++- src/ModelHighAPI/ModelHighAPI_Interface.cpp | 9 ++++++- src/ModelHighAPI/ModelHighAPI_Interface.h | 6 ++++- src/ModelHighAPI/Test/TestDeflectionDump.py | 4 +-- src/PythonAPI/Test/TestPrimitivesBox.py | 2 +- src/PythonAPI/examples/MakeBrick1.py | 2 +- src/PythonAPI/examples/MakeBrick2.py | 2 +- src/PythonAPI/examples/Platine.py | 6 ++--- src/SketchPlugin/Test/TestSplit.py | 20 +++++++------- 18 files changed, 87 insertions(+), 70 deletions(-) diff --git a/src/BuildPlugin/Test/TestWire.py b/src/BuildPlugin/Test/TestWire.py index 0d3bb1618..8598eac57 100644 --- a/src/BuildPlugin/Test/TestWire.py +++ b/src/BuildPlugin/Test/TestWire.py @@ -78,10 +78,10 @@ SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()[0]) -SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()[0]) -SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()[0]) -SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()[0]) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) model.do() Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")]) Wire_1.addContour() diff --git a/src/ConstructionPlugin/Test/TestAxisCreation.py b/src/ConstructionPlugin/Test/TestAxisCreation.py index 2c0dabfb6..61b3dfd7f 100644 --- a/src/ConstructionPlugin/Test/TestAxisCreation.py +++ b/src/ConstructionPlugin/Test/TestAxisCreation.py @@ -148,9 +148,9 @@ aSession.finishOperation() # Test an axis by line aSession.startOperation() -anAxis = model.addAxis(aPart, aSketchLine.result()[0]) +anAxis = model.addAxis(aPart, aSketchLine.result()) aSession.finishOperation() -assert (len(anAxis.result()) > 0) +assert (len(anAxis.results()) > 0) # Create plane aSession.startOperation() @@ -168,9 +168,9 @@ aSession.finishOperation() # Test an axis by plane and point aSession.startOperation() -anAxis = model.addAxis(aPart, aPlane1.result()[0], aSketchPoint.result()[0]) +anAxis = model.addAxis(aPart, aPlane1.result(), aSketchPoint.result()) aSession.finishOperation() -assert (len(anAxis.result()) > 0) +assert (len(anAxis.results()) > 0) # Create plane aSession.startOperation() @@ -179,15 +179,15 @@ aSession.finishOperation() # Test an axis by two planes aSession.startOperation() -anAxis = model.addAxis(aPart, aPlane1.result()[0], aPlane2.result()[0]) +anAxis = model.addAxis(aPart, aPlane1.result(), aPlane2.result()) aSession.finishOperation() -assert (len(anAxis.result()) > 0) +assert (len(anAxis.results()) > 0) # Test an axis by two planes and offsets aSession.startOperation() -anAxis = model.addAxis(aPart, aPlane1.result()[0], 50, False, aPlane2.result()[0], 100, True) +anAxis = model.addAxis(aPart, aPlane1.result(), 50, False, aPlane2.result(), 100, True) aSession.finishOperation() -assert (len(anAxis.result()) > 0) +assert (len(anAxis.results()) > 0) import model assert(model.checkPythonDump()) diff --git a/src/ConstructionPlugin/Test/TestPlane.py b/src/ConstructionPlugin/Test/TestPlane.py index 3a3b7c862..6669c2d1b 100644 --- a/src/ConstructionPlugin/Test/TestPlane.py +++ b/src/ConstructionPlugin/Test/TestPlane.py @@ -20,7 +20,7 @@ aSession.finishOperation() aSession.startOperation() aPlane = model.addPlane(aDocument, 1, 1, 1, 0) aSession.finishOperation() -assert (len(aPlane.result()) > 0) +assert (len(aPlane.results()) > 0) # Create a point 1 aSession.startOperation() @@ -39,9 +39,9 @@ aSession.finishOperation() # Test a plane by three points aSession.startOperation() -aPlane = model.addPlane(aDocument, aPoint1.result()[0], aPoint2.result()[0], aPoint3.result()[0]) +aPlane = model.addPlane(aDocument, aPoint1.result(), aPoint2.result(), aPoint3.result()) aSession.finishOperation() -assert (len(aPlane.result()) > 0) +assert (len(aPlane.results()) > 0) # Create an axis aSession.startOperation() @@ -50,21 +50,21 @@ aSession.finishOperation() # Test a plane by line and point aSession.startOperation() -aPlane = model.addPlane(aDocument, anAxis.result()[0], aPoint3.result()[0], True) +aPlane = model.addPlane(aDocument, anAxis.result(), aPoint3.result(), True) aSession.finishOperation() -assert (len(aPlane.result()) > 0) +assert (len(aPlane.results()) > 0) # Test a plane by distance from other aSession.startOperation() -aPlane = model.addPlane(aDocument, aPlane.result()[0], 50, False) +aPlane = model.addPlane(aDocument, aPlane.result(), 50, False) aSession.finishOperation() -assert (len(aPlane.result()) > 0) +assert (len(aPlane.results()) > 0) # Test a plane by coincidence to point aSession.startOperation() -aCoincidentPlane = model.addPlane(aDocument, aPlane.result()[0], aPoint2.result()[0]) +aCoincidentPlane = model.addPlane(aDocument, aPlane.result(), aPoint2.result()) aSession.finishOperation() -assert (len(aCoincidentPlane.result()) > 0) +assert (len(aCoincidentPlane.results()) > 0) # Create an axis aSession.startOperation() @@ -73,15 +73,15 @@ aSession.finishOperation() # Test a plane by rotation aSession.startOperation() -aRotatedPlane = model.addPlane(aDocument, aCoincidentPlane.result()[0], anAxis.result()[0], 45) +aRotatedPlane = model.addPlane(aDocument, aCoincidentPlane.result(), anAxis.result(), 45) aSession.finishOperation() -assert (len(aRotatedPlane.result()) > 0) +assert (len(aRotatedPlane.results()) > 0) # Test plane by two parallel planes aSession.startOperation() -aPlane = model.addPlane(aDocument, aCoincidentPlane.result()[0], aPlane.result()[0]) +aPlane = model.addPlane(aDocument, aCoincidentPlane.result(), aPlane.result()) aSession.finishOperation() -assert (len(aPlane.result()) > 0) +assert (len(aPlane.results()) > 0) import model assert(model.checkPythonDump()) diff --git a/src/ConstructionPlugin/Test/TestPoint.py b/src/ConstructionPlugin/Test/TestPoint.py index d91d74634..2614281bc 100644 --- a/src/ConstructionPlugin/Test/TestPoint.py +++ b/src/ConstructionPlugin/Test/TestPoint.py @@ -20,7 +20,7 @@ aSession.finishOperation() aSession.startOperation() aPoint = model.addPoint(aDocument, 50, 50, 50) aSession.finishOperation() -assert (len(aPoint.result()) > 0) +assert (len(aPoint.results()) > 0) # # Create a sketch with lines # aSession.startOperation() diff --git a/src/ExchangePlugin/Test/TestExport.py b/src/ExchangePlugin/Test/TestExport.py index eda5c0aff..f3afbf36f 100644 --- a/src/ExchangePlugin/Test/TestExport.py +++ b/src/ExchangePlugin/Test/TestExport.py @@ -46,7 +46,7 @@ def testExport(theType, theFormat, theFile, theVolume, theDelta): removeFile(theFile) # Export a part aSession.startOperation("Export part") - model.exportToFile(aPart, theFile, anImport.result(), theFormat) + model.exportToFile(aPart, theFile, anImport.results(), theFormat) # anExportFeature = aPart.addFeature("Export") # anExportFeature.string("file_format").setValue(theFormat) # anExportFeature.string("file_path").setValue(theFile) @@ -77,7 +77,7 @@ def testExportXAO(): # Create groups aSession.startOperation() - aGroup = model.addGroup(aPart, anImport.result()) + aGroup = model.addGroup(aPart, anImport.results()) aGroup.defaultResult().data().setName("boite_1") aGroup.groupList().setSelectionType("solid") # aGroupFeature = aSession.activeDocument().addFeature("Group") diff --git a/src/FeaturesPlugin/Test/TestBoolean.py b/src/FeaturesPlugin/Test/TestBoolean.py index 12d51b723..8c6b67fd2 100644 --- a/src/FeaturesPlugin/Test/TestBoolean.py +++ b/src/FeaturesPlugin/Test/TestBoolean.py @@ -134,7 +134,7 @@ model.do() Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 10, 0) Boolean_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_1_2")]) model.end() -assert(len(Boolean_1.result()) > 0) +assert(len(Boolean_1.results()) > 0) model.begin() partSet = model.moduleDocument() @@ -149,6 +149,6 @@ model.do() Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 10, 0) Boolean_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_1_2")]) model.end() -assert(len(Boolean_1.result()) > 0) +assert(len(Boolean_1.results()) > 0) assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestBooleanFill.py b/src/FeaturesPlugin/Test/TestBooleanFill.py index 524286a35..6a29649ca 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFill.py +++ b/src/FeaturesPlugin/Test/TestBooleanFill.py @@ -35,13 +35,13 @@ aSession.finishOperation() # Make extrusion on circle (cylinder) and triangle (prism) aSession.startOperation() -anExtrusion = model.addExtrusion(aDocument, aCircleSketch.result() + aTriangleSketch.result(), 100) +anExtrusion = model.addExtrusion(aDocument, aCircleSketch.results() + aTriangleSketch.results(), 100) aSession.finishOperation() # Fill prism with cylinder aSession.startOperation() -aBoolean = model.addFill(aDocument, [anExtrusion.result()[0]], [anExtrusion.result()[1]]) -assert (len(aBoolean.result()) > 0) +aBoolean = model.addFill(aDocument, [anExtrusion.results()[0]], [anExtrusion.results()[1]]) +assert (len(aBoolean.results()) > 0) aSession.finishOperation() assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestRecover.py b/src/FeaturesPlugin/Test/TestRecover.py index f3afa4106..1a2765bc9 100644 --- a/src/FeaturesPlugin/Test/TestRecover.py +++ b/src/FeaturesPlugin/Test/TestRecover.py @@ -23,14 +23,14 @@ c2 = sk2.addCircle(20, 30, 30) model.do() smallcyl = model.addExtrusion(mypart, sk2.selectFace(), 150) -cut = model.addCut(mypart, bigcyl.result(), smallcyl.result()) +cut = model.addCut(mypart, bigcyl.results(), smallcyl.results()) model.do() # check bodies number is 1: only Boolean result assert(mypart.size("Bodies") == 1) -model.addRecover(mypart, cut, smallcyl.result()) +model.addRecover(mypart, cut, smallcyl.results()) model.end() @@ -46,14 +46,14 @@ assert(mypart.size("Bodies") == 1) # check persistent flag of recover: never concealed model.begin() -recover = model.addRecover(mypart, cut, smallcyl.result(), True) +recover = model.addRecover(mypart, cut, smallcyl.results(), True) assert(mypart.size("Bodies") == 2) sk3 = model.addSketch(mypart, model.defaultPlane("XOY")) c3 = sk3.addCircle(0, 0, 90) model.do() big2 = model.addExtrusion(mypart, sk3.selectFace(), 110) -cut2 = model.addCut(mypart, big2.result(), smallcyl.result()) +cut2 = model.addCut(mypart, big2.results(), smallcyl.results()) model.end() diff --git a/src/ModelAPI/Test/Test1757.py b/src/ModelAPI/Test/Test1757.py index 236eac9b4..ccd4b625e 100644 --- a/src/ModelAPI/Test/Test1757.py +++ b/src/ModelAPI/Test/Test1757.py @@ -29,10 +29,10 @@ SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()[0]) -SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()[0]) -SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()[0]) -SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()[0]) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) model.do() Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 300, 0) @@ -49,10 +49,10 @@ SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_5.result()[0]) -SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result()[0]) -SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result()[0]) -SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result()[0]) +SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_5.result()) +SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result()) +SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result()) +SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result()) ExtrusionCut_1.setNestedSketch(Sketch_2) model.do() @@ -82,10 +82,10 @@ SketchConstraintCoincidence_9 = Sketch_4.setCoincident(SketchLine_12.endPoint(), SketchConstraintCoincidence_10 = Sketch_4.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) SketchConstraintCoincidence_11 = Sketch_4.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) SketchConstraintCoincidence_12 = Sketch_4.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) -SketchConstraintHorizontal_5 = Sketch_4.setHorizontal(SketchLine_9.result()[0]) -SketchConstraintVertical_5 = Sketch_4.setVertical(SketchLine_10.result()[0]) -SketchConstraintHorizontal_6 = Sketch_4.setHorizontal(SketchLine_11.result()[0]) -SketchConstraintVertical_6 = Sketch_4.setVertical(SketchLine_12.result()[0]) +SketchConstraintHorizontal_5 = Sketch_4.setHorizontal(SketchLine_9.result()) +SketchConstraintVertical_5 = Sketch_4.setVertical(SketchLine_10.result()) +SketchConstraintHorizontal_6 = Sketch_4.setHorizontal(SketchLine_11.result()) +SketchConstraintVertical_6 = Sketch_4.setVertical(SketchLine_12.result()) model.do() ExtrusionCut_3.setNestedSketch(Sketch_4) diff --git a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp index 2764c1798..09338cc1c 100644 --- a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp @@ -652,7 +652,13 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const ResultPtr& theResult) break; } } - myDumpBuffer << name(aFeature) << ".result()[" << anIndex << "]"; + + myDumpBuffer << name(aFeature); + if(anIndex == 0) { + myDumpBuffer << ".result()"; + } else { + myDumpBuffer << ".results()[" << anIndex << "]"; + } return *this; } diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.cpp b/src/ModelHighAPI/ModelHighAPI_Interface.cpp index 51d6f036a..73c14aefc 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Interface.cpp @@ -79,7 +79,14 @@ void ModelHighAPI_Interface::setName(const std::string& theName) feature()->data()->setName(theName); } -std::list ModelHighAPI_Interface::result() const +ModelHighAPI_Selection ModelHighAPI_Interface::result() const +{ + const_cast(this)->execute(); + + return ModelHighAPI_Selection(feature()->firstResult()); +} + +std::list ModelHighAPI_Interface::results() const { const_cast(this)->execute(); diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.h b/src/ModelHighAPI/ModelHighAPI_Interface.h index 669559d9a..7c9774e3a 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.h +++ b/src/ModelHighAPI/ModelHighAPI_Interface.h @@ -58,9 +58,13 @@ public: MODELHIGHAPI_EXPORT void setName(const std::string& theName); + /// Return firts object of the feature + MODELHIGHAPI_EXPORT + virtual ModelHighAPI_Selection result() const; + /// Return all objects of the feature MODELHIGHAPI_EXPORT - virtual std::list result() const; + virtual std::list results() const; /// Return default result. Default implementation feature()->lastResult() MODELHIGHAPI_EXPORT diff --git a/src/ModelHighAPI/Test/TestDeflectionDump.py b/src/ModelHighAPI/Test/TestDeflectionDump.py index 49b0c87ba..668f7c9e1 100644 --- a/src/ModelHighAPI/Test/TestDeflectionDump.py +++ b/src/ModelHighAPI/Test/TestDeflectionDump.py @@ -7,9 +7,9 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(-325.90051457976, -18.010291595197, 258.003584159371) model.do() -Sketch_1.result()[0].setDeflection(5e-006) +Sketch_1.result().setDeflection(5e-006) Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0) -Extrusion_1.result()[0].setDeflection(0.5) +Extrusion_1.result().setDeflection(0.5) model.end() assert(model.checkPythonDump()) diff --git a/src/PythonAPI/Test/TestPrimitivesBox.py b/src/PythonAPI/Test/TestPrimitivesBox.py index e78b131e4..692a1c502 100644 --- a/src/PythonAPI/Test/TestPrimitivesBox.py +++ b/src/PythonAPI/Test/TestPrimitivesBox.py @@ -33,7 +33,7 @@ class PrimitivesAddBoxTestCase(PrimitivesAddBox): def test_add_box_by_two_points(self): point1 = model.addPoint(self.part,0,0,0).result() point2 = model.addPoint(self.part,10,10,10).result() - box = model.addBox(self.part, point1[0], point2[0]) + box = model.addBox(self.part, point1, point2) model.do() self.assertEqual(box.creationMethod().value(),"BoxByTwoPoints") self.assertEqual(box.firstPoint().context().shape().isVertex(),True) diff --git a/src/PythonAPI/examples/MakeBrick1.py b/src/PythonAPI/examples/MakeBrick1.py index 5ef2f3c45..6434488d4 100644 --- a/src/PythonAPI/examples/MakeBrick1.py +++ b/src/PythonAPI/examples/MakeBrick1.py @@ -69,7 +69,7 @@ model.do() # Subtracting the cylinder to the box -model.addCut(mypart, mybox.result(), myboss.result()) +model.addCut(mypart, mybox.results(), myboss.results()) model.end() diff --git a/src/PythonAPI/examples/MakeBrick2.py b/src/PythonAPI/examples/MakeBrick2.py index 1be7e05fd..843773eeb 100644 --- a/src/PythonAPI/examples/MakeBrick2.py +++ b/src/PythonAPI/examples/MakeBrick2.py @@ -62,7 +62,7 @@ model.do() # Subtracting the cylinder to the box -model.addCut(mypart, mybox.result(), myboss.result()) +model.addCut(mypart, mybox.results(), myboss.results()) model.end() diff --git a/src/PythonAPI/examples/Platine.py b/src/PythonAPI/examples/Platine.py index a21d55eed..c4c9254e1 100644 --- a/src/PythonAPI/examples/Platine.py +++ b/src/PythonAPI/examples/Platine.py @@ -190,12 +190,12 @@ def body_4(): b1 = vertical_body() b2 = bottom_body() -boolean = model.addFuse(part, b1.result() + b2.result()) +boolean = model.addFuse(part, b1.results() + b2.results()) model.do() b3 = body_3() -boolean = model.addFuse(part, boolean.result() + b3.result()) +boolean = model.addFuse(part, boolean.results() + b3.results()) model.do() # START DEBUG PURPOSES @@ -209,7 +209,7 @@ model.do() # END DEBUG PURPOSES b4 = body_4() -boolean = model.addFuse(part, boolean.result() + b4.result()) +boolean = model.addFuse(part, boolean.results() + b4.results()) model.end() assert(model.checkPythonDump()) diff --git a/src/SketchPlugin/Test/TestSplit.py b/src/SketchPlugin/Test/TestSplit.py index 36a03f97f..d078e956a 100644 --- a/src/SketchPlugin/Test/TestSplit.py +++ b/src/SketchPlugin/Test/TestSplit.py @@ -18,7 +18,7 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 50, 100, 50) SketchPoint_1 = Sketch_1.addPoint(50, 50) -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result()[0]) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result()) Sketch_1.addSplit(SketchLine_1, SketchPoint_1.coordinates(), SketchLine_1.endPoint()) model.do() @@ -38,8 +38,8 @@ Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_2_1 = Sketch_2.addLine(0, 50, 100, 50) SketchPoint_2_1 = Sketch_2.addPoint(25, 50) SketchPoint_2_2 = Sketch_2.addPoint(75, 50) -SketchConstraintCoincidence_2_1 = Sketch_2.setCoincident(SketchPoint_2_1.coordinates(), SketchLine_2_1.result()[0]) -SketchConstraintCoincidence_2_2 = Sketch_2.setCoincident(SketchPoint_2_2.coordinates(), SketchLine_2_1.result()[0]) +SketchConstraintCoincidence_2_1 = Sketch_2.setCoincident(SketchPoint_2_1.coordinates(), SketchLine_2_1.result()) +SketchConstraintCoincidence_2_2 = Sketch_2.setCoincident(SketchPoint_2_2.coordinates(), SketchLine_2_1.result()) Sketch_2.addSplit(SketchLine_2_1, SketchPoint_2_1.coordinates(), SketchPoint_2_2.coordinates()) model.do() @@ -59,8 +59,8 @@ Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_3_1 = Sketch_3.addCircle(50, 50, 50) SketchPoint_3_1 = Sketch_3.addPoint(50, 0) SketchPoint_3_2 = Sketch_3.addPoint(50, 100) -SketchConstraintCoincidence_3_1 = Sketch_3.setCoincident(SketchPoint_3_1.coordinates(), SketchCircle_3_1.result()[1]) -SketchConstraintCoincidence_3_2 = Sketch_3.setCoincident(SketchPoint_3_2.coordinates(), SketchCircle_3_1.result()[1]) +SketchConstraintCoincidence_3_1 = Sketch_3.setCoincident(SketchPoint_3_1.coordinates(), SketchCircle_3_1.results()[1]) +SketchConstraintCoincidence_3_2 = Sketch_3.setCoincident(SketchPoint_3_2.coordinates(), SketchCircle_3_1.results()[1]) Sketch_3.addSplit(SketchCircle_3_1, SketchPoint_3_1.coordinates(), SketchPoint_3_2.coordinates()) model.do() @@ -82,7 +82,7 @@ Sketch_4.setFixed(SketchArc_4_1.startPoint()) Sketch_4.setFixed(SketchArc_4_1.endPoint()) Sketch_4.setRadius(SketchArc_4_1, 50) SketchPoint_4_1 = Sketch_4.addPoint(50, 100) -SketchConstraintCoincidence_4_1 = Sketch_4.setCoincident(SketchPoint_4_1.coordinates(), SketchArc_4_1.result()[1]) +SketchConstraintCoincidence_4_1 = Sketch_4.setCoincident(SketchPoint_4_1.coordinates(), SketchArc_4_1.results()[1]) Sketch_4.addSplit(SketchArc_4_1, SketchPoint_4_1.coordinates(), SketchArc_4_1.endPoint()) model.do() @@ -105,10 +105,10 @@ Sketch_5.setFixed(SketchArc_5_1.startPoint()) Sketch_5.setFixed(SketchArc_5_1.endPoint()) Sketch_5.setRadius(SketchArc_5_1, 50) SketchLine_5_1 = Sketch_5.addLine(25, 93.301270189222, 75, 93.301270189222) -SketchConstraintCoincidence_5_1 = Sketch_5.setCoincident(SketchLine_5_1.startPoint(), SketchArc_5_1.result()[1]) -SketchConstraintCoincidence_5_2 = Sketch_5.setCoincident(SketchLine_5_1.endPoint(), SketchArc_5_1.result()[1]) -SketchConstraintHorizontal_5_1 = Sketch_5.setHorizontal(SketchLine_5_1.result()[0]) -SketchConstraintLength_5_1 = Sketch_5.setLength(SketchLine_5_1.result()[0], 50) +SketchConstraintCoincidence_5_1 = Sketch_5.setCoincident(SketchLine_5_1.startPoint(), SketchArc_5_1.results()[1]) +SketchConstraintCoincidence_5_2 = Sketch_5.setCoincident(SketchLine_5_1.endPoint(), SketchArc_5_1.results()[1]) +SketchConstraintHorizontal_5_1 = Sketch_5.setHorizontal(SketchLine_5_1.result()) +SketchConstraintLength_5_1 = Sketch_5.setLength(SketchLine_5_1.result(), 50) Sketch_5.addSplit(SketchArc_5_1, SketchLine_5_1.startPoint(), SketchLine_5_1.endPoint()) model.do() -- 2.39.2