Skip to content

Exception in debug mode when reading NIST-PMI-STEP-example nist_stc_07_asme1_ap242-e3.stp #383

@T-Dunker

Description

@T-Dunker

Description

When reading nist_stc_07_asme1_ap242-e3.stp in debug mode there is an exception in src/STEPCAFControl/STEPCAFControl_Reader.cxx line 3007.

            gp_Ax2 anA(aPnt, aDir, aDirR);

This is a correct behavior, as the two passed directions are colinear. The reason are in lines 3004-6.

            aDir.SetCoord(aDirArr->Lower(), aDirArr->Lower() + 1, aDirArr->Lower() + 2);
            aDirR.SetCoord(aDirRArr->Lower(), aDirRArr->Lower() + 1, aDirRArr->Lower() + 2);
            aPnt.SetCoord(aLocArr->Lower(), aLocArr->Lower() + 1, aLocArr->Lower() + 2);

There one passes consecutive indices instead of values. These lines need to be replaced by

            aDir.SetCoord(aDirArr->Value(aDirArr->Lower()),
                          aDirArr->Value(aDirArr->Lower() + 1),
                          aDirArr->Value(aDirArr->Lower() + 2));
            aDirR.SetCoord(aDirRArr->Value(aDirRArr->Lower()),
                           aDirRArr->Value(aDirRArr->Lower() + 1),
                           aDirRArr->Value(aDirRArr->Lower() + 2));
            aPnt.SetCoord(aLocArr->Value(aLocArr->Lower()),
                          aLocArr->Value(aLocArr->Lower() + 1),
                          aLocArr->Value(aLocArr->Lower() + 2));

Expected Behavior

STEPCAFControl_Reader::Transfer() without problem

Actual Behavior

Step Reader: Failed to transfer nodes
gp_Dir::CrossCross() - result vector has zero norm

Sample Code or DRAW Tcl Script

Handle(TDocStd_Document) doc;
Handle(XCAFApp_Application) app = XCAFApp_Application::GetApplication();
app->NewDocument("MDTV-XCAF", doc);
STEPCAFControl_Reader reader;
reader.SetColorMode(true);
reader.SetNameMode(true);
reader.SetLayerMode(false);
const auto status = reader.ReadFile("nist_stc_07_asme1_ap242-e3.stp"); // status == IFSelect_RetDone
try
{
auto success = reader.Transfer(doc); // success != Standard_False
}
catch (const std::exception& ex)
{
std::cout << ex.what();
}

Operating System

Windows

Compiler

MSVC

Bitness

64-bit

OCCT Version

7.8

Additional Files

nist_stc_07_asme1_ap242-e3.zip

Metadata

Metadata

Assignees

Labels

0. NewThe issue was created, but not updated by maintainer. Waiting for updates labels and categories1. Data ExchangeImport/Export or iterating of the CAD data2. BugSomething isn't working

Type

No type

Projects

Status

Closed

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions