From 8a7525f620db88dbd8082b44641f5d905e6c43bb Mon Sep 17 00:00:00 2001 From: DeepSOIC Date: Wed, 11 Apr 2018 18:21:23 +0300 Subject: [PATCH] PartDesign: fix #2758 Datum Point persistence, again --- src/Mod/PartDesign/App/DatumPoint.cpp | 8 +++++--- src/Mod/PartDesign/App/DatumPoint.h | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Mod/PartDesign/App/DatumPoint.cpp b/src/Mod/PartDesign/App/DatumPoint.cpp index 297d562769..5a65f09a64 100644 --- a/src/Mod/PartDesign/App/DatumPoint.cpp +++ b/src/Mod/PartDesign/App/DatumPoint.cpp @@ -99,12 +99,12 @@ void Point::onChanged(const App::Property* prop) Superclass::onChanged(prop); } -void Point::Restore(Base::XMLReader& r) +void Point::onDocumentRestored() { - Superclass::Restore(r); //fix for #0002758 Datum point moves to (0,0,0) when reopening the file. //recreate shape, as the restored one has old Placement burned into it. this->makeShape(); + Superclass::onDocumentRestored(); } void Point::makeShape() @@ -114,7 +114,9 @@ void Point::makeShape() BRepBuilderAPI_MakeVertex builder(gp_Pnt(0,0,0)); if (!builder.IsDone()) return; - Shape.setValue(builder.Shape()); + Part::TopoShape tshape(builder.Shape()); + tshape.setPlacement(this->Placement.getValue()); + Shape.setValue(tshape); } Base::Vector3d Point::getPoint() diff --git a/src/Mod/PartDesign/App/DatumPoint.h b/src/Mod/PartDesign/App/DatumPoint.h index 19dfdbeb41..e00cf6434e 100644 --- a/src/Mod/PartDesign/App/DatumPoint.h +++ b/src/Mod/PartDesign/App/DatumPoint.h @@ -50,9 +50,11 @@ public: protected: virtual void onChanged(const App::Property* prop); - virtual void Restore(Base::XMLReader& r); + virtual void onDocumentRestored() override; + private: void makeShape(); + }; } //namespace PartDesign