diff --git a/src/App/Document.cpp b/src/App/Document.cpp index d70734bfa..1b9879ee6 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -1529,6 +1529,7 @@ DocumentObject* Document::_copyObject(DocumentObject* obj, std::maponFinishDuplicating(); copy->purgeTouched(); return copy; } diff --git a/src/App/DocumentObject.h b/src/App/DocumentObject.h index 48c3f6751..70a91ffe1 100644 --- a/src/App/DocumentObject.h +++ b/src/App/DocumentObject.h @@ -181,6 +181,8 @@ protected: virtual void onChanged(const Property* prop); /// get called after a document has been fully restored virtual void onDocumentRestored() {} + /// get called after duplicating an object + virtual void onFinishDuplicating() {} /// python object of this class and all descendend protected: // attributes diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 330ff5ca6..95aa455a7 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -1441,6 +1441,13 @@ void SketchObject::onDocumentRestored() } } +void SketchObject::onFinishDuplicating() +{ + Constraints.acceptGeometry(getCompleteGeometry()); + rebuildVertexIndex(); + onDocumentRestored(); +} + void SketchObject::getGeoVertexIndex(int VertexId, int &GeoId, PointPos &PosId) { if (VertexId < 0 || VertexId >= int(VertexId2GeoId.size())) { diff --git a/src/Mod/Sketcher/App/SketchObject.h b/src/Mod/Sketcher/App/SketchObject.h index eef799bf7..83802d83a 100644 --- a/src/Mod/Sketcher/App/SketchObject.h +++ b/src/Mod/Sketcher/App/SketchObject.h @@ -152,6 +152,7 @@ protected: /// get called by the container when a property has changed virtual void onChanged(const App::Property* /*prop*/); virtual void onDocumentRestored(); + virtual void onFinishDuplicating(); private: std::vector ExternalGeo;