From 099783e0f9e9a655b884ab6eb0167734ba93b577 Mon Sep 17 00:00:00 2001 From: spo Date: Fri, 17 Jun 2016 14:49:44 +0300 Subject: [PATCH] Fix Platine test --- src/ModelHighAPI/ModelHighAPI_Interface.h | 3 +++ src/PythonAPI/examples/Platine.py | 18 +++++++++--------- src/SketchAPI/SketchAPI_Sketch.cpp | 9 ++++++--- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.h b/src/ModelHighAPI/ModelHighAPI_Interface.h index f8644968c..7d61ffbfb 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.h +++ b/src/ModelHighAPI/ModelHighAPI_Interface.h @@ -62,6 +62,9 @@ protected: std::shared_ptr myFeature; }; +//! Pointer on Interface object +typedef std::shared_ptr InterfacePtr; + //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_INTERFACE_H_ */ diff --git a/src/PythonAPI/examples/Platine.py b/src/PythonAPI/examples/Platine.py index 2e9a4e4fb..8a11fdf2b 100644 --- a/src/PythonAPI/examples/Platine.py +++ b/src/PythonAPI/examples/Platine.py @@ -23,9 +23,9 @@ E = 16 P = 80 # Create Parameters -model.addParameter(part, "L", L) -model.addParameter(part, "E", E) -model.addParameter(part, "P", P) +model.addParameter(part, "L", str(L)) +model.addParameter(part, "E", str(E)) +model.addParameter(part, "P", str(P)) def vertical_body(): # Create YOZ sketch @@ -71,7 +71,7 @@ def bottom_body(): points = [(P - 20, 16 + 16 / 2), (P - 20, 16), (P - 20, 16 + 16)] points = [(p[0], -p[1]) for p in points] # as we look to back of the face center, start, end = [geom.Pnt2d(*p) for p in points] - arc = sketch.addArc(center, start, end, inversed=True) + arc = sketch.addArc(center, start, end, True) # Set Auxiliarity v1.setAuxiliary(True) @@ -128,7 +128,7 @@ def body_3(): points = [(l + r, H), (l + 2 * r, H), (l, H)] points = [(p[0], -p[1]) for p in points] # as we look to back of the face center, start, end = [geom.Pnt2d(*p) for p in points] - arc = sketch.addArc(center, start, end) + arc = sketch.addArc(center, start, end, False) # Set Auxiliarity top_middle.setAuxiliary(True) @@ -197,12 +197,12 @@ def body_4(): b1 = vertical_body() b2 = bottom_body() -boolean = model.addAddition(part, b1.result() + b2.result()) +boolean = model.addFuse(part, b1.result() + b2.result()) model.do() b3 = body_3() -boolean = model.addAddition(part, boolean.result() + b3.result()) +boolean = model.addFuse(part, boolean.result() + b3.result()) model.do() # START DEBUG PURPOSES @@ -216,5 +216,5 @@ model.do() # END DEBUG PURPOSES b4 = body_4() -boolean = model.addAddition(part, boolean.result() + b4.result()) -model.do() +boolean = model.addFuse(part, boolean.result() + b4.result()) +model.end() diff --git a/src/SketchAPI/SketchAPI_Sketch.cpp b/src/SketchAPI/SketchAPI_Sketch.cpp index c19290dbf..11d3c00a4 100644 --- a/src/SketchAPI/SketchAPI_Sketch.cpp +++ b/src/SketchAPI/SketchAPI_Sketch.cpp @@ -208,13 +208,16 @@ std::shared_ptr SketchAPI_Sketch::addLine( std::shared_ptr SketchAPI_Sketch::addLine(const ModelHighAPI_Selection & theExternal) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID()); - return LinePtr(new SketchAPI_Line(aFeature, theExternal)); + LinePtr aLine(new SketchAPI_Line(aFeature, theExternal)); + setRigid(InterfacePtr(aLine)); + return aLine; } std::shared_ptr SketchAPI_Sketch::addLine(const std::string & theExternalName) { - // TODO(spo): Add constraint SketchConstraintRigid like in PythonAPI. Is it necessary? std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID()); - return LinePtr(new SketchAPI_Line(aFeature, theExternalName)); + LinePtr aLine(new SketchAPI_Line(aFeature, theExternalName)); + setRigid(InterfacePtr(aLine)); + return aLine; } //-------------------------------------------------------------------------------------- -- 2.39.2