+
+FeaturePtr SketchPlugin_Sketch::addUniqueNamedCopiedFeature(FeaturePtr theFeature,
+ SketchPlugin_Sketch* theSketch)
+{
+ FeaturePtr aNewFeature = theSketch->addFeature(theFeature->getKind());
+ // addFeature generates a unique name for the feature, it caches the name
+ std::string aUniqueFeatureName = aNewFeature->data()->name();
+ // all attribute values are copied\pasted to the new feature, name is not an exception
+ theFeature->data()->copyTo(aNewFeature->data());
+ // as a name for the feature, the generated unique name is set
+ aNewFeature->data()->setName(aUniqueFeatureName);
+ // text expressions could block setValue of some attributes
+ clearExpressions(aNewFeature);
+
+ return aNewFeature;
+}
+
+std::shared_ptr<GeomAPI_Ax3> SketchPlugin_Sketch::plane(SketchPlugin_Sketch* theSketch)
+{
+ std::shared_ptr<ModelAPI_Data> aData = theSketch->data();
+
+ std::shared_ptr<GeomDataAPI_Point> anOrigin = std::dynamic_pointer_cast<GeomDataAPI_Point>(
+ aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
+ std::shared_ptr<GeomDataAPI_Dir> aDirX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ aData->attribute(SketchPlugin_Sketch::DIRX_ID()));
+ std::shared_ptr<GeomDataAPI_Dir> aNorm = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ aData->attribute(SketchPlugin_Sketch::NORM_ID()));
+
+ return std::shared_ptr<GeomAPI_Ax3>(new GeomAPI_Ax3(anOrigin->pnt(), aDirX->dir(), aNorm->dir()));
+}