Base: add Precision class

and move the Python binding from Part to Base module
This commit is contained in:
wmayer
2022-07-30 17:10:56 +02:00
parent 3811685826
commit bd5ef26536
6 changed files with 15 additions and 11 deletions

View File

@@ -70,6 +70,7 @@
#include <Base/Parameter.h>
#include <Base/Persistence.h>
#include <Base/PlacementPy.h>
#include <Base/PrecisionPy.h>
#include <Base/RotationPy.h>
#include <Base/Sequencer.h>
#include <Base/Tools.h>
@@ -301,6 +302,7 @@ void Application::setupPythonTypes()
Base::Interpreter().addType(&Base::AxisPy ::Type,pBaseModule,"Axis");
Base::Interpreter().addType(&Base::CoordinateSystemPy::Type,pBaseModule,"CoordinateSystem");
Base::Interpreter().addType(&Base::TypePy ::Type,pBaseModule,"TypeId");
Base::Interpreter().addType(&Base::PrecisionPy ::Type,pBaseModule,"Precision");
Base::Interpreter().addType(&App::MaterialPy::Type, pAppModule, "Material");
Base::Interpreter().addType(&App::MetadataPy::Type, pAppModule, "Metadata");

View File

@@ -89,6 +89,7 @@ generate_from_xml(PlacementPy)
generate_from_xml(AxisPy)
generate_from_xml(UnitPy)
generate_from_xml(QuantityPy)
generate_from_xml(PrecisionPy)
generate_from_any(Parameter.xsd Parameter.inl xmlSchemeString)
if(SWIG_FOUND)
@@ -175,6 +176,7 @@ SET(FreeCADBase_XML_SRCS
QuantityPy.xml
TypePy.xml
UnitPy.xml
PrecisionPy.xml
)
SOURCE_GROUP("XML" FILES ${FreeCADBase_XML_SRCS})
@@ -250,6 +252,7 @@ SET(FreeCADBase_CPP_SRCS
PersistencePyImp.cpp
Placement.cpp
PlacementPyImp.cpp
PrecisionPyImp.cpp
PyExport.cpp
PyObjectBase.cpp
QtTools.cpp
@@ -313,6 +316,7 @@ SET(FreeCADBase_HPP_SRCS
Parameter.h
Persistence.h
Placement.h
Precision.h
PyExport.h
PyObjectBase.h
QtTools.h

View File

@@ -3,17 +3,17 @@
<PythonExport
Father="PyObjectBase"
Name="PrecisionPy"
PythonName="Part.Precision"
PythonName="Base.Precision"
Twin="Precision"
TwinPointer="Precision"
Include="Precision.hxx"
Namespace="Part"
Include="Base/Precision.h"
Namespace="Base"
FatherInclude="Base/PyObjectBase.h"
FatherNamespace="Base">
<Documentation>
<Author Licence="LGPL" Name="Werner Mayer" EMail="wmayer@users.sourceforge.net" />
<DeveloperDocu>This is the Type class</DeveloperDocu>
<UserDocu>This is the Type class</UserDocu>
<DeveloperDocu>This is the Precision class</DeveloperDocu>
<UserDocu>This is the Precision class</UserDocu>
</Documentation>
<Methode Name="angular" Static="true">
<Documentation>

View File

@@ -26,7 +26,8 @@
#include "PrecisionPy.cpp"
using namespace Part;
using Base::Precision;
using Base::PrecisionPy;
// returns a string which represents the object e.g. when printed in python

View File

@@ -34,6 +34,7 @@
#include <Base/ExceptionFactory.h>
#include <Base/Interpreter.h>
#include <Base/Parameter.h>
#include <Base/PrecisionPy.h>
#include "ArcOfCirclePy.h"
#include "ArcOfConicPy.h"
@@ -107,7 +108,6 @@
#include "PlanePy.h"
#include "PlateSurfacePy.h"
#include "PointPy.h"
#include "PrecisionPy.h"
#include "PrimitiveFeature.h"
#include "RectangularTrimmedSurfacePy.h"
#include "SpherePy.h"
@@ -315,7 +315,7 @@ PyMOD_INIT_FUNC(Part)
Base::Interpreter().addType(&Part::GeometryStringExtensionPy ::Type,partModule,"GeometryStringExtension");
Base::Interpreter().addType(&Part::GeometryBoolExtensionPy ::Type,partModule,"GeometryBoolExtension");
Base::Interpreter().addType(&Part::GeometryDoubleExtensionPy ::Type,partModule,"GeometryDoubleExtension");
Base::Interpreter().addType(&Part::PrecisionPy ::Type,partModule,"Precision");
Base::Interpreter().addType(&Base::PrecisionPy ::Type,partModule,"Precision");
// BRepFeat package
PyObject* brepfeatModule(module.getAttr("BRepFeat").ptr());

View File

@@ -91,7 +91,6 @@ generate_from_xml(TopoShapeVertexPy)
generate_from_xml(TopoShapeWirePy)
generate_from_xml(BRepOffsetAPI_MakePipeShellPy)
generate_from_xml(BRepOffsetAPI_MakeFillingPy)
generate_from_xml(PrecisionPy)
# make sure to create the directory at configure time
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/BRepFeat)
@@ -343,8 +342,6 @@ SET(Python_SRCS
BRepOffsetAPI_MakePipeShellPyImp.cpp
BRepOffsetAPI_MakeFillingPy.xml
BRepOffsetAPI_MakeFillingPyImp.cpp
PrecisionPy.xml
PrecisionPyImp.cpp
PartPyCXX.cpp
PartPyCXX.h
)