Py functionality for Dimensions

This commit is contained in:
WandererFan 2016-01-27 11:27:31 -05:00 committed by wmayer
parent 0372b1e8aa
commit 40493d49db
5 changed files with 66 additions and 0 deletions

View File

@ -34,6 +34,7 @@ generate_from_xml(DrawParametricTemplatePy)
generate_from_xml(DrawSVGTemplatePy)
generate_from_xml(DrawViewSymbolPy)
generate_from_xml(DrawViewClipPy)
generate_from_xml(DrawViewDimensionPy)
SET(Draw_SRCS
DrawPage.cpp
@ -101,6 +102,8 @@ SET(Python_SRCS
DrawSVGTemplatePyImp.cpp
DrawViewClipPy.xml
DrawViewClipPyImp.cpp
DrawViewDimensionPy.xml
DrawViewDimensionPyImp.cpp
)
SOURCE_GROUP("Mod" FILES ${TechDraw_SRCS})

View File

@ -48,6 +48,8 @@
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
#include "DrawViewDimensionPy.h" // generated from DrawViewDimensionPy.xml
using namespace TechDraw;
//===========================================================================
@ -510,3 +512,12 @@ bool DrawViewDimension::hasReferences(void) const
}
return result;
}
PyObject *DrawViewDimension::getPyObject(void)
{
if (PythonObject.is(Py::_None())) {
// ref counter is set to 1
PythonObject = Py::Object(new DrawViewDimensionPy(this),true);
}
return Py::new_reference_to(PythonObject);
}

View File

@ -73,6 +73,8 @@ public:
virtual const char* getViewProviderName(void) const {
return "TechDrawGui::ViewProviderDimension";
}
//return PyObject as DrawViewDimensionPy
virtual PyObject *getPyObject(void);
virtual std::string getFormatedValue() const;
virtual double getDimValue() const;

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="DrawViewPy"
Name="DrawViewDimensionPy"
Twin="DrawViewDimension"
TwinPointer="DrawViewDimension"
Include="Mod/TechDraw/App/DrawViewDimension.h"
Namespace="TechDraw"
FatherInclude="Mod/TechDraw/App/DrawViewPy.h"
FatherNamespace="TechDraw">
<Documentation>
<Author Licence="LGPL" Name="WandererFan" EMail="wandererfan@gmail.com" />
<UserDocu>Feature for creating and manipulating Technical Drawing Dimensions</UserDocu>
</Documentation>
<CustomAttributes />
</PythonExport>
</GenerateModel>

View File

@ -0,0 +1,32 @@
#include "PreCompiled.h"
#include "Mod/TechDraw/App/DrawViewDimension.h"
// inclusion of the generated files (generated out of DrawViewDimensionPy.xml)
#include "DrawViewDimensionPy.h"
#include "DrawViewDimensionPy.cpp"
using namespace TechDraw;
// returns a string which represents the object e.g. when printed in python
std::string DrawViewDimensionPy::representation(void) const
{
return std::string("<DrawViewDimension object>");
}
PyObject *DrawViewDimensionPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
}
int DrawViewDimensionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
}