Part: [skip ci] harmonizing the way to add sub-modules to Part module

This commit is contained in:
wmayer
2020-10-10 11:44:51 +02:00
parent d76124b61e
commit 12155f4aab
2 changed files with 31 additions and 26 deletions

View File

@@ -376,34 +376,13 @@ PyMOD_INIT_FUNC(Part)
Base::Interpreter().addType(&Part::GeometryBoolExtensionPy ::Type,partModule,"GeometryBoolExtension");
Base::Interpreter().addType(&Part::GeometryDoubleExtensionPy ::Type,partModule,"GeometryDoubleExtension");
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef BRepOffsetAPIDef = {
PyModuleDef_HEAD_INIT,
"BRepOffsetAPI", "BRepOffsetAPI", -1, 0,
NULL, NULL, NULL, NULL
};
PyObject* brepModule = PyModule_Create(&BRepOffsetAPIDef);
#else
PyObject* brepModule = Py_InitModule3("BRepOffsetAPI", 0, "BrepOffsetAPI");
#endif
Py_INCREF(brepModule);
PyModule_AddObject(partModule, "BRepOffsetAPI", brepModule);
Base::Interpreter().addType(&Part::BRepOffsetAPI_MakePipeShellPy::Type,brepModule,"MakePipeShell");
Base::Interpreter().addType(&Part::BRepOffsetAPI_MakeFillingPy::Type,brepModule,"MakeFilling");
// BRepOffsetAPI package
PyObject* brepOffsetApiModule(module.getAttr("BRepOffsetAPI").ptr());
Base::Interpreter().addType(&Part::BRepOffsetAPI_MakePipeShellPy::Type,brepOffsetApiModule,"MakePipeShell");
Base::Interpreter().addType(&Part::BRepOffsetAPI_MakeFillingPy::Type,brepOffsetApiModule,"MakeFilling");
// Geom2d package
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef geom2dDef = {
PyModuleDef_HEAD_INIT,
"Geom2dD", "Geom2d", -1, 0,
NULL, NULL, NULL, NULL
};
PyObject* geom2dModule = PyModule_Create(&geom2dDef);
#else
PyObject* geom2dModule = Py_InitModule3("Geom2d", 0, "Geom2d");
#endif
Py_INCREF(geom2dModule);
PyModule_AddObject(partModule, "Geom2d", geom2dModule);
PyObject* geom2dModule(module.getAttr("Geom2d").ptr());
Base::Interpreter().addType(&Part::Geometry2dPy::Type,geom2dModule,"Geometry2d");
Base::Interpreter().addType(&Part::Curve2dPy::Type,geom2dModule,"Curve2d");
Base::Interpreter().addType(&Part::Conic2dPy::Type,geom2dModule,"Conic2d");