Make Fem::Analyses object inheritable to python and some fixes in Material
This commit is contained in:
parent
1b7acb839b
commit
bd6dc08a1b
|
@ -52,13 +52,6 @@ PROPERTY_SOURCE_TEMPLATE(App::MaterialObjectPython, App::MaterialObject)
|
||||||
template<> const char* App::MaterialObjectPython::getViewProviderName(void) const {
|
template<> const char* App::MaterialObjectPython::getViewProviderName(void) const {
|
||||||
return "Gui::ViewProviderMaterialObjectPython";
|
return "Gui::ViewProviderMaterialObjectPython";
|
||||||
}
|
}
|
||||||
template<> PyObject* App::MaterialObjectPython::getPyObject(void) {
|
|
||||||
if (PythonObject.is(Py::_None())) {
|
|
||||||
// ref counter is set to 1
|
|
||||||
PythonObject = Py::Object(new App::DocumentObjectPy(this),true);
|
|
||||||
}
|
|
||||||
return Py::new_reference_to(PythonObject);
|
|
||||||
}
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
// explicit template instantiation
|
// explicit template instantiation
|
||||||
|
|
|
@ -114,6 +114,7 @@ void AppFemExport initFem()
|
||||||
// This function is responsible for adding inherited slots from a type's base class.
|
// This function is responsible for adding inherited slots from a type's base class.
|
||||||
|
|
||||||
Fem::FemAnalysis ::init();
|
Fem::FemAnalysis ::init();
|
||||||
|
Fem::FemAnalysisPython ::init();
|
||||||
Fem::FemMesh ::init();
|
Fem::FemMesh ::init();
|
||||||
Fem::FemMeshObject ::init();
|
Fem::FemMeshObject ::init();
|
||||||
Fem::FemMeshShapeObject ::init();
|
Fem::FemMeshShapeObject ::init();
|
||||||
|
|
|
@ -66,3 +66,26 @@ void FemAnalysis::onChanged(const Property* prop)
|
||||||
{
|
{
|
||||||
App::DocumentObject::onChanged(prop);
|
App::DocumentObject::onChanged(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Python feature ---------------------------------------------------------
|
||||||
|
|
||||||
|
namespace App {
|
||||||
|
/// @cond DOXERR
|
||||||
|
PROPERTY_SOURCE_TEMPLATE(Fem::FemAnalysisPython, Fem::FemAnalysis)
|
||||||
|
template<> const char* Fem::FemAnalysisPython::getViewProviderName(void) const {
|
||||||
|
return "FemGui::ViewProviderFemAnalysisPython";
|
||||||
|
}
|
||||||
|
//template<> PyObject* Fem::FemAnalysisPython::getPyObject(void) {
|
||||||
|
// if (PythonObject.is(Py::_None())) {
|
||||||
|
// // ref counter is set to 1
|
||||||
|
// PythonObject = Py::Object(new App::DocumentObjectPy(this),true);
|
||||||
|
// }
|
||||||
|
// return Py::new_reference_to(PythonObject);
|
||||||
|
//}
|
||||||
|
/// @endcond
|
||||||
|
|
||||||
|
// explicit template instantiation
|
||||||
|
template class AppFemExport FeaturePythonT<Fem::FemAnalysis>;
|
||||||
|
}
|
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
#include <App/DocumentObject.h>
|
#include <App/DocumentObject.h>
|
||||||
#include <App/PropertyLinks.h>
|
#include <App/PropertyLinks.h>
|
||||||
|
#include <App/FeaturePython.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fem
|
namespace Fem
|
||||||
|
@ -62,6 +64,9 @@ protected:
|
||||||
virtual void onChanged (const App::Property* prop);
|
virtual void onChanged (const App::Property* prop);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef App::FeaturePythonT<FemAnalysis> FemAnalysisPython;
|
||||||
|
|
||||||
|
|
||||||
} //namespace Fem
|
} //namespace Fem
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,8 @@ void FemGuiExport initFemGui()
|
||||||
|
|
||||||
// addition objects
|
// addition objects
|
||||||
FemGui::Workbench ::init();
|
FemGui::Workbench ::init();
|
||||||
FemGui::ViewProviderAnalysis ::init();
|
FemGui::ViewProviderFemAnalysis ::init();
|
||||||
|
FemGui::ViewProviderFemAnalysisPython ::init();
|
||||||
FemGui::ViewProviderFemMesh ::init();
|
FemGui::ViewProviderFemMesh ::init();
|
||||||
FemGui::ViewProviderFemMeshShape ::init();
|
FemGui::ViewProviderFemMeshShape ::init();
|
||||||
FemGui::ViewProviderFemMeshShapeNetgen ::init();
|
FemGui::ViewProviderFemMeshShapeNetgen ::init();
|
||||||
|
|
|
@ -45,21 +45,21 @@ using namespace FemGui;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PROPERTY_SOURCE(FemGui::ViewProviderAnalysis, Gui::ViewProviderDocumentObject)
|
PROPERTY_SOURCE(FemGui::ViewProviderFemAnalysis, Gui::ViewProviderDocumentObject)
|
||||||
|
|
||||||
|
|
||||||
ViewProviderAnalysis::ViewProviderAnalysis()
|
ViewProviderFemAnalysis::ViewProviderFemAnalysis()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewProviderAnalysis::~ViewProviderAnalysis()
|
ViewProviderFemAnalysis::~ViewProviderFemAnalysis()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ViewProviderAnalysis::doubleClicked(void)
|
bool ViewProviderFemAnalysis::doubleClicked(void)
|
||||||
{
|
{
|
||||||
Gui::Command::assureWorkbench("FemWorkbench");
|
Gui::Command::assureWorkbench("FemWorkbench");
|
||||||
Gui::Command::addModule(Gui::Command::Gui,"FemGui");
|
Gui::Command::addModule(Gui::Command::Gui,"FemGui");
|
||||||
|
@ -67,21 +67,21 @@ bool ViewProviderAnalysis::doubleClicked(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<App::DocumentObject*> ViewProviderAnalysis::claimChildren(void)const
|
std::vector<App::DocumentObject*> ViewProviderFemAnalysis::claimChildren(void)const
|
||||||
{
|
{
|
||||||
std::vector<App::DocumentObject*> temp(static_cast<Fem::FemAnalysis*>(getObject())->Member.getValues());
|
std::vector<App::DocumentObject*> temp(static_cast<Fem::FemAnalysis*>(getObject())->Member.getValues());
|
||||||
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
//std::vector<App::DocumentObject*> ViewProviderAnalysis::claimChildren3D(void)const
|
//std::vector<App::DocumentObject*> ViewProviderFemAnalysis::claimChildren3D(void)const
|
||||||
//{
|
//{
|
||||||
//
|
//
|
||||||
// //return static_cast<Assembly::ConstraintGroup*>(getObject())->Constraints.getValues();
|
// //return static_cast<Assembly::ConstraintGroup*>(getObject())->Constraints.getValues();
|
||||||
// return std::vector<App::DocumentObject*> ();
|
// return std::vector<App::DocumentObject*> ();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
void ViewProviderAnalysis::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
|
void ViewProviderFemAnalysis::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
|
||||||
{
|
{
|
||||||
//QAction* act;
|
//QAction* act;
|
||||||
//act = menu->addAction(QObject::tr("Edit pad"), receiver, member);
|
//act = menu->addAction(QObject::tr("Edit pad"), receiver, member);
|
||||||
|
@ -89,7 +89,7 @@ void ViewProviderAnalysis::setupContextMenu(QMenu* menu, QObject* receiver, cons
|
||||||
//PartGui::ViewProviderPart::setupContextMenu(menu, receiver, member);
|
//PartGui::ViewProviderPart::setupContextMenu(menu, receiver, member);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ViewProviderAnalysis::setEdit(int ModNum)
|
bool ViewProviderFemAnalysis::setEdit(int ModNum)
|
||||||
{
|
{
|
||||||
if (ModNum == ViewProvider::Default ) {
|
if (ModNum == ViewProvider::Default ) {
|
||||||
//// When double-clicking on the item for this pad the
|
//// When double-clicking on the item for this pad the
|
||||||
|
@ -128,7 +128,7 @@ bool ViewProviderAnalysis::setEdit(int ModNum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewProviderAnalysis::unsetEdit(int ModNum)
|
void ViewProviderFemAnalysis::unsetEdit(int ModNum)
|
||||||
{
|
{
|
||||||
if (ModNum == ViewProvider::Default) {
|
if (ModNum == ViewProvider::Default) {
|
||||||
// when pressing ESC make sure to close the dialog
|
// when pressing ESC make sure to close the dialog
|
||||||
|
@ -139,7 +139,7 @@ void ViewProviderAnalysis::unsetEdit(int ModNum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ViewProviderAnalysis::onDelete(const std::vector<std::string> &)
|
bool ViewProviderFemAnalysis::onDelete(const std::vector<std::string> &)
|
||||||
{
|
{
|
||||||
//// get the support and Sketch
|
//// get the support and Sketch
|
||||||
//PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(getObject());
|
//PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(getObject());
|
||||||
|
@ -158,3 +158,14 @@ bool ViewProviderAnalysis::onDelete(const std::vector<std::string> &)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Python feature -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Gui {
|
||||||
|
/// @cond DOXERR
|
||||||
|
PROPERTY_SOURCE_TEMPLATE(FemGui::ViewProviderFemAnalysisPython, FemGui::ViewProviderFemAnalysis)
|
||||||
|
/// @endcond
|
||||||
|
|
||||||
|
// explicit template instantiation
|
||||||
|
template class FemGuiExport ViewProviderPythonFeatureT<ViewProviderFemAnalysis>;
|
||||||
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include <Gui/ViewProviderGeometryObject.h>
|
#include <Gui/ViewProviderGeometryObject.h>
|
||||||
#include <Gui/ViewProviderBuilder.h>
|
#include <Gui/ViewProviderBuilder.h>
|
||||||
|
#include <Gui/ViewProviderPythonFeature.h>
|
||||||
|
|
||||||
class SoCoordinate3;
|
class SoCoordinate3;
|
||||||
class SoDrawStyle;
|
class SoDrawStyle;
|
||||||
|
@ -39,16 +40,16 @@ namespace FemGui
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class FemGuiExport ViewProviderAnalysis : public Gui::ViewProviderDocumentObject
|
class FemGuiExport ViewProviderFemAnalysis : public Gui::ViewProviderDocumentObject
|
||||||
{
|
{
|
||||||
PROPERTY_HEADER(FemGui::ViewProviderAnalysis);
|
PROPERTY_HEADER(FemGui::ViewProviderAnalysis);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// constructor.
|
/// constructor.
|
||||||
ViewProviderAnalysis();
|
ViewProviderFemAnalysis();
|
||||||
|
|
||||||
/// destructor.
|
/// destructor.
|
||||||
~ViewProviderAnalysis();
|
~ViewProviderFemAnalysis();
|
||||||
|
|
||||||
virtual bool doubleClicked(void);
|
virtual bool doubleClicked(void);
|
||||||
|
|
||||||
|
@ -65,6 +66,8 @@ protected:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef Gui::ViewProviderPythonFeatureT<ViewProviderFemAnalysis> ViewProviderFemAnalysisPython;
|
||||||
|
|
||||||
} //namespace FemGui
|
} //namespace FemGui
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user