From fc94e4f2f4c8eb61467866194fd6f3a2733d3a0f Mon Sep 17 00:00:00 2001 From: Shai Seger Date: Sat, 28 Oct 2017 17:36:59 +0300 Subject: [PATCH] Solve the C++/Python type checking issue --- .../Path/PathSimulator/App/PathSimPyImp.cpp | 21 +++---------------- src/Mod/Path/PathSimulator/App/PreCompiled.h | 2 +- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/Mod/Path/PathSimulator/App/PathSimPyImp.cpp b/src/Mod/Path/PathSimulator/App/PathSimPyImp.cpp index 33a01b7279..2f7e5b2913 100644 --- a/src/Mod/Path/PathSimulator/App/PathSimPyImp.cpp +++ b/src/Mod/Path/PathSimulator/App/PathSimPyImp.cpp @@ -22,13 +22,11 @@ #include "PreCompiled.h" +#include #include #include #include -#include -#include #include -#include #include #include "Mod/Path/PathSimulator/App/PathSim.h" @@ -74,8 +72,7 @@ PyObject* PathSimPy::BeginSimulation(PyObject * args, PyObject * kwds) PyObject* PathSimPy::SetCurrentTool(PyObject * args) { PyObject *pObjTool; - //Path::ToolPy tptmp(new Path::Tool); - if (!PyArg_ParseTuple(args, "O", /*tptmp.GetType(),*/ &pObjTool)) + if (!PyArg_ParseTuple(args, "O!", &(Path::ToolPy::Type), &pObjTool)) return 0; PathSim *sim = getPathSimPtr(); sim->SetCurrentTool(static_cast(pObjTool)->getToolPtr()); @@ -106,7 +103,7 @@ PyObject* PathSimPy::ApplyCommand(PyObject * args, PyObject * kwds) static char *kwlist[] = { "position", "command", NULL }; PyObject *pObjPlace; PyObject *pObjCmd; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O", kwlist, &(Base::PlacementPy::Type), &pObjPlace, /*&(Path::CommandPy::Type),*/ &pObjCmd)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", kwlist, &(Base::PlacementPy::Type), &pObjPlace, &(Path::CommandPy::Type), &pObjCmd)) return 0; PathSim *sim = getPathSimPtr(); Base::Placement *pos = static_cast(pObjPlace)->getPlacementPtr(); @@ -118,18 +115,6 @@ PyObject* PathSimPy::ApplyCommand(PyObject * args, PyObject * kwds) return newposPy; } -/* test script -import PathSimulator -sim = PathSimulator.PathSim() -stock = Part.makeBox(20,20,5) -sim.BeginSimulation(stock,0.1) -msh = sim.GetResultMesh() -Mesh.show(msh) - -*/ - - - Py::Object PathSimPy::getTool(void) const { //return Py::Object(); diff --git a/src/Mod/Path/PathSimulator/App/PreCompiled.h b/src/Mod/Path/PathSimulator/App/PreCompiled.h index 3f594cab88..26a5c80c0e 100644 --- a/src/Mod/Path/PathSimulator/App/PreCompiled.h +++ b/src/Mod/Path/PathSimulator/App/PreCompiled.h @@ -29,7 +29,7 @@ // Exporting of App classes #ifdef FC_OS_WIN32 # define PathSimulatorExport __declspec(dllexport) -# define PathExport __declspec(dllexport) +# define PathExport __declspec(dllimport) # define PartExport __declspec(dllimport) # define MeshExport __declspec(dllimport) #else // for Linux