Mod: Use new addObject<T>(...) using regex

This commit is contained in:
Benjamin Nauck
2025-01-19 01:49:04 +01:00
parent 6d28a19a3e
commit 265b58c034
57 changed files with 125 additions and 159 deletions

View File

@@ -159,7 +159,7 @@ void CmdMeshPartTrimByPlane::activated(int)
copy.trimByPlane(plnBase, -plnNormal);
App::Document* doc = it->getDocument();
Mesh::Feature* fea = static_cast<Mesh::Feature*>(doc->addObject("Mesh::Feature"));
Mesh::Feature* fea = doc->addObject<Mesh::Feature>();
fea->Label.setValue(it->Label.getValue());
Mesh::MeshObject* feamesh = fea->Mesh.startEditing();
feamesh->swap(copy);

View File

@@ -327,8 +327,7 @@ void CrossSections::apply()
App::Document* doc = it->getDocument();
std::string s = it->getNameInDocument();
s += "_cs";
Part::Feature* section =
static_cast<Part::Feature*>(doc->addObject("Part::Feature", s.c_str()));
Part::Feature* section = doc->addObject<Part::Feature>(s.c_str());
section->Shape.setValue(comp);
section->purgeTouched();
}

View File

@@ -533,7 +533,7 @@ void CurveOnMeshHandler::displaySpline(const Handle(Geom_BSplineCurve) & spline)
Gui::View3DInventorViewer* view3d = d_ptr->viewer->getViewer();
App::Document* doc = view3d->getDocument()->getDocument();
doc->openTransaction("Add spline");
Part::Feature* part = static_cast<Part::Feature*>(doc->addObject("Part::Spline", "Spline"));
Part::Feature* part = doc->addObject<Part::Feature>("Spline");
part->Shape.setValue(edge);
doc->commitTransaction();
}
@@ -562,8 +562,7 @@ void CurveOnMeshHandler::displayPolyline(const TopoDS_Wire& wire)
Gui::View3DInventorViewer* view3d = d_ptr->viewer->getViewer();
App::Document* doc = view3d->getDocument()->getDocument();
doc->openTransaction("Add polyline");
Part::Feature* part =
static_cast<Part::Feature*>(doc->addObject("Part::Feature", "Polyline"));
Part::Feature* part = doc->addObject<Part::Feature>("Polyline");
part->Shape.setValue(wire);
doc->commitTransaction();
}

View File

@@ -655,7 +655,7 @@ bool Mesh2ShapeGmsh::loadOutput()
stlIn.close();
kernel.harmonizeNormals();
auto fea = static_cast<Mesh::Feature*>(doc->addObject("Mesh::Feature", "Mesh"));
auto fea = doc->addObject<Mesh::Feature>("Mesh");
fea->Label.setValue(d->label);
fea->Mesh.setValue(kernel.getKernel());
stl.deleteFile();