Skip to content
This repository was archived by the owner on Mar 1, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/Mod/Import/App/ReaderStep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <Base/Exception.h>
#include <Mod/Part/App/encodeFilename.h>
#include <Mod/Part/App/ProgressIndicator.h>
#include <Interface_Static.hxx>

using namespace Import;

Expand All @@ -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);
Expand All @@ -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();
Expand Down