From 54e4b8a05f209ca42c78e5acd92295b2081ee45d Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Wed, 29 Apr 2020 19:34:50 +0100 Subject: [PATCH] Allow passing the tool shape from python --- src/Mod/Path/PathSimulator/App/PathSimPy.xml | 8 +++----- src/Mod/Path/PathSimulator/App/PathSimPyImp.cpp | 10 ++++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Mod/Path/PathSimulator/App/PathSimPy.xml b/src/Mod/Path/PathSimulator/App/PathSimPy.xml index 1449f5b20e..7225318f21 100644 --- a/src/Mod/Path/PathSimulator/App/PathSimPy.xml +++ b/src/Mod/Path/PathSimulator/App/PathSimPy.xml @@ -23,12 +23,10 @@ Create a path simulator object\n Start a simulation process on a box shape stock with given resolution\n - + - - SetCurrentTool(tool):\n - Set the current Path Tool for the subsequent simulator operations.\n - + SetToolShape(shape):\n +Set the shape of the tool to be used for simulation\n diff --git a/src/Mod/Path/PathSimulator/App/PathSimPyImp.cpp b/src/Mod/Path/PathSimulator/App/PathSimPyImp.cpp index eaec6d454a..708cc4b9a1 100644 --- a/src/Mod/Path/PathSimulator/App/PathSimPyImp.cpp +++ b/src/Mod/Path/PathSimulator/App/PathSimPyImp.cpp @@ -69,13 +69,15 @@ PyObject* PathSimPy::BeginSimulation(PyObject * args, PyObject * kwds) return Py_None; } -PyObject* PathSimPy::SetCurrentTool(PyObject * args) +PyObject* PathSimPy::SetToolShape(PyObject * args) { - PyObject *pObjTool; - if (!PyArg_ParseTuple(args, "O!", &(Path::ToolPy::Type), &pObjTool)) + PyObject *pObjToolShape; + float resolution; + if (!PyArg_ParseTuple(args, "O!f", &(Part::TopoShapePy::Type), &pObjToolShape, &resolution)) return 0; PathSim *sim = getPathSimPtr(); - sim->SetCurrentTool(static_cast(pObjTool)->getToolPtr()); + const TopoDS_Shape& toolShape = static_cast(pObjToolShape)->getTopoShapePtr()->getShape(); + sim->SetToolShape(toolShape, resolution); Py_IncRef(Py_None); return Py_None; }