"STEPCAFControl_Reader::Transfer" doesn't read anything.

Hi.

I used "STEPCAFControl_Reader" to read a step file, but it doesn't read anything.
Basic Infomation:
Version: 7.8.1
Debug Information:
ReadColor: true,
ReadName: true,
"STEPCAFControl_Reader::ReadFile" return "Ok"
"STEPCAFControl_Reader::Transfer" return "true",but it output message "Microsoft C++ exception: Standard_NullObject at memory location 0x00000094932F6DB0."

This file can be open use 3D-Tool and NG.

Elle Edition's picture

Hi,
I encounter some problems with STEPCAFControl_Reader too, but I don' know is it matters with your issue, could you pls share more information about it.
My opencascade version is 7.8.0. Maybe? It is the Version that can parse UDA.
The issue I encountered occurred in the source file "StepData_StepReaderData.cxx":
310: theVal->Clear();
311: aResString.Trunc(aResStringSize);
312: TCollection_AsciiString aTmpString(aResString, 0);
313:theVal->AssignCat(aTmpString.ToCString());
The local variables are as shown in figure 1. It seem that aResString get the correct result but aTmpString get wrong by aResString.
And in "STEPCAFControl_Reader.cxx", local variables are as shown in figure 2. Additionsly, CAD assitant can parse the material name correctly.
Any help is greatly appreciated.
Best regards,
Elle

Dmitrii Pasukhin's picture

It is not related. The issue with probably local conversion. Needs to specify which local to use.

Please take a look into src/Resource/Resource_FormatType.hxx

You can specify the waned local by

STEPCAFControl_Controller::Init();
Interface_Static::SetIVal("read.step.codepage", ...);

Best regards, Dmitrii.

Elle Edition's picture

Hello Dmitrii,
Thanks for your help, my problem could be solved with your suggestion.
Best regards,
Elle

Dmitrii Pasukhin's picture

Hello, in some cases (AP214 models created with not model structure, only shapRepresentation).

In that case needs to define special flag to extract model from not-default entities. If it is not your case, needs to have file sample to check the issue from OCC team,

STEPCAFControl_Controller::Init();
Interface_Static::SetIVal("read.step.shape.relationship", 1);

Best regards, Dmitrii.

zhang jiawang's picture

Hi, thank you help.

It is indeed the AP124 model.But I haven't solved the problem yet.I'm continuing to try to fix it and and reporting results.

Best regards, jiawang.

zhang jiawang's picture

Hello.
I tried the solution you provided,but not successed.
I did some deep debugging and found two exception as follows:

  • StepToTopoDS_TranslateEdgeLoop.cxx:350

    • Code snippet:
    Standard_Boolean istV = aTool.IsBound(Vstart);
    Standard_Boolean iseV = aTool.IsBound(Vend);
    TopoDS_Vertex V1, V2;
    StepToTopoDS_TranslateVertex myTranVertex1(Vstart, aTool, NMTool, theLocalFactors);
    StepToTopoDS_TranslateVertex myTranVertex2(Vend, aTool, NMTool, theLocalFactors);
    
    if (myTranVertex1.IsDone()) {
      V1 = TopoDS::Vertex(myTranVertex1.Value());
    }
    if (myTranVertex2.IsDone()) {
      V2 = TopoDS::Vertex(myTranVertex2.Value());
      gp_Pnt p1 = BRep_Tool::Pnt(V1);   
      gp_Pnt p2 = BRep_Tool::Pnt(V2);
      if (p1.Distance(p2) <= Precision::Confusion()) { //:S4136: preci) {
        Standard_Boolean Fixed = Standard_True;
        if (!iseV) aTool.Bind(Vend, V1); //gka 21.08.1998 bug PRO7656 
        else if (!istV)  aTool.Bind (Vstart, V2);
        else aTool.Bind (Vend, V1);
        if (!C1.IsNull() && !C1->IsClosed() && Fixed)
          TP->AddWarning(EL->EdgeListValue(j),
            "Vertex of same coordinates, set confused");
      }
    }
    
    • Tracking error and found:
      • 'V1' is empty.
      • "myTranVertex1" not done.
  • StepToTopoDS_TranslateEdge.cxx:286

    • Code snippet:
    TopoDS_Vertex V1, V2;
    
    StepToTopoDS_TranslateVertex myTranVertex1(Vstart, aTool, NMTool, theLocalFactors);
    StepToTopoDS_TranslateVertex myTranVertex2(Vend, aTool, NMTool, theLocalFactors);
    
    if (myTranVertex1.IsDone()) {
        V1 = TopoDS::Vertex(myTranVertex1.Value());
        V1.Orientation(TopAbs_FORWARD);
    }
    if (Vend == Vstart) {
        V2 = V1;
        V2.Orientation(TopAbs_REVERSED);
    }
    else if (myTranVertex2.IsDone()) {
        V2 = TopoDS::Vertex(myTranVertex2.Value());
        V2.Orientation(TopAbs_REVERSED);
    }
    done = Standard_True;
    
    • Tracking error and found:
      • "myTranVertex1" not done.

Best regards, jiawang.

Dmitrii Pasukhin's picture

If you will share step file, it will be easy to check. But yes, looks like a problem with not valid STEP file. Probably we can prepare some fix, but only in case if it will be some general solution.

Best regards, Dmitrii.

zhang jiawang's picture

I don't own the file, so I can't share it.

Dmitrii Pasukhin's picture

Without file we can't help you. You can only try to reproduce the issue with some public file. Or share file content related with Oriented_Edge.

Best regards, Dmitrii.