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
@@ -164,6 +164,16 @@ private:
|
||||
if (mode < 0) {
|
||||
mode = ocaf.getMode();
|
||||
}
|
||||
#if OCC_VERSION_HEX >= 0x070800
|
||||
auto handle = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/Mod/Import/hSTEP");
|
||||
if (handle->GetBool("ReadShowDialogImport", false)) {
|
||||
Gui::Command::doCommand(Gui::Command::Gui,
|
||||
"Gui.showPreferences('Import-Export', 8)");
|
||||
}
|
||||
Part::OCAF::ImportExportSettings settings;
|
||||
Resource_FormatType cp = settings.getImportCodePage();
|
||||
#endif
|
||||
if (mode && !pcDoc->isSaved()) {
|
||||
auto gdoc = Gui::Application::Instance->getDocument(pcDoc);
|
||||
if (!gdoc->save()) {
|
||||
@@ -173,7 +183,11 @@ private:
|
||||
|
||||
try {
|
||||
Import::ReaderStep reader(file);
|
||||
#if OCC_VERSION_HEX < 0x070800
|
||||
reader.read(hDoc);
|
||||
#else
|
||||
reader.read(hDoc, cp);
|
||||
#endif
|
||||
}
|
||||
catch (OSD_Exception& e) {
|
||||
Base::Console().Error("%s\n", e.GetMessageString());
|
||||
@@ -483,7 +497,11 @@ private:
|
||||
|
||||
if (file.hasExtension({"stp", "step"})) {
|
||||
Import::ReaderStep reader(file);
|
||||
#if OCC_VERSION_HEX < 0x070800
|
||||
reader.read(hDoc);
|
||||
#else
|
||||
reader.read(hDoc, Resource_FormatType_UTF8);
|
||||
#endif
|
||||
}
|
||||
else if (file.hasExtension({"igs", "iges"})) {
|
||||
Import::ReaderIges reader(file);
|
||||
|
||||
Reference in New Issue
Block a user