]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/PartSet/PartSet_Tools.cpp
Salome HOME
Merge branch 'Pre_2.8.0_development'
[modules/shaper.git] / src / PartSet / PartSet_Tools.cpp
index 2b5315a8fbcd79168330f5626f9eb962a44b3028..2a5f0f08d0ee6ed45326ecb64c9e6f68b10cfce3 100755 (executable)
@@ -905,3 +905,29 @@ bool PartSet_Tools::isAuxiliarySketchEntity(const ObjectPtr& theObject)
 
   return isAuxiliaryFeature;
 }
+
+
+ResultPtr PartSet_Tools::createFixedByExternalCenter(
+    const ObjectPtr& theObject,
+    const std::shared_ptr<GeomAPI_Edge>& theEdge,
+    ModelAPI_AttributeSelection::CenterType theType,
+    const CompositeFeaturePtr& theSketch,
+    bool theTemporary)
+{
+  FeaturePtr aMyFeature = theSketch->addFeature(SketchPlugin_Point::ID());
+
+  if (aMyFeature) {
+    DataPtr aData = aMyFeature->data();
+    AttributeSelectionPtr anAttr =
+        std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
+        (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
+
+    ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+    if (anAttr.get() && aRes.get()) {
+      anAttr->setValueCenter(aRes, theEdge, theType, theTemporary);
+      aMyFeature->execute();
+      return aMyFeature->lastResult();
+    }
+  }
+  return ResultPtr();
+}