Mod: Use new addObject<T>(...) that requires additional changes

This commit is contained in:
Benjamin Nauck
2025-02-09 14:09:56 +01:00
parent a1c5767643
commit 8cc98b9a88
19 changed files with 60 additions and 82 deletions

View File

@@ -228,8 +228,7 @@ private:
std::string gcode = buffer.str();
Path::Toolpath path;
path.setFromGCode(gcode);
Path::Feature* object = static_cast<Path::Feature*>(
pcDoc->addObject("Path::Feature", file.fileNamePure().c_str()));
auto* object = pcDoc->addObject<Path::Feature>(file.fileNamePure().c_str());
object->Path.setValue(path);
pcDoc->recompute();
}
@@ -254,9 +253,8 @@ private:
if (!pcDoc) {
pcDoc = App::GetApplication().newDocument();
}
Path::PathPy* pPath = static_cast<Path::PathPy*>(pcObj);
Path::Feature* pcFeature =
static_cast<Path::Feature*>(pcDoc->addObject("Path::Feature", name));
auto* pPath = static_cast<Path::PathPy*>(pcObj);
auto* pcFeature = pcDoc->addObject<Path::Feature>(name);
Path::Toolpath* pa = pPath->getToolpathPtr();
if (!pa) {
throw Py::Exception(PyExc_ReferenceError, "object doesn't reference a valid path");