How to get MANIFOLD_SOLID_BREP entity name in reading STEP file.

Hi, Now, I want to get MANIFOLD_SOLID_BREP entity name.

First, I am reading the step file by OCCT.js and get Vertex coordinates, Solid/Vertex/Face/Edge Quantity and Solid start and end faces;

Second, I directly open the STEP text file data and know MANIFOLD_SOLID_BREP entity name exists in the STEP file. But I can't read to MANIFOLD_SOLID_BREP by code.

Last, I hope to get the corresponding MANIFOLD_SOLID_BREP name when traversing to this Solid, like When I traverse to entity 1 and entity 2, I get the corresponding 'Boss-Extrude1' and 'Boss-Extrude2'.

For Example:

23=MANIFOLD_SOLID_BREP('Boss-Extrude1',#24);

78=MANIFOLD_SOLID_BREP('Boss-Extrude2',#79);

Thanks for everyone's reply!

Dmitrii Pasukhin's picture

Hello, The quastion is not clear to me.

Do you want to iterate into imported step file by OCCT? For this purposal there are StepData_StepModel.

Please make a look into: how to get the id of entity in STEP file? - Forum Open Cascade Technology

There example to getting ID. But you be able to get any data from the Step entity just down cast to needed class.

Best regards, Dmitrii.

sunlin0oo's picture

Thanks for your reply, Dmitrii!
First, The result I want is: When I traversed to Solid, I can get its corresponding name in the STEP file.
Second, I can iterate into imported step file by OCCT.js;
I uploaded a picture, this STEP model has a total of 139 Solid entities, and I found the first Solid in order(The red frame marks Solid, and the yellow frame marks the name), and the number behind it did not refer to SolidID;
Last, I will experiment with your suggestion!I have explained the problem again, please point it out, and I will answer your questions
Thanks again for your reply!

sunlin0oo's picture

hi,Dmitrii:
I operate according to the link information you provided, I can get the ID of all Entities,
but I get the content(for example MANIFOLD_SOLID_BREP('Boss-Extrude1',#24)) behind the ID(23)
#23=MANIFOLD_SOLID_BREP('Boss-Extrude1',#24);
Can you give me some other advice?
Best Regards, Sunlin.

Dmitrii Pasukhin's picture

You need to check for IsKind(STANDARD_TYPE(StepShape_ManifoldSolidBrep)). Then dowcast to Handle(StepShape_ManifoldSolidBrep);

Best regards, Dmitrii.

sunlin0oo's picture

Thank you very much for your suggestion!I can get all names about Solid.

Although I can get the name of the corresponding Solid now, I don't quite understand it.

Before I traversed the entities of the OCCT model in this way

TopExp_Explorer ex;

for (ex.Init(aShape, TopAbs_SOLID); ex.More(); ex.Next()){

 const TopoDS_Solid& aSolid = TopoDS::Solid(ex.Current());

};

Method 1: Solid(A1,A2,A3...) obtained by traversing TopoDS_Shape.

But now I read the Solid name in this way:

Interface_EntityIterator entIt = Model->Entities();

for (; entIt.More(); entIt.Next()) {

 const Handle(Standard_Transient)& ent = entIt.Value();

 if (ent->IsKind(STANDARD_TYPE(StepShape_ManifoldSolidBrep))) {   

    Handle(StepShape_ManifoldSolidBrep) msb = Handle(StepShape_ManifoldSolidBrep)::DownCast(ent);

    std::cout << "Found Manifold Solid BREP with name '" << msb->Name()->ToCString() << "'" << std::endl;

 }

}

Method 2: Solid of Name(B1,B2,B3...) obtained by traversing Entities;

Because through the first traversal, I can obtain information such as the faces contained in the Solid, and I need to correspond to the entity name traversed by the second method.

What I'm not sure about is: whether the Solids traversed by these two methods correspond to each other(A1.name === B1, A2.name === B2,A3.name=== B3....);

thanks agin.
Sunlin.

sunlin0oo's picture

I have already deal my question!
Thanks your help!
Best regards, Sun.

jason jiang's picture

Hi,
It is seem the same question as mine,while import STEP file and show 3D by OCC,then,I want to Traverse the entity to search the sub-object such as Face,Wire,Edge etc,I hope to get the ID and other information of these sub-object from STEP file.
so,How do you solved?
thanks
Jason.Jiang

jason jiang's picture

Hi,Sun:
Could you share your solution about how to find a object in step file?such as face,wire,edge,vertex ect.my question is,after import step file and show 3D figure by OCC,I traverse the Topods_Shape,and get a face or Wire,then,to find it in the same step file again,hope to get ID or other information of this object.
so,could give me a sample code?
Thanks
Jason.Jiang

sunlin0oo's picture

Hi, Jiang:
I'm sorry to reply to your message so late;
This is my source code, I hope it can help you!
Best regards, Sun.

Attachments: 
jason jiang's picture

Sun:
Thanks for your code so much,But it is not to meet my requirement. in order to get the relationship between OCC with STEP FILE,my requirement just descript as this,if we get a wire,edge,face or other object of OCC,then,how to find it in STEP/STP file and to obtain the id or other information in STEP/STP file?
I am not find the right code in your attached file.
so,do you have any suggestion?
Thanks very much.
Jason.Jiang

jason jiang's picture

Sun:
你好,你应该是中国人,非常感谢你提供的代码,可能我英文表述不太清楚,我用中文表述我的一个问题:我用OCC导入STEP文件,能够显示3D图形,然后,我想选择3D实体的有一个子对象,如边、面、WIRE(环),然后,再在STEP文件里面查找它的ID和其他信息。为什么有这个要求呢?我是想把自己开发的STEP解析和OCC关联起来,这样,可以拓展一些其他功能。目前,我可以实现读取STEP的实体名称、类型、ID等,但是,在OCC里面,它们分别是哪个对象呢?这个是我比较困惑的。
不知你有没有尝试做过这方面的解析?
QQ:188231246,可以多交流
谢谢
蒋建林

Dmitrii Pasukhin's picture

Please use international English. This will allow all forum members to help you or your answer may help them. There are so many beautiful and powerful languages in this world, but please let's use a language that is accessible to most people to communicate.

Best regards, Dmitrii.

 

sunlin0oo's picture

Jiang:
因为我也是刚接触OCCT这块;我其实不理解你所描述:”它们分别是哪个对象“ 的意思;
我已添加你,方便的话通过一下,可以多进行相关的交流!

Dmitrii Pasukhin's picture

I don't understand too, what means "which objects are they". If you checking TopoDS type or something like that. Let me know.

I would also like to ask you to use international language.

Best regards, Dmitrii.

jason jiang's picture

Hi,Dmitrii:
Thanks for your help,my question is,if I get a Face,Wire or Edge from TopoDS_Shape,then,could I find it from STEP file to get the ID just like '#32=ADVANCED_FACE('',(#340),#3896,.T.);',this is text the content of Step file.
Could you give any suggestion?
Thanks
Jason

Dmitrii Pasukhin's picture

It is possible, but not optimal. ReadProcess store connection between entity(key) and shape(value). It is not possible to find key by value.

You need to create you own map and fill it by iteratin on model and getting shapes from entities.

And you will be able to get entity by shape. As soon as you recieve an entity you be ably to get ID by example in you own forum quastion.

Best regards, Dmitrii.

jason jiang's picture

Dmitrii:
you mean that if I read step file by STEPCAFControl_Reader,then,I can get the ID and shape(face,edge,wire or other).this time,I save them,then,I can find it from where the same step file loaded and show?
but I test as this,it is can get ID and shape,But can not find.
I attached my code,could you please check it?
Thanks
Jason

Attachments: 
龙 柳州's picture

Hi,
I also encountered the same problem.
Can I get the name 'Kugeln. 1' from the STP file.The content of the STP file is as follows:
'#1759=MANIFOLD_SOLID_BREP('Kugeln.1',#1761) ;'
Best regards, Long.

龙 柳州's picture

Hi,sun.
May I ask how you can solve (A1.name === B1, A2.name === B2,A3.name=== B3....)'s problem

Sujith Sukumaran's picture

"MANIFOLD_SOLID_BREP in a STEP file" you can use a library or software that supports reading and parsing STEP files. Here's a general approach:

Choose a STEP file parsing library or software: There are several libraries available in different programming languages, such as OpenCASCADE, STEPcode, and FreeCAD. Select one that fits your programming environment.

Parse the STEP file: Use the selected library or software to parse the STEP file and load its contents into a data structure.

Traverse the data structure: Navigate through the data structure to locate the MANIFOLD_SOLID_BREP entity. The structure may consist of various entities defined by the STEP standard, such as HEADER, DATA, and GEOMETRIC_REPRESENTATION_ITEM.

Extract the entity name: Once you have found the MANIFOLD_SOLID_BREP entity, recover its entity name. The entity name is typically stored as an attribute or property of the entity object in the data structure.

Access the entity name: Depending on the library or software you are using, access the entity name using the appropriate methods or properties provided by the library's API. It may be accessible as a string or an identifier associated with the entity.

By following these steps, you should be able to retrieve the entity name of a MANIFOLD_SOLID_BREP entity from a STEP file using the chosen STEP file parsing library or software.

Or there is another step you can explore. An AI services provider can develop a tailored solution that uses machine learning models to analyze the STEP file's structure, identify the MANIFOLD_SOLID_BREP entity, and pull its entity name accurately. With their in-depth knowledge of AI technologies and data parsing, these providers can streamline the process and deliver precise results.

By partnering with an AI services provider, you can unlock the power of artificial intelligence to efficiently retrieve the MANIFOLD_SOLID_BREP entity name from a STEP file, saving time and resources in your data processing workflow.