port Surface module to v0.17
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/PyObjectBase.h>
|
||||
#include "FeatureFilling.h"
|
||||
#include "FeatureSewing.h"
|
||||
#include "FeatureCut.h"
|
||||
@@ -61,20 +62,17 @@ PyObject* initModule()
|
||||
|
||||
|
||||
/* Python entry */
|
||||
PyMODINIT_FUNC initSurface()
|
||||
PyMOD_INIT_FUNC(Surface)
|
||||
{
|
||||
try {
|
||||
Base::Interpreter().runString("import Part");
|
||||
}
|
||||
catch(const Base::Exception& e) {
|
||||
PyErr_SetString(PyExc_ImportError, e.what());
|
||||
return;
|
||||
PyMOD_Return(0);
|
||||
}
|
||||
|
||||
// ADD YOUR CODE HERE
|
||||
//
|
||||
//
|
||||
(void) Surface::initModule();
|
||||
PyObject* mod = Surface::initModule();
|
||||
Base::Console().Log("Loading Surface module... done\n");
|
||||
|
||||
// Add types to module
|
||||
@@ -84,4 +82,6 @@ PyMODINIT_FUNC initSurface()
|
||||
Surface::BSurf ::init();
|
||||
Surface::BezSurf ::init();
|
||||
Surface::BSplineSurf ::init();
|
||||
|
||||
PyMOD_Return(mod);
|
||||
}
|
||||
|
||||
@@ -7,10 +7,9 @@ endif(MSVC)
|
||||
include_directories(
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${OCC_INCLUDE_DIR}
|
||||
${PYTHON_INCLUDE_PATH}
|
||||
${PYTHON_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIR}
|
||||
${XERCESC_INCLUDE_DIR}
|
||||
${QT_QTCORE_INCLUDE_DIR}
|
||||
${XercesC_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(Surface_LIBS
|
||||
|
||||
@@ -131,14 +131,14 @@ void ShapeValidator::checkAndAdd(const Part::TopoShape &ts, const char *subName,
|
||||
//we want only the subshape which is linked
|
||||
checkAndAdd(ts.getSubShape(subName), aWD);
|
||||
}
|
||||
else if (!ts._Shape.IsNull() && ts._Shape.ShapeType() == TopAbs_WIRE) {
|
||||
TopoDS_Wire wire = TopoDS::Wire(ts._Shape);
|
||||
else if (!ts.getShape().IsNull() && ts.getShape().ShapeType() == TopAbs_WIRE) {
|
||||
TopoDS_Wire wire = TopoDS::Wire(ts.getShape());
|
||||
for (TopExp_Explorer xp(wire, TopAbs_EDGE); xp.More(); xp.Next()) {
|
||||
checkAndAdd(xp.Current(), aWD);
|
||||
}
|
||||
}
|
||||
else {
|
||||
checkAndAdd(ts._Shape, aWD);
|
||||
checkAndAdd(ts.getShape(), aWD);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ App::DocumentObjectExecReturn *Cut::execute(void)
|
||||
|
||||
//Cut Shape1 by Shape2
|
||||
TopoDS_Shape aCutShape;
|
||||
aCutShape = ts1.cut(ts2._Shape);
|
||||
aCutShape = ts1.cut(ts2.getShape());
|
||||
|
||||
//Check if resulting shell is null
|
||||
if (aCutShape.IsNull()){
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/PyObjectBase.h>
|
||||
#include <Base/Interpreter.h>
|
||||
#include <Gui/Application.h>
|
||||
|
||||
@@ -61,11 +62,11 @@ PyObject* initModule()
|
||||
} // namespace SurfaceGui
|
||||
|
||||
/* Python entry */
|
||||
PyMODINIT_FUNC initSurfaceGui()
|
||||
PyMOD_INIT_FUNC(SurfaceGui)
|
||||
{
|
||||
if (!Gui::Application::Instance) {
|
||||
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
|
||||
return;
|
||||
PyMOD_Return(0);
|
||||
}
|
||||
|
||||
Base::Interpreter().runString("import Surface");
|
||||
@@ -79,6 +80,7 @@ PyMODINIT_FUNC initSurfaceGui()
|
||||
|
||||
// SurfaceGui::ViewProviderCut::init();
|
||||
|
||||
(void) SurfaceGui::initModule();
|
||||
PyObject* mod = SurfaceGui::initModule();
|
||||
Base::Console().Log("Loading GUI of Surface module... done\n");
|
||||
PyMOD_Return(mod);
|
||||
}
|
||||
|
||||
@@ -12,10 +12,8 @@ include_directories(
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${COIN3D_INCLUDE_DIR}
|
||||
${OCC_INCLUDE_DIR}
|
||||
${PYTHON_INCLUDE_PATH}
|
||||
${SOQT_INCLUDE_DIR}
|
||||
${QT_INCLUDE_DIR}
|
||||
${XERCESC_INCLUDE_DIR}
|
||||
${PYTHON_INCLUDE_DIRS}
|
||||
${XercesC_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
@@ -31,12 +29,21 @@ set(SurfaceGui_MOC_HDRS
|
||||
fc_wrap_cpp(SurfaceGui_MOC_SRCS ${SurfaceGui_MOC_HDRS})
|
||||
SOURCE_GROUP("Moc" FILES ${SurfaceGui_MOC_SRCS})
|
||||
|
||||
qt4_add_resources(SurfaceGui_QRC_SRCS Resources/Surface.qrc)
|
||||
if (BUILD_QT5)
|
||||
qt5_add_resources(SurfaceGui_QRC_SRCS Resources/Surface.qrc)
|
||||
else()
|
||||
qt4_add_resources(SurfaceGui_QRC_SRCS Resources/Surface.qrc)
|
||||
endif()
|
||||
|
||||
SET(SurfaceGui_UIC_SRCS
|
||||
BSurf.ui
|
||||
)
|
||||
qt4_wrap_ui(SurfaceGui_UIC_HDRS ${SurfaceGui_UIC_SRCS})
|
||||
|
||||
if (BUILD_QT5)
|
||||
qt5_wrap_ui(SurfaceGui_UIC_HDRS ${SurfaceGui_UIC_SRCS})
|
||||
else()
|
||||
qt4_wrap_ui(SurfaceGui_UIC_HDRS ${SurfaceGui_UIC_SRCS})
|
||||
endif()
|
||||
|
||||
SET(SurfaceGui_SRCS
|
||||
${SurfaceGui_QRC_SRCS}
|
||||
|
||||
Reference in New Issue
Block a user