diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.cpp b/src/Mod/PartDesign/App/FeatureSketchBased.cpp index a0db850e05..05a7fc77b3 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.cpp +++ b/src/Mod/PartDesign/App/FeatureSketchBased.cpp @@ -1196,57 +1196,32 @@ Base::Vector3d ProfileBased::getProfileNormal() const { return SketchVector; } - -void ProfileBased::Restore(Base::XMLReader& reader) { - - reader.readElement("Properties"); - int Cnt = reader.getAttributeAsInteger("Count"); - - for (int i=0 ;i vec; - // read my element - reader.readElement("Link"); - // get the value of my attribute - std::string name = reader.getAttribute("value"); - - if (name != "") { - App::Document* document = getDocument(); - DocumentObject* object = document ? document->getObject(name.c_str()) : 0; - Profile.setValue(object, vec); - } - else { - Profile.setValue(0, vec); - } - } - else if (prop && strcmp(prop->getTypeId().getName(), TypeName) == 0) - prop->Restore(reader); - } - 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()); - } - catch (const char* e) { - Base::Console().Error("%s\n", e); - } - - reader.readEndElement("Property"); - } - reader.readEndElement("Properties"); +void ProfileBased::Restore(Base::XMLReader& reader) +{ + PartDesign::FeatureAddSub::Restore(reader); +} + +void ProfileBased::handleChangedPropertyName(Base::XMLReader &reader, const char * TypeName, const char *PropName) +{ + //check if we load the old sketch property + if ((strcmp("Sketch", PropName) == 0) && (strcmp("App::PropertyLink", TypeName) == 0)) { + + std::vector vec; + // read my element + reader.readElement("Link"); + // get the value of my attribute + std::string name = reader.getAttribute("value"); + + if (name != "") { + App::Document* document = getDocument(); + DocumentObject* object = document ? document->getObject(name.c_str()) : 0; + Profile.setValue(object, vec); + } + else { + Profile.setValue(0, vec); + } + } + else { + PartDesign::FeatureAddSub::handleChangedPropertyName(reader, TypeName, PropName); + } } diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.h b/src/Mod/PartDesign/App/FeatureSketchBased.h index 17a5659287..bf3c1964d1 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.h +++ b/src/Mod/PartDesign/App/FeatureSketchBased.h @@ -112,6 +112,7 @@ public: //backwards compatibility: profile property was renamed and has different type now virtual void Restore(Base::XMLReader& reader); + virtual void handleChangedPropertyName(Base::XMLReader &reader, const char * TypeName, const char *PropName); // calculate the through all length double getThroughAllLength() const;