+ make FEM beam section and shell thickness ready for drag and drop

This commit is contained in:
wmayer 2015-10-19 14:48:07 +02:00
parent eff27994e5
commit 861dc86093
6 changed files with 28 additions and 3 deletions

View File

@ -118,6 +118,7 @@ void AppFemExport initFem()
Fem::FemAnalysis ::init();
Fem::FemAnalysisPython ::init();
Fem::FeaturePython ::init();
Fem::FemMesh ::init();
Fem::FemMeshObject ::init();
Fem::FemMeshShapeObject ::init();

View File

@ -28,6 +28,7 @@
#include "FemAnalysis.h"
#include <App/DocumentObjectPy.h>
#include <App/FeaturePythonPyImp.h>
#include <Base/Placement.h>
#include <Base/Uuid.h>
@ -88,4 +89,24 @@ template<> const char* Fem::FemAnalysisPython::getViewProviderName(void) const {
// explicit template instantiation
template class AppFemExport FeaturePythonT<Fem::FemAnalysis>;
}
}
// ---------------------------------------------------------
namespace App {
/// @cond DOXERR
PROPERTY_SOURCE_TEMPLATE(Fem::FeaturePython, App::DocumentObject)
template<> const char* Fem::FeaturePython::getViewProviderName(void) const {
return "Gui::ViewProviderPythonFeature";
}
template<> PyObject* Fem::FeaturePython::getPyObject(void) {
if (PythonObject.is(Py::_None())) {
// ref counter is set to 1
PythonObject = Py::Object(new App::FeaturePythonPyT<App::DocumentObjectPy>(this),true);
}
return Py::new_reference_to(PythonObject);
}
// explicit template instantiation
template class AppFemExport FeaturePythonT<App::DocumentObject>;
/// @endcond
}

View File

@ -65,6 +65,7 @@ protected:
};
typedef App::FeaturePythonT<FemAnalysis> FemAnalysisPython;
typedef App::FeaturePythonT<App::DocumentObject> FeaturePython;
} //namespace Fem

View File

@ -37,7 +37,7 @@ __url__ = "http://www.freecadweb.org"
def makeFemBeamSection(width=20.0, height=20.0, name="BeamSection"):
'''makeFemBeamSection([width], [height], [name]): creates an beamsection object to define a cross section'''
obj = FemGui.getActiveAnalysis().Document.addObject("App::FeaturePython", name)
obj = FemGui.getActiveAnalysis().Document.addObject("Fem::FeaturePython", name)
_FemBeamSection(obj)
obj.Width = width
obj.Height = height

View File

@ -37,7 +37,7 @@ __url__ = "http://www.freecadweb.org"
def makeFemShellThickness(thickness=20.0, name="ShellThickness"):
'''makeFemShellThickness([thickness], [name]): creates an shellthickness object to define a plate thickness'''
obj = FemGui.getActiveAnalysis().Document.addObject("App::FeaturePython", name)
obj = FemGui.getActiveAnalysis().Document.addObject("Fem::FeaturePython", name)
_FemShellThickness(obj)
obj.Thickness = thickness
if FreeCAD.GuiUp:

View File

@ -175,6 +175,8 @@ bool ViewProviderFemAnalysis::canDragObject(App::DocumentObject* obj) const
return true;
else if (obj->getTypeId().isDerivedFrom(Fem::FemSetObject::getClassTypeId()))
return true;
else if (obj->getTypeId().isDerivedFrom(Base::Type::fromName("Fem::FeaturePython")))
return true;
else if (obj->getTypeId().isDerivedFrom(App::MaterialObject::getClassTypeId()))
return true;
else