For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Loading STEP file crashes on EdgeLoop

Nathaniel Essenberg's picture
Forums: 

Hi,

I am having trouble opening (Transfering) a specific STEP file I received for testing. I cannot share this file, but it is quite big, and exported from SolidWorks (see the screenshot of the STEP file, FileInfo.png).

The code I use is pretty simple, as shown in ReadCode.png. This worked so far for other files I tested, though I am not sure any of them came from SolidWorks. I am using OpenCascade 7.2.0.

The problem occurs in the Transfer() function, when it tries to Translate an EdgeLoop while Translating a Face.

An Edge is DownCast to a StepShape_EdgeCurve, but the result is NULL, maybe because the edge is actually a StepShape_OrientedEdge?

Is SolidWorks doing something that is not supported by OpenCascade out of the box?

Also, I noticed that, for example, FreeCAD is quite able to open the file, and I thought it uses OpenCascade as well. Some other applications are also able to open it.

I am not entirely sure what I am doing wrong, or what these other applications are doing right/extra to handle these cases.

The only other thing I can think of, is that I am building a DLL, an so exception handling might not work properly...

EDIT: I see from some logging the following error occurs for a number of entities:

Report : 12 unknown entities.
*** ERR StepReaderData *** Pour Entite #1316
    Type:EDGE_CURVE  Param.n0 4: #0 Non trouve
*** ERR StepReaderData *** Pour Entite #1316
    Type:EDGE_CURVE  Param.n0 3: #0 Non trouve​

(...continues)

Any ideas?

Kirill Gavrilov's picture

Your callstack looks similar to another registered issue:
https://tracker.dev.opencascade.org/view.php?id=29979

I'm no STEP expert, so I cannot comment if it is something wrong in STEP file, or STEP reader does not handle some scenario, but anyway, crash should be fixed at least by necessary NULL checks.

Nathaniel Essenberg's picture

Thank you!

I did decide for a while to add some null checks, which worked to get around the problematic items, but I am very reluctant to modify OCC itself, rather than my own code.

I seem to have found my problem though, so I will post it here.

Today I found a post on the FreeCAD forums: https://forum.freecadweb.org/viewtopic.php?f=3&t=28341#p229955

This mentions possible issues with STEP files containing p-curves for geometry.

I added the following line to my own code, and no more crash during Transfer():

Interface_Static::SetIVal("read.surfacecurve.mode", 3);

(Which I found about in the OpenCascade documentation here: https://www.opencascade.com/doc/occt-7.2.0/overview/html/occt_user_guides__step.html )