Select code page during STEP Import (#14416)
* [STEP Import] Added the ability to select the encoding of the source file when importing. Requires OCCT version 7.8.0 and higher * fix compile error for OCCT < 7.8.0 * Also hide label "CodePage" for OCCT < 7.8.0 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix error * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix error on Ubuntu 20-04 * Fix error on Ubuntu 20-04 --------- Co-authored-by: Kuzma30 <kuzemkoa@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
f413f5d6d0
commit
bf8e8b9157
@@ -42,7 +42,11 @@ ReaderStep::ReaderStep(const Base::FileInfo& file) // NOLINT
|
||||
: file {file}
|
||||
{}
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070800
|
||||
void ReaderStep::read(Handle(TDocStd_Document) hDoc) // NOLINT
|
||||
#else
|
||||
void ReaderStep::read(Handle(TDocStd_Document) hDoc, Resource_FormatType codePage) // NOLINT
|
||||
#endif
|
||||
{
|
||||
std::string utf8Name = file.filePath();
|
||||
std::string name8bit = Part::encodeFilename(utf8Name);
|
||||
@@ -51,7 +55,14 @@ void ReaderStep::read(Handle(TDocStd_Document) hDoc) // NOLINT
|
||||
aReader.SetNameMode(true);
|
||||
aReader.SetLayerMode(true);
|
||||
aReader.SetSHUOMode(true);
|
||||
#if OCC_VERSION_HEX < 0x070800
|
||||
if (aReader.ReadFile(name8bit.c_str()) != IFSelect_RetDone) {
|
||||
#else
|
||||
Handle(StepData_StepModel) aStepModel = new StepData_StepModel;
|
||||
aStepModel->InternalParameters.InitFromStatic();
|
||||
aStepModel->SetSourceCodePage(codePage);
|
||||
if (aReader.ReadFile(name8bit.c_str(), aStepModel->InternalParameters) != IFSelect_RetDone) {
|
||||
#endif
|
||||
throw Base::FileException("Cannot read STEP file", file);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user