diff --git a/src/Mod/Import/App/ReaderStep.cpp b/src/Mod/Import/App/ReaderStep.cpp index d7c7bf9ad7ae..db8613fac540 100644 --- a/src/Mod/Import/App/ReaderStep.cpp +++ b/src/Mod/Import/App/ReaderStep.cpp @@ -35,6 +35,7 @@ #include #include #include +#include using namespace Import; @@ -61,6 +62,12 @@ void ReaderStep::read(Handle(TDocStd_Document) hDoc) // NOLINT Handle(StepData_StepModel) aStepModel = new StepData_StepModel; aStepModel->InternalParameters.InitFromStatic(); aStepModel->SetSourceCodePage(codePage); + // These come from static init read of StepData_ConfParameters however + // https://dev.opencascade.org/content/stepcontrolreader-readprecisionvalue says it won't really + // affect shape healing performance - a 7.9+ version of OpenCascade might. + // aStepModel->InternalParameters.ReadMaxPrecisionMode = + // StepData_ConfParameters::ReadMode_MaxPrecision_Preferred ; // _Forced or _Preferred + // aStepModel->InternalParameters.ReadMaxPrecisionVal = Precision::Confusion(); if (aReader.ReadFile(name8bit.c_str(), aStepModel->InternalParameters) != IFSelect_RetDone) { #endif throw Base::FileException("Cannot read STEP file", file); @@ -72,6 +79,19 @@ void ReaderStep::read(Handle(TDocStd_Document) hDoc) // NOLINT pi->NewScope(100, "Reading STEP file..."); pi->Show(); #endif + // Documentation is at + // https://dev.opencascade.org/doc/overview/html/occt_user_guides__step.html#occt_step_2_3_3 + // in the section read.step.resource.name and read.step.sequence There is a hidden config file + // that controls how step processing is done, and can disable things like Shape Fixes - + // ShapeFix_Shape consumes about 25% of the transfer processing time. This code replaces that + // special file. Note that there are dozens of STEP loader control options in that file; see + // src/XSTEPResource/STEP in the OpenCascade source for an example. + if (!Interface_Static::SetCVal("read.step.sequence", "")) { + // We failed to override the step sequence, but there isn't really an advantage in throwing + // an exception or even issuing a warning message - just proceed with the default step read + // sequence which will be slower. + } + aReader.Transfer(hDoc); #if OCC_VERSION_HEX < 0x070500 pi->EndScope();