spend own type for Python wrappers of FeaturePrimitive and BodyBase
This commit is contained in:
@@ -30,10 +30,13 @@
|
||||
#include "DatumPoint.h"
|
||||
#include "DatumCS.h"
|
||||
#include <Mod/Part/App/modelRefine.h>
|
||||
#include <Mod/Part/App/PartFeaturePy.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/FeaturePythonPyImp.h>
|
||||
|
||||
#include <BRepPrimAPI_MakeBox.hxx>
|
||||
#include <BRepBuilderAPI_GTransform.hxx>
|
||||
#include <BRepAlgoAPI_Fuse.hxx>
|
||||
@@ -152,6 +155,18 @@ void FeaturePrimitive::onChanged(const App::Property* prop)
|
||||
FeatureAddSub::onChanged(prop);
|
||||
}
|
||||
|
||||
PYTHON_TYPE_DEF(PrimitivePy, Part::PartFeaturePy)
|
||||
PYTHON_TYPE_IMP(PrimitivePy, Part::PartFeaturePy)
|
||||
|
||||
PyObject* FeaturePrimitive::getPyObject()
|
||||
{
|
||||
if (PythonObject.is(Py::_None())){
|
||||
// ref counter is set to 1
|
||||
PythonObject = Py::Object(new PrimitivePy(this),true);
|
||||
}
|
||||
return Py::new_reference_to(PythonObject);
|
||||
}
|
||||
|
||||
PROPERTY_SOURCE(PartDesign::Box, PartDesign::FeaturePrimitive)
|
||||
|
||||
Box::Box()
|
||||
|
||||
@@ -54,14 +54,15 @@ public:
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "PartDesignGui::ViewProviderPrimitive";
|
||||
}
|
||||
Type getPrimitiveType() {return primitiveType;};
|
||||
Type getPrimitiveType() {return primitiveType;}
|
||||
TopoDS_Shape refineShapeIfActive(const TopoDS_Shape& oldShape) const;
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
virtual PyObject* getPyObject();
|
||||
|
||||
/// Do nothing, just to suppress warning, must be redefined in derived classes
|
||||
virtual App::DocumentObjectExecReturn* execute() {
|
||||
return PartDesign::FeatureAddSub::execute();
|
||||
};
|
||||
}
|
||||
protected:
|
||||
//make the boolean ops with the primitives provided by the derived features
|
||||
App::DocumentObjectExecReturn* execute(const TopoDS_Shape& primitiveShape);
|
||||
|
||||
Reference in New Issue
Block a user