Fri, 11/11/2022 - 08:33
Hello,
I am trying to delete/remove some of the entities in my STEP model before proceeding to write STEP file. I want to delete the StepGeom_Axis2Placement3d entities whose name is empty. Here is my code:
Handle(StepData_StepModel) aWriteModel = Handle(StepData_StepModel)::DownCast(writer.Writer().WS()->Model());
for (int i = 1; i <= aWriteModel->NbEntities(); i++)
{
const Handle(Standard_Transient)& anEnt = aReadModel->Value(i);
if (!anEnt->IsKind(STANDARD_TYPE(StepGeom_Axis2Placement3d)))
{
continue;
}
Handle(StepGeom_Axis2Placement3d) stpEnt = Handle(StepGeom_Axis2Placement3d)::DownCast(anEnt);
auto name = stpEnt->Name();
if (name->IsEmpty()) {
//delete this stpEnt object.
}
}
//write step
Is there any way to do it?
Best Regards,
Prajwal.
Wed, 11/16/2022 - 17:12
Hello,
Remove something alone is not possible.
You need to remove all reference from it and after that recreate a model.
I can send a code example to remove something. But it takes some times. I apologize for the possible delay.
Best regards, Dmitrii.
Sat, 11/19/2022 - 11:30
Hello, Dmitri,
I have been looking for the knowledge to delete a single component from step, but I have not found it and have no more ideas. You said that you need to delete all references from step and recreate the model. Can you also send me a copy of your example code for me to learn?
This is my email: zk1079511174@163.com
Thank you.
Zhang Kai
Wed, 11/16/2022 - 17:36
Hello Dmitrii,
Thanks for the reply.
Sample code of removing references and recreating the model will be really helpful.
Thanks,
Prajwal.
Wed, 11/30/2022 - 09:36
Hello Dmitrii,
Is there any update on this issue?
Best regards,
Prajwal
Wed, 11/30/2022 - 11:06
Hello,
Thanks for waiting.
I have been attached some code sample to remove entities. It is a sample, in some cases you need to upgrade it.
To do some improve, it is necessary to analyze step graph and removed entity.
Best regards, Dmitrii.
Wed, 11/30/2022 - 15:39
Thanks Dmitrii, I'll check it out.
Best regards,
Prajwal