Mod: Use new GroupExtension::addObject<T>(...)

This commit is contained in:
Benjamin Nauck
2025-01-22 20:18:19 +01:00
parent b99c1eae70
commit 2107e60304
6 changed files with 6 additions and 11 deletions

View File

@@ -2755,7 +2755,7 @@ void CmdFemPostPipelineFromResult::activated(int)
// create the pipeline object
openCommand(QT_TRANSLATE_NOOP("Command", "Create pipeline from result"));
if (foundAnalysis) {
pcAnalysis->addObject("Fem::FemPostPipeline", FeatName.c_str());
pcAnalysis->addObject<Fem::FemPostPipeline>(FeatName.c_str());
}
else {
doCommand(Doc,

View File

@@ -128,8 +128,7 @@ void Segmentation::accept()
const std::vector<MeshCore::MeshSegment>& data = it->GetSegments();
for (const auto& jt : data) {
Mesh::MeshObject* segment = mesh->meshFromSegment(jt);
Mesh::Feature* feaSegm =
static_cast<Mesh::Feature*>(group->addObject("Mesh::Feature", "Segment"));
auto* feaSegm = group->addObject<Mesh::Feature>("Segment");
Mesh::MeshObject* feaMesh = feaSegm->Mesh.startEditing();
feaMesh->swap(*segment);
feaSegm->Mesh.finishEditing();

View File

@@ -513,8 +513,7 @@ void SegmentationBestFit::accept()
const std::vector<MeshCore::MeshSegment>& data = it->GetSegments();
for (const auto& jt : data) {
Mesh::MeshObject* segment = mesh->meshFromSegment(jt);
Mesh::Feature* feaSegm =
static_cast<Mesh::Feature*>(group->addObject("Mesh::Feature", "Segment"));
auto* feaSegm = group->addObject<Mesh::Feature>("Segment");
Mesh::MeshObject* feaMesh = feaSegm->Mesh.startEditing();
feaMesh->swap(*segment);
feaSegm->Mesh.finishEditing();

View File

@@ -483,8 +483,7 @@ public:
group = doc->addObject<App::DocumentObjectGroup>(internalname.c_str());
}
auto anno = dynamic_cast<App::AnnotationLabel*>(
group->addObject("App::AnnotationLabel", internalname.c_str()));
auto anno = group->addObject<App::AnnotationLabel>(internalname.c_str());
QStringList lines = s.split(QLatin1String("\n"));
std::vector<std::string> text;
for (const auto& line : lines) {

View File

@@ -506,8 +506,7 @@ void CmdSegmentationFromComponents::activated(int)
std::vector<std::vector<MeshCore::FacetIndex>> comps = mesh.getComponents();
for (const auto& jt : comps) {
std::unique_ptr<Mesh::MeshObject> segment(mesh.meshFromSegment(jt));
Mesh::Feature* feaSegm =
static_cast<Mesh::Feature*>(group->addObject("Mesh::Feature", "Segment"));
auto* feaSegm = group->addObject<Mesh::Feature>("Segment");
Mesh::MeshObject* feaMesh = feaSegm->Mesh.startEditing();
feaMesh->swap(*segment);
feaSegm->Mesh.finishEditing();

View File

@@ -25,8 +25,7 @@ protected:
_docName = App::GetApplication().getUniqueDocumentName("test");
auto _doc = App::GetApplication().newDocument(_docName.c_str(), "testUser");
_assemblyObj = _doc->addObject<Assembly::AssemblyObject>();
_jointGroupObj = static_cast<Assembly::JointGroup*>(
_assemblyObj->addObject("Assembly::JointGroup", "jointGroupTest"));
_jointGroupObj = _assemblyObj->addObject<Assembly::JointGroup>("jointGroupTest");
}
void TearDown() override