X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Sketch.cpp;h=12ec6c4f9711c03d16e1a47dc66342d22c6a12ae;hb=8476d5e088f7b1b5a414fa5e33ce99d6131929eb;hp=a63344e58fda66b21299919bd574339b87b9fcad;hpb=42985955d89fa845790a7e38609f5b6838285147;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Sketch.cpp b/src/SketchPlugin/SketchPlugin_Sketch.cpp index a63344e58..12ec6c4f9 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.cpp +++ b/src/SketchPlugin/SketchPlugin_Sketch.cpp @@ -133,7 +133,12 @@ std::shared_ptr SketchPlugin_Sketch::addFeature(std::string th { std::shared_ptr aNew = document()->addFeature(theID, false); if (aNew) { - std::dynamic_pointer_cast(aNew)->setSketch(this); + // the sketch cannot be specified for the macro-features defined in python + // like SketchRectangle, so we need to check the type of new feature + std::shared_ptr aSketchFeature = + std::dynamic_pointer_cast(aNew); + if (aSketchFeature) + aSketchFeature->setSketch(this); data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->append(aNew); } // set as current also after it becomes sub to set correctly enabled for other sketch subs @@ -297,7 +302,8 @@ void SketchPlugin_Sketch::createPoint2DResult(ModelAPI_Feature* theFeature, } FeaturePtr SketchPlugin_Sketch::addUniqueNamedCopiedFeature(FeaturePtr theFeature, - SketchPlugin_Sketch* theSketch) + SketchPlugin_Sketch* theSketch, + const bool theIsCopy) { FeaturePtr aNewFeature = theSketch->addFeature(theFeature->getKind()); // addFeature generates a unique name for the feature, it caches the name @@ -308,6 +314,11 @@ FeaturePtr SketchPlugin_Sketch::addUniqueNamedCopiedFeature(FeaturePtr theFeatur aNewFeature->data()->setName(aUniqueFeatureName); // text expressions could block setValue of some attributes SketchPlugin_Tools::clearExpressions(aNewFeature); + // Set copy attribute + AttributeBooleanPtr anAttr = aNewFeature->data()->boolean(SketchPlugin_SketchEntity::COPY_ID()); + if(anAttr.get()) { + anAttr->setValue(theIsCopy); + } return aNewFeature; }