Can't retrieve specific child's Tag

Hi everyone!

I want to get the specific TopoDS_Shape's (Edge) Tag(like 0:1:5) in the IGES file. But some edge can't get the Tag!

I import the file in CAD Assistant (download from Open CASCADE Technology website) and check the model browser, the edge I choose has the name.

So if there's an idea to address this problem? May IGES export type or something else?

Welcome to discuss, thanks.

Mikhail MPV's picture

  Hi,

Could you attach an example IGES file to reproduce the problem? Normally everything should work fine, same as for STEP import.

Regards,

Mikhail.

HSIEN-SHUN HSU's picture

Hi,

There is my testing file.

And the png file is the screenshot in CAD Assistant. You can find the edge has the modeling data.

Thanks.

Mikhail MPV's picture

In my example it works fine:

  IGESCAFControl_Reader aReader;
  Interface_Static::SetIVal("read.iges.ideas", 1);
  Interface_Static::SetIVal("read.iges.nonmanifold", 1);
  aReader.ReadFile(anIGESName)

  Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");

  aReader.Transfer(aDoc);

  Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
  TDF_LabelSequence aFreeLabs;
  aShapeTool->GetFreeShapes(aFreeLabs);

 

The final sequence "aSubLabs" contains 25 shapes. The first is solid, others are edges, located on "0:1:1:*" labels. Each edge-label contains name "EDGE", nearly the same as you have in CAD Assistance.

 

 

HSIEN-SHUN HSU's picture

Hi,

Can I ask your OCC version?

And I use your code, It's sill can only read some Tag.

Mikhail MPV's picture

I used the same OCCT version as you: 7.5.0

HSIEN-SHUN HSU's picture

Hi,

I have some differences with your code.

My reading function is:

Handle(TDocStd_Document) aDoc;
Handle(XCAFApp_Application) anApp = XCAFApp_Application::GetApplication();
anApp->NewDocument("BinXCAF", aDoc);
aIGESReader.Transfer(aDoc);

If I don't write the second and third line, I have exception in "Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());"

Is there any I missing in the code? Thanks.

HSIEN-SHUN HSU's picture

Hi,
Thanks for help, but I run your code, but it has exception on Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");

Mikhail MPV's picture

 Hi,

Could you check libraries and environment, it should not crash. Probably, some memory management problems? I've just recompiled everything from scratch, pure OCCT 7.5.0, no additional environment variables set, it works well. Could you analyze where in OCCT libraries it is crashed? Even in your example, the first line of TDocStd_Application::NewDocument is "Handle(TDocStd_Document) D = new TDocStd_Document(format);", so, it is the same, it must produce crash too.

Mikhail MPV's picture

  Hi,

Both my and your creation of the document are correct. The difference is that you register your document in the application (to be able to save it, for an example).

And, of course, it raises an exception by calling any method of aDoc if this Handle-pointer is not initialized (is Null) by calling "new" (in my code) or "NewDocument" in your.

Regards,

Mikhail.

HSIEN-SHUN HSU's picture

Hi,

So you have initialized the "aDoc" ?

Mikhail MPV's picture

Yes,  "aDoc" is initialized in my piece of code as:

Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");