support of backward compatibility to load old fem project files
This commit is contained in:
@@ -63,6 +63,19 @@ void FemAnalysis::onChanged(const Property* prop)
|
||||
App::DocumentObjectGroup::onChanged(prop);
|
||||
}
|
||||
|
||||
void FemAnalysis::handleChangedPropertyName(Base::XMLReader &reader,
|
||||
const char * TypeName,
|
||||
const char *PropName)
|
||||
{
|
||||
Base::Type type = Base::Type::fromName(TypeName);
|
||||
if (Group.getClassTypeId() == type && strcmp(PropName, "Member") == 0) {
|
||||
Group.Restore(reader);
|
||||
}
|
||||
else {
|
||||
App::DocumentObjectGroup::handleChangedPropertyName(reader, TypeName, PropName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Dummy class 'DocumentObject' in Fem namespace
|
||||
PROPERTY_SOURCE_ABSTRACT(Fem::DocumentObject, App::DocumentObject)
|
||||
@@ -75,6 +88,10 @@ PROPERTY_SOURCE_TEMPLATE(Fem::FemAnalysisPython, Fem::FemAnalysis)
|
||||
template<> const char* Fem::FemAnalysisPython::getViewProviderName(void) const {
|
||||
return "FemGui::ViewProviderFemAnalysisPython";
|
||||
}
|
||||
|
||||
template<> void Fem::FemAnalysisPython::Restore(Base::XMLReader& reader) {
|
||||
FemAnalysis::Restore(reader);
|
||||
}
|
||||
//template<> PyObject* Fem::FemAnalysisPython::getPyObject(void) {
|
||||
// if (PythonObject.is(Py::_None())) {
|
||||
// // ref counter is set to 1
|
||||
|
||||
@@ -60,6 +60,10 @@ public:
|
||||
protected:
|
||||
/// get called by the container when a property has changed
|
||||
virtual void onChanged (const App::Property* prop);
|
||||
/// Support of backward compatibility
|
||||
virtual void handleChangedPropertyName(Base::XMLReader &reader,
|
||||
const char * TypeName,
|
||||
const char *PropName);
|
||||
};
|
||||
|
||||
class AppFemExport DocumentObject : public App::DocumentObject
|
||||
|
||||
@@ -33,9 +33,7 @@ import FreeCAD
|
||||
########## analysis objects ##########
|
||||
def makeAnalysis(doc, name="Analysis"):
|
||||
'''makeAnalysis(document, [name]): makes a Fem Analysis object'''
|
||||
obj = doc.addObject("Fem::FemAnalysisPython", name)
|
||||
if FreeCAD.GuiUp:
|
||||
obj.ViewObject.Proxy = 0
|
||||
obj = doc.addObject("Fem::FemAnalysis", name)
|
||||
return obj
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user