Crash while loading a step file


I am trying to load a STEP file (exported from SolidWorks) in OpenCascade 7.4.0. and I ran into a crash.

I can't share the model itself at this moment, but I will put in a request to share the part that causes the issue.

In the meantime I was hoping this might sound familiar to some people, or that people might already have suspicions about the cause (I saw other forum posts that seem related).


The crash occurs during the STEPCAFControl_Reader::Transfer in StepToTopoDS_TranslateFace::Init because

Loop      = FaceBound->Bound();

results in Loop becoming a nullptr.


During STEPCAFControl_Reader::ReadFile I notice a lot of Standard_NoSuchObject exceptions. (The function still returns IFSelect_RetDone).

The first Standard_NoSuchObject I encountered was in RWStepShape_RWEdgeCurve::Check.

The problem occurs at line 273, where the list of myShRef is empty.

Handle(StepShape_EdgeLoop) theEL2 = Handle(StepShape_EdgeLoop)::DownCast(myShRef.Value());

Standard_Boolean sharEL2 = aShto.IsShared(theEL2);



  std::cout << "EdgeLoop2 not shared" <<std::endl;



else {

  myShRef = aShto.Sharings(theEL2); // unused Standard_Integer nbRef = myShRef.NbEntities();


  theFOB2 = Handle(StepShape_FaceBound)::DownCast(myShRef.Value()); <--- Standard_NoSuchObject exception, because myShRef references an empty list and thus Value may not be invoked

I am not familiar with the source code, so I can only look at a very limited scope.

This is probably completely irrelevant, but I still wanted to ask, just to be sure.

Is the following line of code 


meant to make sure that


returns a non empty list ?



sharEL2 is calculated using 

//! Returns True if <ent> is Shared by other Entities in the Model


Which internally uses

//! Returns the sequence of Entities Shared by an Entity


and checks if the returned list has items.


Because GetShareds is used, this seems to check if the edge loop shares entities, not that it is shared itself (I'm only basing this on the comments and function names).

Is this how this piece of code is supposed to work ?

Looking forward to your response.





Kulikova Galina's picture


You are right it is a bug in the  in the method RWStepShape_RWEdgeCurve::Check. 

Best regards

bmeijering_158537's picture


Thank you for your answer.

You mention that the bug is in RWStepShape_RWEdgeCurve:: Check.
So the bug isn't in Interface_ShareTool::IsShared ? (because this doesn't seem return what the function name implies)

What is the correct way to solve the bug ?

I see now that there is also a Mantis system, but I can't report a bug there.



Kirill Gavrilov's picture

You just need registering for reporting issues on Bugtracker: