proof of concept rest machining from prior path gcode

This commit is contained in:
David Kaufman
2024-01-04 15:05:07 -05:00
parent ba630dc71b
commit ea1c9e4c57
5 changed files with 225 additions and 1 deletions

View File

@@ -27,6 +27,7 @@
#include <Mod/Part/App/TopoShapePy.h>
// inclusion of the generated files (generated out of AreaPy.xml)
#include "PathPy.h"
#include "AreaPy.h"
#include "AreaPy.cpp"
@@ -152,6 +153,11 @@ static const PyMethodDef areaOverrides[] = {
"getClearedArea(tipDiameter, diameter):\n"
"Gets the area cleared when a tool maximally clears this area. This method assumes a tool tip diameter 'tipDiameter' traces the full area, and that (perhaps at a different height on the tool) this clears a different region with tool diameter 'diameter'.\n",
},
{
"getClearedAreaFromPath",nullptr,0,
"getClearedAreaFromPath(path, diameter, zmax):\n"
"Gets the area cleared when a tool of the specified diameter follows the gcode represented in the path, ignoring cleared space above zmax.\n",
},
{
"getRestArea",nullptr,0,
"getRestArea(clearedAreas, diameter):\n"
@@ -415,6 +421,24 @@ PyObject* AreaPy::getClearedArea(PyObject *args)
} PY_CATCH_OCC
}
PyObject* AreaPy::getClearedAreaFromPath(PyObject *args)
{
PY_TRY {
PyObject *pyPath;
double diameter, zmax;
if (!PyArg_ParseTuple(args, "Odd", &pyPath, &diameter, &zmax))
return nullptr;
if (!PyObject_TypeCheck(pyPath, &(PathPy::Type))) {
PyErr_SetString(PyExc_TypeError, "path must be of type PathPy");
return nullptr;
}
const PathPy *path = static_cast<PathPy*>(pyPath);
std::shared_ptr<Area> clearedArea = getAreaPtr()->getClearedAreaFromPath(path->getToolpathPtr(), diameter, zmax);
auto pyClearedArea = Py::asObject(new AreaPy(new Area(*clearedArea, true)));
return Py::new_reference_to(pyClearedArea);
} PY_CATCH_OCC
}
PyObject* AreaPy::getRestArea(PyObject *args)
{
PY_TRY {