]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix Platine test
authorspo <sergey.pokhodenko@opencascade.com>
Fri, 17 Jun 2016 11:49:44 +0000 (14:49 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 17 Jun 2016 15:23:53 +0000 (18:23 +0300)
src/ModelHighAPI/ModelHighAPI_Interface.h
src/PythonAPI/examples/Platine.py
src/SketchAPI/SketchAPI_Sketch.cpp

index f8644968c2b30a10e458d129e66069052490d4a5..7d61ffbfb69ee940f6f987d0075f216881beb53a 100644 (file)
@@ -62,6 +62,9 @@ protected:
   std::shared_ptr<ModelAPI_Feature> myFeature;
 };
 
+//! Pointer on Interface object
+typedef std::shared_ptr<ModelHighAPI_Interface> InterfacePtr;
+
 //--------------------------------------------------------------------------------------
 //--------------------------------------------------------------------------------------
 #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_INTERFACE_H_ */
index 2e9a4e4fbecc57ad5783ee7441c378ca772cf6f2..8a11fdf2badbbc1bac183b2fad6dce25625636e2 100644 (file)
@@ -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()
index c19290dbf4090dbdb2bd6d82317c1442c791d9f2..11d3c00a49330ca71441ac8bfae6c1a0a72c6a0f 100644 (file)
@@ -208,13 +208,16 @@ std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(
 std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(const ModelHighAPI_Selection & theExternal)
 {
   std::shared_ptr<ModelAPI_Feature> 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_Line> SketchAPI_Sketch::addLine(const std::string & theExternalName)
 {
-  // TODO(spo): Add constraint SketchConstraintRigid like in PythonAPI. Is it necessary?
   std::shared_ptr<ModelAPI_Feature> 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;
 }
 
 //--------------------------------------------------------------------------------------