]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Add setFillet, setHorizontal, setRigid, setVertical constraints
authorspo <sergey.pokhodenko@opencascade.com>
Wed, 15 Jun 2016 08:08:53 +0000 (11:08 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 17 Jun 2016 11:41:08 +0000 (14:41 +0300)
src/SketchAPI/SketchAPI_Sketch.cpp
src/SketchAPI/SketchAPI_Sketch.h

index 27ba10f6332f3a2cb93d1020ddbb0ea2fb1fb6af..e13b203c2e059488cd6a2db5e04f85e37019ff23 100644 (file)
@@ -243,6 +243,28 @@ std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setDistance(
   return aFeature;
 }
 
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setFillet(
+    const std::list<ModelHighAPI_RefAttr> & thePoints,
+    const ModelHighAPI_Double & theRadius)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature =
+      compositeFeature()->addFeature(SketchPlugin_ConstraintFillet::ID());
+  fillAttribute(thePoints, aFeature->data()->refattrlist(SketchPlugin_Constraint::ENTITY_A()));
+  fillAttribute(theRadius, aFeature->real(SketchPlugin_Constraint::VALUE()));
+  aFeature->execute();
+  return aFeature;
+}
+
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setHorizontal(
+    const ModelHighAPI_RefAttr & theLine)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature =
+      compositeFeature()->addFeature(SketchPlugin_ConstraintHorizontal::ID());
+  fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+  aFeature->execute();
+  return aFeature;
+}
+
 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setLength(
     const ModelHighAPI_RefAttr & theLine,
     const ModelHighAPI_Double & theValue)
@@ -278,4 +300,25 @@ std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setPerpendicular(
   aFeature->execute();
   return aFeature;
 }
+
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setRigid(
+    const ModelHighAPI_RefAttr & theObject)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature =
+      compositeFeature()->addFeature(SketchPlugin_ConstraintRigid::ID());
+  fillAttribute(theObject, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+  aFeature->execute();
+  return aFeature;
+}
+
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setVertical(
+    const ModelHighAPI_RefAttr & theLine)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature =
+      compositeFeature()->addFeature(SketchPlugin_ConstraintVertical::ID());
+  fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+  aFeature->execute();
+  return aFeature;
+}
+
 //--------------------------------------------------------------------------------------
index fdbaca992816cf99f550f31ba8540dea09ed2ac0..53e234cf021f3905f55234046018d516e540373d 100644 (file)
@@ -127,6 +127,17 @@ public:
       const ModelHighAPI_RefAttr & theLine,
       const ModelHighAPI_Double & theValue);
 
+  /// Set fillet
+  SKETCHAPI_EXPORT
+  std::shared_ptr<ModelAPI_Feature> setFillet(
+      const std::list<ModelHighAPI_RefAttr> & thePoints,
+      const ModelHighAPI_Double & theRadius);
+
+  /// Set horizontal
+  SKETCHAPI_EXPORT
+  std::shared_ptr<ModelAPI_Feature> setHorizontal(
+      const ModelHighAPI_RefAttr & theLine);
+
   /// Set length
   SKETCHAPI_EXPORT
   std::shared_ptr<ModelAPI_Feature> setLength(
@@ -145,6 +156,16 @@ public:
       const ModelHighAPI_RefAttr & theLine1,
       const ModelHighAPI_RefAttr & theLine2);
 
+  /// Set rigid
+  SKETCHAPI_EXPORT
+  std::shared_ptr<ModelAPI_Feature> setRigid(
+      const ModelHighAPI_RefAttr & theObject);
+
+  /// Set vertical
+  SKETCHAPI_EXPORT
+  std::shared_ptr<ModelAPI_Feature> setVertical(
+      const ModelHighAPI_RefAttr & theLine);
+
   // TODO(spo): set* (constraints)
 
   // TODO(spo): addMirror