diff --git a/src/Mod/PartDesign/App/FeatureChamfer.cpp b/src/Mod/PartDesign/App/FeatureChamfer.cpp index f594649e5f..81513332e1 100644 --- a/src/Mod/PartDesign/App/FeatureChamfer.cpp +++ b/src/Mod/PartDesign/App/FeatureChamfer.cpp @@ -196,38 +196,20 @@ App::DocumentObjectExecReturn *Chamfer::execute(void) void Chamfer::Restore(Base::XMLReader &reader) { - reader.readElement("Properties"); - int Cnt = reader.getAttributeAsInteger("Count"); + DressUp::Restore(reader); +} - for (int i=0 ;igetTypeId().getName(), TypeName) == 0) { - prop->Restore(reader); - } - else if (prop && strcmp(TypeName,"App::PropertyFloatConstraint") == 0 && - strcmp(prop->getTypeId().getName(), "App::PropertyQuantityConstraint") == 0) { - App::PropertyFloatConstraint p; - p.Restore(reader); - static_cast(prop)->setValue(p.getValue()); - } - } - catch (const Base::XMLParseException&) { - throw; // re-throw - } - catch (const Base::Exception &e) { - Base::Console().Error("%s\n", e.what()); - } - catch (const std::exception &e) { - Base::Console().Error("%s\n", e.what()); - } - reader.readEndElement("Property"); +void Chamfer::handleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, App::Property * prop) +{ + if (prop && strcmp(TypeName,"App::PropertyFloatConstraint") == 0 && + strcmp(prop->getTypeId().getName(), "App::PropertyQuantityConstraint") == 0) { + App::PropertyFloatConstraint p; + p.Restore(reader); + static_cast(prop)->setValue(p.getValue()); + } + else { + DressUp::handleChangedPropertyType(reader, TypeName, prop); } - reader.readEndElement("Properties"); } void Chamfer::onChanged(const App::Property* prop) diff --git a/src/Mod/PartDesign/App/FeatureChamfer.h b/src/Mod/PartDesign/App/FeatureChamfer.h index e36e708d1d..96536a777c 100644 --- a/src/Mod/PartDesign/App/FeatureChamfer.h +++ b/src/Mod/PartDesign/App/FeatureChamfer.h @@ -62,6 +62,7 @@ public: protected: void Restore(Base::XMLReader &reader) override; + void handleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, App::Property * prop) override; static const App::PropertyQuantityConstraint::Constraints floatSize; static const App::PropertyAngle::Constraints floatAngle; }; diff --git a/src/Mod/PartDesign/App/FeatureFillet.cpp b/src/Mod/PartDesign/App/FeatureFillet.cpp index 646d3fde59..96952fa2a4 100644 --- a/src/Mod/PartDesign/App/FeatureFillet.cpp +++ b/src/Mod/PartDesign/App/FeatureFillet.cpp @@ -134,36 +134,18 @@ App::DocumentObjectExecReturn *Fillet::execute(void) void Fillet::Restore(Base::XMLReader &reader) { - reader.readElement("Properties"); - int Cnt = reader.getAttributeAsInteger("Count"); - - for (int i=0 ;igetTypeId().getName(), TypeName) == 0) { - prop->Restore(reader); - } - else if (prop && strcmp(TypeName,"App::PropertyFloatConstraint") == 0 && - strcmp(prop->getTypeId().getName(), "App::PropertyQuantityConstraint") == 0) { - App::PropertyFloatConstraint p; - p.Restore(reader); - static_cast(prop)->setValue(p.getValue()); - } - } - catch (const Base::XMLParseException&) { - throw; // re-throw - } - catch (const Base::Exception &e) { - Base::Console().Error("%s\n", e.what()); - } - catch (const std::exception &e) { - Base::Console().Error("%s\n", e.what()); - } - reader.readEndElement("Property"); - } - reader.readEndElement("Properties"); + DressUp::Restore(reader); +} + +void Fillet::handleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, App::Property * prop) +{ + if (prop && strcmp(TypeName,"App::PropertyFloatConstraint") == 0 && + strcmp(prop->getTypeId().getName(), "App::PropertyQuantityConstraint") == 0) { + App::PropertyFloatConstraint p; + p.Restore(reader); + static_cast(prop)->setValue(p.getValue()); + } + else { + DressUp::handleChangedPropertyType(reader, TypeName, prop); + } } diff --git a/src/Mod/PartDesign/App/FeatureFillet.h b/src/Mod/PartDesign/App/FeatureFillet.h index 6637040049..e46b5b05bd 100644 --- a/src/Mod/PartDesign/App/FeatureFillet.h +++ b/src/Mod/PartDesign/App/FeatureFillet.h @@ -54,7 +54,7 @@ public: protected: void Restore(Base::XMLReader &reader); - + void handleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, App::Property * prop); }; } //namespace Part