Crash while loading a step file

Hi,

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);

if(!sharEL2){

#ifdef OCCT_DEBUG

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

#endif

}

else {

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

  myShRef.Start();

  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 

if(!sharEL2)

meant to make sure that

aShto.Sharings(theEL2);

returns a non empty list ?

 

Because

sharEL2 is calculated using 

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

Interface_ShareTool::IsShared 

Which internally uses

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

Interface_Graph::GetShareds

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.

Sincerely,

Ben

 

 

Kulikova Galina's picture

Hi

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

Best regards

bmeijering_158537's picture

Hi,

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.

Sincerely,

Ben

Kirill Gavrilov's picture

You just need registering for reporting issues on Bugtracker:
https://dev.opencascade.org/index.php?q=home/get_involved