Extract named co-ordinate system data from STEP file

Hello,

I am trying to extract named co-ordinate system data from a STEP file. Is there any way to do it?

Thanks,
Prajwal

Dmitrii Pasukhin's picture

Hello,

Can you provide an example of data?

Best regards, Dmitrii.

 

Prajwal Shelar's picture

Hello Dimitrii,
Sorry for my incomplete question. What I actually want to extract is the AXIS2_PLACEMENT_3D entity from STEP file.
Also, after exporting the same file from my opencascade based application, the names of AXIS2_PLACEMENT_3D are lost, is there any way to prevent this?
Best Regards,
Prajwal.

Dmitrii Pasukhin's picture

Hello,

You can get all entities from the STEP file by iterate a model.

    Handle(StepData_StepModel) aReadModel = Handle(StepData_StepModel)::DownCast(myReader.WS()->Model());
    Standard_Integer i = 1;
    for (; i <= aReadModel->NbEntities(); i++)
    {
        const Handle(Standard_Transient)& anEnt = aReadModel->Value(i);
        if (!anEnt->IsKind(STANDARD_TYPE(StepGeom_Axis2Placement3d))
        {
            continue;
        }
        // do something
        // You can get shared or sharing graph and iterate on it
        // You can get all entity's field by class field.
    }

Additionally, after export from XBF to STEP model you can iterate on model and change some links and data. And after that, to make write operation to the file.

For more information, please describe your use case.

Best regards, Dmitrii.

Prajwal Shelar's picture

Hello Dmitrii,

Thank you so much for the code sample. This is really helpful.
I am able to get the placement axis data by extending above code. Now what I want to do is keep only the required StepGeom_Axis2Placement3d and delete others. For eg. keep axes with names 'PSYS' and delete others. Also can you please share how I can export STEP with these required entities only.

Best Regards,
Prajwal.