Allow passing the tool shape from python

This commit is contained in:
Daniel Wood
2020-04-29 19:34:50 +01:00
parent 0d3d7157f8
commit 9fa1a3e8ce
2 changed files with 9 additions and 9 deletions

View File

@@ -23,12 +23,10 @@ Create a path simulator object\n</UserDocu>
Start a simulation process on a box shape stock with given resolution\n</UserDocu>
</Documentation>
</Methode>
<Methode Name="SetCurrentTool">
<Methode Name="SetToolShape">
<Documentation>
<UserDocu>
SetCurrentTool(tool):\n
Set the current Path Tool for the subsequent simulator operations.\n
</UserDocu>
<UserDocu>SetToolShape(shape):\n
Set the shape of the tool to be used for simulation\n</UserDocu>
</Documentation>
</Methode>
<Methode Name="GetResultMesh">

View File

@@ -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<Path::ToolPy*>(pObjTool)->getToolPtr());
const TopoDS_Shape& toolShape = static_cast<Part::TopoShapePy*>(pObjToolShape)->getTopoShapePtr()->getShape();
sim->SetToolShape(toolShape, resolution);
Py_IncRef(Py_None);
return Py_None;
}