Part: use ImportExportSettings in client code
This commit is contained in:
@@ -68,6 +68,7 @@
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObjectPy.h>
|
||||
#include <Mod/Part/App/OCAF/ImportExportSettings.h>
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
#include <Mod/Part/App/ProgressIndicator.h>
|
||||
#include <Mod/Part/App/ImportIges.h>
|
||||
@@ -316,7 +317,7 @@ private:
|
||||
}
|
||||
|
||||
if (legacy == Py_None) {
|
||||
Part::ImportExportSettings settings;
|
||||
Part::OCAF::ImportExportSettings settings;
|
||||
legacy = settings.getExportLegacy() ? Py_True : Py_False;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
#include <App/GroupExtension.h>
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
#include <Mod/Part/App/FeatureCompound.h>
|
||||
#include "ImportOCAF2.h"
|
||||
#include <Mod/Part/App/OCAF/ImportExportSettings.h>
|
||||
#include <Mod/Part/App/ProgressIndicator.h>
|
||||
#include <Mod/Part/App/ImportIges.h>
|
||||
#include <Mod/Part/App/ImportStep.h>
|
||||
@@ -72,6 +72,7 @@
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
#include <App/DocumentObjectGroup.h>
|
||||
#include "ImportOCAF2.h"
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x070500
|
||||
// See https://dev.opencascade.org/content/occt-3d-viewer-becomes-srgb-aware
|
||||
@@ -200,7 +201,7 @@ ImportOCAF2::~ImportOCAF2()
|
||||
|
||||
ImportOCAFOptions ImportOCAF2::customImportOptions()
|
||||
{
|
||||
Part::ImportExportSettings settings;
|
||||
Part::OCAF::ImportExportSettings settings;
|
||||
|
||||
ImportOCAFOptions defaultOptions;
|
||||
defaultOptions.merge = settings.getReadShapeCompoundMode();
|
||||
@@ -935,7 +936,7 @@ ExportOCAF2::ExportOCAF2(Handle(TDocStd_Document) h, GetShapeColorsFunc func)
|
||||
*/
|
||||
ExportOCAFOptions ExportOCAF2::customExportOptions()
|
||||
{
|
||||
Part::ImportExportSettings settings;
|
||||
Part::OCAF::ImportExportSettings settings;
|
||||
|
||||
ExportOCAFOptions defaultOptions;
|
||||
defaultOptions.exportHidden = settings.getExportHiddenObject();
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
#include <Gui/ViewProviderLink.h>
|
||||
#include <Mod/Import/App/ImportOCAF2.h>
|
||||
#include <Mod/Part/Gui/ViewProvider.h>
|
||||
#include <Mod/Part/App/OCAF/ImportExportSettings.h>
|
||||
#include <Mod/Part/App/encodeFilename.h>
|
||||
#include <Mod/Part/App/ImportIges.h>
|
||||
#include <Mod/Part/App/ImportStep.h>
|
||||
@@ -585,7 +586,7 @@ private:
|
||||
}
|
||||
|
||||
if (legacy == Py_None) {
|
||||
Part::ImportExportSettings settings;
|
||||
Part::OCAF::ImportExportSettings settings;
|
||||
legacy = settings.getExportLegacy() ? Py_True : Py_False;
|
||||
}
|
||||
|
||||
|
||||
@@ -181,6 +181,7 @@
|
||||
|
||||
#include <ShapeUpgrade/UnifySameDomainPy.h>
|
||||
|
||||
#include <OCAF/ImportExportSettings.h>
|
||||
|
||||
namespace Part {
|
||||
extern PyObject* initModule();
|
||||
@@ -539,7 +540,7 @@ PyMOD_INIT_FUNC(Part)
|
||||
IGESControl_Controller::Init();
|
||||
STEPControl_Controller::Init();
|
||||
|
||||
ImportExportSettings::initialize();
|
||||
OCAF::ImportExportSettings::initialize();
|
||||
|
||||
PyMOD_Return(partModule);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#endif
|
||||
|
||||
#include "ImportExportSettings.h"
|
||||
#include "Interface.h"
|
||||
#include <App/Application.h>
|
||||
|
||||
|
||||
@@ -38,6 +37,28 @@ ImportExportSettings::ImportExportSettings()
|
||||
pGroup = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Part/IGES");
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getSkipBlankEntities() const
|
||||
{
|
||||
return pGroup->GetBool("SkipBlankEntities", true);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setSkipBlankEntities(bool on) const
|
||||
{
|
||||
pGroup->SetBool("SkipBlankEntities", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getBRepMode() const
|
||||
{
|
||||
int value = Part::Interface::writeIgesBrepMode();
|
||||
return pGroup->GetBool("BrepMode", value > 0);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setBRepMode(bool on) const
|
||||
{
|
||||
pGroup->SetBool("BrepMode", on);
|
||||
Part::Interface::writeIgesBrepMode(on ? 1 : 0);
|
||||
}
|
||||
|
||||
Interface::Unit ImportExportSettings::getUnit() const
|
||||
{
|
||||
return static_cast<Interface::Unit>(pGroup->GetInt("Unit", 0));
|
||||
@@ -46,38 +67,29 @@ Interface::Unit ImportExportSettings::getUnit() const
|
||||
void ImportExportSettings::setUnit(Interface::Unit unit)
|
||||
{
|
||||
pGroup->SetInt("Unit", static_cast<long>(unit));
|
||||
|
||||
switch (unit) {
|
||||
case Interface::Unit::Meter:
|
||||
Interface_Static::SetCVal("write.step.unit","M");
|
||||
break;
|
||||
case Interface::Unit::Inch:
|
||||
Interface_Static::SetCVal("write.step.unit","INCH");
|
||||
break;
|
||||
default:
|
||||
Interface_Static::SetCVal("write.step.unit","MM");
|
||||
break;
|
||||
}
|
||||
Part::Interface::writeIgesUnit(unit);
|
||||
}
|
||||
|
||||
std::string ImportExportSettings::getCompany() const
|
||||
{
|
||||
return pGroup->GetASCII("Company");
|
||||
return pGroup->GetASCII("Company", Part::Interface::writeIgesHeaderCompany());
|
||||
}
|
||||
|
||||
void ImportExportSettings::setCompany(const char* name)
|
||||
{
|
||||
pGroup->SetASCII("Company", name);
|
||||
Part::Interface::writeIgesHeaderCompany(name);
|
||||
}
|
||||
|
||||
std::string ImportExportSettings::getAuthor() const
|
||||
{
|
||||
return pGroup->GetASCII("Author");
|
||||
return pGroup->GetASCII("Author", Part::Interface::writeIgesHeaderAuthor());
|
||||
}
|
||||
|
||||
void ImportExportSettings::setAuthor(const char* name)
|
||||
{
|
||||
pGroup->SetASCII("Author", name);
|
||||
Part::Interface::writeIgesHeaderAuthor(name);
|
||||
}
|
||||
|
||||
std::string ImportExportSettings::getProductName() const
|
||||
|
||||
@@ -37,6 +37,12 @@ class PartExport ImportExportSettings
|
||||
public:
|
||||
ImportExportSettings();
|
||||
|
||||
bool getSkipBlankEntities() const;
|
||||
void setSkipBlankEntities(bool) const;
|
||||
|
||||
bool getBRepMode() const;
|
||||
void setBRepMode(bool) const;
|
||||
|
||||
Interface::Unit getUnit() const;
|
||||
void setUnit(Interface::Unit);
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
# include <fcntl.h>
|
||||
# include <sstream>
|
||||
# include <BRep_Builder.hxx>
|
||||
# include <Interface_Static.hxx>
|
||||
# include <Quantity_Color.hxx>
|
||||
# include <STEPControl_Reader.hxx>
|
||||
# include <StepData_StepModel.hxx>
|
||||
@@ -54,306 +53,6 @@
|
||||
#include "ProgressIndicator.h"
|
||||
|
||||
|
||||
using namespace Part;
|
||||
|
||||
|
||||
void ImportExportSettings::initialize()
|
||||
{
|
||||
// set the user-defined settings
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part");
|
||||
initGeneral(hGrp);
|
||||
initSTEP(hGrp);
|
||||
initIGES(hGrp);
|
||||
}
|
||||
|
||||
void ImportExportSettings::initGeneral(Base::Reference<ParameterGrp> hGrp)
|
||||
{
|
||||
// General
|
||||
Base::Reference<ParameterGrp> hGenGrp = hGrp->GetGroup("General");
|
||||
// http://www.opencascade.org/org/forum/thread_20801/
|
||||
// read.surfacecurve.mode:
|
||||
// A preference for the computation of curves in an entity which has both 2D and 3D representation.
|
||||
// Each TopoDS_Edge in TopoDS_Face must have a 3D and 2D curve that references the surface.
|
||||
// If both 2D and 3D representation of the entity are present, the computation of these curves depends on
|
||||
// the following values of parameter:
|
||||
// 0: "Default" - no preference, both curves are taken
|
||||
// 3: "3DUse_Preferred" - 3D curves are used to rebuild 2D ones
|
||||
// Additional modes for IGES
|
||||
// 2: "2DUse_Preferred" - the 2D is used to rebuild the 3D in case of their inconsistency
|
||||
// -2: "2DUse_Forced" - the 2D is always used to rebuild the 3D (even if 2D is present in the file)
|
||||
// -3: "3DUse_Forced" - the 3D is always used to rebuild the 2D (even if 2D is present in the file)
|
||||
int readsurfacecurve = hGenGrp->GetInt("ReadSurfaceCurveMode", 0);
|
||||
Interface_Static::SetIVal("read.surfacecurve.mode", readsurfacecurve);
|
||||
|
||||
// write.surfacecurve.mode (STEP-only):
|
||||
// This parameter indicates whether parametric curves (curves in parametric space of surface) should be
|
||||
// written into the STEP file. This parameter can be set to Off in order to minimize the size of the resulting
|
||||
// STEP file.
|
||||
// Off (0) : writes STEP files without pcurves. This mode decreases the size of the resulting file.
|
||||
// On (1) : (default) writes pcurves to STEP file
|
||||
int writesurfacecurve = hGenGrp->GetInt("WriteSurfaceCurveMode", 0);
|
||||
Interface_Static::SetIVal("write.surfacecurve.mode", writesurfacecurve);
|
||||
}
|
||||
|
||||
void ImportExportSettings::initIGES(Base::Reference<ParameterGrp> hGrp)
|
||||
{
|
||||
//IGES handling
|
||||
Base::Reference<ParameterGrp> hIgesGrp = hGrp->GetGroup("IGES");
|
||||
int value = Interface_Static::IVal("write.iges.brep.mode");
|
||||
bool brep = hIgesGrp->GetBool("BrepMode", value > 0);
|
||||
Interface_Static::SetIVal("write.iges.brep.mode",brep ? 1 : 0);
|
||||
Interface_Static::SetCVal("write.iges.header.company", hIgesGrp->GetASCII("Company").c_str());
|
||||
Interface_Static::SetCVal("write.iges.header.author", hIgesGrp->GetASCII("Author").c_str());
|
||||
Interface_Static::SetCVal("write.iges.header.product", hIgesGrp->GetASCII("Product",
|
||||
Interface_Static::CVal("write.iges.header.product")).c_str());
|
||||
|
||||
int unitIges = hIgesGrp->GetInt("Unit", 0);
|
||||
switch (unitIges) {
|
||||
case 1:
|
||||
Interface_Static::SetCVal("write.iges.unit","M");
|
||||
break;
|
||||
case 2:
|
||||
Interface_Static::SetCVal("write.iges.unit","INCH");
|
||||
break;
|
||||
default:
|
||||
Interface_Static::SetCVal("write.iges.unit","MM");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ImportExportSettings::initSTEP(Base::Reference<ParameterGrp> hGrp)
|
||||
{
|
||||
//STEP handling
|
||||
Base::Reference<ParameterGrp> hStepGrp = hGrp->GetGroup("STEP");
|
||||
int unitStep = hStepGrp->GetInt("Unit", 0);
|
||||
switch (unitStep) {
|
||||
case 1:
|
||||
Interface_Static::SetCVal("write.step.unit","M");
|
||||
break;
|
||||
case 2:
|
||||
Interface_Static::SetCVal("write.step.unit","INCH");
|
||||
break;
|
||||
default:
|
||||
Interface_Static::SetCVal("write.step.unit","MM");
|
||||
break;
|
||||
}
|
||||
|
||||
std::string ap = hStepGrp->GetASCII("Scheme", Interface_Static::CVal("write.step.schema"));
|
||||
Interface_Static::SetCVal("write.step.schema", ap.c_str());
|
||||
Interface_Static::SetCVal("write.step.product.name", hStepGrp->GetASCII("Product",
|
||||
Interface_Static::CVal("write.step.product.name")).c_str());
|
||||
}
|
||||
|
||||
ImportExportSettings::ImportExportSettings()
|
||||
{
|
||||
pGroup = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Import");
|
||||
}
|
||||
|
||||
ParameterGrp::handle ImportExportSettings::getPartGroup() const
|
||||
{
|
||||
return App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Part");
|
||||
}
|
||||
|
||||
void ImportExportSettings::setWriteSurfaceCurveMode(bool on)
|
||||
{
|
||||
ParameterGrp::handle grp = getPartGroup()->GetGroup("General");
|
||||
grp->SetInt("WriteSurfaceCurveMode", on ? 1 : 0);
|
||||
Interface_Static::SetIVal("write.surfacecurve.mode", on ? 1 : 0);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getWriteSurfaceCurveMode() const
|
||||
{
|
||||
ParameterGrp::handle grp = getPartGroup()->GetGroup("General");
|
||||
int writesurfacecurve = Interface_Static::IVal("write.surfacecurve.mode");
|
||||
writesurfacecurve = grp->GetInt("WriteSurfaceCurveMode", writesurfacecurve);
|
||||
return (writesurfacecurve == 0 ? false : true);
|
||||
}
|
||||
|
||||
std::string ImportExportSettings::getScheme() const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hStepGrp = getPartGroup()->GetGroup("STEP");
|
||||
return hStepGrp->GetASCII("Scheme", Interface_Static::CVal("write.step.schema"));
|
||||
}
|
||||
|
||||
void ImportExportSettings::setScheme(const char* scheme)
|
||||
{
|
||||
Base::Reference<ParameterGrp> hStepGrp = getPartGroup()->GetGroup("STEP");
|
||||
hStepGrp->SetASCII("Scheme", scheme);
|
||||
Interface_Static::SetCVal("write.step.schema", scheme);
|
||||
}
|
||||
|
||||
ImportExportSettings::Unit ImportExportSettings::getUnit() const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hStepGrp = getPartGroup()->GetGroup("STEP");
|
||||
return static_cast<ImportExportSettings::Unit>(hStepGrp->GetInt("Unit", 0));
|
||||
}
|
||||
|
||||
void ImportExportSettings::setUnit(ImportExportSettings::Unit unit)
|
||||
{
|
||||
Base::Reference<ParameterGrp> hStepGrp = getPartGroup()->GetGroup("STEP");
|
||||
hStepGrp->SetInt("Unit", static_cast<long>(unit));
|
||||
|
||||
switch (unit) {
|
||||
case Unit::Meter:
|
||||
Interface_Static::SetCVal("write.step.unit","M");
|
||||
break;
|
||||
case Unit::Inch:
|
||||
Interface_Static::SetCVal("write.step.unit","INCH");
|
||||
break;
|
||||
default:
|
||||
Interface_Static::SetCVal("write.step.unit","MM");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::string ImportExportSettings::getCompany() const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hStepGrp = getPartGroup()->GetGroup("STEP");
|
||||
return hStepGrp->GetASCII("Company");
|
||||
}
|
||||
|
||||
void ImportExportSettings::setCompany(const char* name)
|
||||
{
|
||||
Base::Reference<ParameterGrp> hStepGrp = getPartGroup()->GetGroup("STEP");
|
||||
hStepGrp->SetASCII("Company", name);
|
||||
}
|
||||
|
||||
std::string ImportExportSettings::getAuthor() const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hStepGrp = getPartGroup()->GetGroup("STEP");
|
||||
return hStepGrp->GetASCII("Author");
|
||||
}
|
||||
|
||||
void ImportExportSettings::setAuthor(const char* name)
|
||||
{
|
||||
Base::Reference<ParameterGrp> hStepGrp = getPartGroup()->GetGroup("STEP");
|
||||
hStepGrp->SetASCII("Author", name);
|
||||
}
|
||||
|
||||
std::string ImportExportSettings::getProductName() const
|
||||
{
|
||||
return Interface_Static::CVal("write.step.product.name");
|
||||
}
|
||||
|
||||
void ImportExportSettings::setProductName(const char* name)
|
||||
{
|
||||
Interface_Static::SetCVal("write.step.product.name", name);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setReadShapeCompoundMode(bool on)
|
||||
{
|
||||
auto grp = pGroup->GetGroup("hSTEP");
|
||||
grp->SetBool("ReadShapeCompoundMode", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getReadShapeCompoundMode() const
|
||||
{
|
||||
auto grp = pGroup->GetGroup("hSTEP");
|
||||
return grp->GetBool("ReadShapeCompoundMode", false);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setExportHiddenObject(bool on)
|
||||
{
|
||||
pGroup->SetBool("ExportHiddenObject", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getExportHiddenObject() const
|
||||
{
|
||||
return pGroup->GetBool("ExportHiddenObject", true);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setImportHiddenObject(bool on)
|
||||
{
|
||||
pGroup->SetBool("ImportHiddenObject", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getImportHiddenObject() const
|
||||
{
|
||||
return pGroup->GetBool("ImportHiddenObject", true);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setExportLegacy(bool on)
|
||||
{
|
||||
pGroup->SetBool("ExportLegacy", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getExportLegacy() const
|
||||
{
|
||||
return pGroup->GetBool("ExportLegacy", false);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setExportKeepPlacement(bool on)
|
||||
{
|
||||
pGroup->SetBool("ExportKeepPlacement", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getExportKeepPlacement() const
|
||||
{
|
||||
return pGroup->GetBool("ExportKeepPlacement", false);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setUseLinkGroup(bool on)
|
||||
{
|
||||
pGroup->SetBool("UseLinkGroup", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getUseLinkGroup() const
|
||||
{
|
||||
return pGroup->GetBool("UseLinkGroup", false);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setUseBaseName(bool on)
|
||||
{
|
||||
pGroup->SetBool("UseBaseName", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getUseBaseName() const
|
||||
{
|
||||
return pGroup->GetBool("UseBaseName", true);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setReduceObjects(bool on)
|
||||
{
|
||||
pGroup->SetBool("ReduceObjects", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getReduceObjects() const
|
||||
{
|
||||
return pGroup->GetBool("ReduceObjects", false);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setExpandCompound(bool on)
|
||||
{
|
||||
pGroup->SetBool("ExpandCompound", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getExpandCompound() const
|
||||
{
|
||||
return pGroup->GetBool("ExpandCompound", false);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setShowProgress(bool on)
|
||||
{
|
||||
pGroup->SetBool("ShowProgress", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getShowProgress() const
|
||||
{
|
||||
return pGroup->GetBool("ShowProgress", true);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setImportMode(ImportExportSettings::ImportMode mode)
|
||||
{
|
||||
pGroup->SetInt("ImportMode", static_cast<long>(mode));
|
||||
}
|
||||
|
||||
ImportExportSettings::ImportMode ImportExportSettings::getImportMode() const
|
||||
{
|
||||
return static_cast<ImportExportSettings::ImportMode>(pGroup->GetInt("ImportMode", 0));
|
||||
}
|
||||
|
||||
|
||||
namespace Part {
|
||||
bool ReadColors (const Handle(XSControl_WorkSession) &WS, std::map<int, Quantity_Color>& hash_col);
|
||||
bool ReadNames (const Handle(XSControl_WorkSession) &WS);
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
#define _ImportStep_h_
|
||||
|
||||
#include <Mod/Part/PartGlobal.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
|
||||
namespace App {
|
||||
class Document;
|
||||
@@ -34,86 +32,6 @@ class Document;
|
||||
namespace Part
|
||||
{
|
||||
|
||||
class PartExport ImportExportSettings
|
||||
{
|
||||
public:
|
||||
enum class ImportMode {
|
||||
SingleDocument = 0,
|
||||
GroupPerDocument = 1,
|
||||
GroupPerDirectory = 2,
|
||||
ObjectPerDocument = 3,
|
||||
ObjectPerDirectory = 4,
|
||||
};
|
||||
enum class Unit {
|
||||
Millimeter = 0,
|
||||
Meter = 1,
|
||||
Inch = 2,
|
||||
};
|
||||
|
||||
static void initialize();
|
||||
ImportExportSettings();
|
||||
|
||||
void setWriteSurfaceCurveMode(bool);
|
||||
bool getWriteSurfaceCurveMode() const;
|
||||
|
||||
std::string getScheme() const;
|
||||
void setScheme(const char*);
|
||||
|
||||
Unit getUnit() const;
|
||||
void setUnit(Unit);
|
||||
|
||||
std::string getCompany() const;
|
||||
void setCompany(const char*);
|
||||
|
||||
std::string getAuthor() const;
|
||||
void setAuthor(const char*);
|
||||
|
||||
std::string getProductName() const;
|
||||
void setProductName(const char*);
|
||||
|
||||
void setReadShapeCompoundMode(bool);
|
||||
bool getReadShapeCompoundMode() const;
|
||||
|
||||
void setExportHiddenObject(bool);
|
||||
bool getExportHiddenObject() const;
|
||||
|
||||
void setImportHiddenObject(bool);
|
||||
bool getImportHiddenObject() const;
|
||||
|
||||
void setExportLegacy(bool);
|
||||
bool getExportLegacy() const;
|
||||
|
||||
void setExportKeepPlacement(bool);
|
||||
bool getExportKeepPlacement() const;
|
||||
|
||||
void setUseLinkGroup(bool);
|
||||
bool getUseLinkGroup() const;
|
||||
|
||||
void setUseBaseName(bool);
|
||||
bool getUseBaseName() const;
|
||||
|
||||
void setReduceObjects(bool);
|
||||
bool getReduceObjects() const;
|
||||
|
||||
void setExpandCompound(bool);
|
||||
bool getExpandCompound() const;
|
||||
|
||||
void setShowProgress(bool);
|
||||
bool getShowProgress() const;
|
||||
|
||||
void setImportMode(ImportMode);
|
||||
ImportMode getImportMode() const;
|
||||
|
||||
private:
|
||||
ParameterGrp::handle getPartGroup() const;
|
||||
static void initGeneral(Base::Reference<ParameterGrp> hGrp);
|
||||
static void initSTEP(Base::Reference<ParameterGrp> hGrp);
|
||||
static void initIGES(Base::Reference<ParameterGrp> hGrp);
|
||||
|
||||
private:
|
||||
ParameterGrp::handle pGroup;
|
||||
};
|
||||
|
||||
/** The part shape property
|
||||
*/
|
||||
PartExport int ImportStepParts(App::Document *pcDoc, const char* Name);
|
||||
|
||||
@@ -50,11 +50,36 @@ bool Interface::writeStepUnit(Standard_CString unit)
|
||||
return Interface_Static::SetCVal("write.step.unit", unit);
|
||||
}
|
||||
|
||||
bool Interface::writeStepUnit(Interface::Unit unit)
|
||||
{
|
||||
switch (unit) {
|
||||
case Interface::Unit::Meter:
|
||||
Interface_Static::SetCVal("write.step.unit","M");
|
||||
break;
|
||||
case Interface::Unit::Inch:
|
||||
Interface_Static::SetCVal("write.step.unit","INCH");
|
||||
break;
|
||||
default:
|
||||
Interface_Static::SetCVal("write.step.unit","MM");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_CString Interface::writeStepUnit()
|
||||
{
|
||||
return Interface_Static::CVal("write.step.unit");
|
||||
}
|
||||
|
||||
Standard_CString Interface::writeStepHeaderProduct()
|
||||
{
|
||||
return Interface_Static::CVal("write.step.product.name");
|
||||
}
|
||||
|
||||
bool Interface::writeStepHeaderProduct(Standard_CString name)
|
||||
{
|
||||
Interface_Static::SetCVal("write.step.product.name", name);
|
||||
}
|
||||
|
||||
Standard_CString Interface::writeIgesHeaderAuthor()
|
||||
{
|
||||
return Interface_Static::CVal("write.iges.header.author");
|
||||
|
||||
@@ -47,12 +47,20 @@ public:
|
||||
Inch = 2,
|
||||
};
|
||||
|
||||
/** STEP settings */
|
||||
//@{
|
||||
static void writeStepAssembly(Assembly);
|
||||
static Standard_CString writeStepScheme();
|
||||
static bool writeStepScheme(Standard_CString);
|
||||
static Standard_CString writeStepUnit();
|
||||
static bool writeStepUnit(Standard_CString);
|
||||
static bool writeStepUnit(Unit);
|
||||
static Standard_CString writeStepHeaderProduct();
|
||||
static bool writeStepHeaderProduct(Standard_CString);
|
||||
//@}
|
||||
|
||||
/** IGES settings */
|
||||
//@{
|
||||
static Standard_CString writeIgesHeaderAuthor();
|
||||
static bool writeIgesHeaderAuthor(Standard_CString);
|
||||
static Standard_CString writeIgesHeaderCompany();
|
||||
@@ -64,6 +72,7 @@ public:
|
||||
static bool writeIgesUnit(Unit);
|
||||
static int writeIgesBrepMode();
|
||||
static bool writeIgesBrepMode(int);
|
||||
//@}
|
||||
};
|
||||
|
||||
} //namespace Part
|
||||
|
||||
@@ -71,18 +71,7 @@ Interface::Unit ImportExportSettings::getUnit() const
|
||||
void ImportExportSettings::setUnit(Interface::Unit unit)
|
||||
{
|
||||
pGroup->SetInt("Unit", static_cast<long>(unit));
|
||||
|
||||
switch (unit) {
|
||||
case Interface::Unit::Meter:
|
||||
Interface_Static::SetCVal("write.step.unit","M");
|
||||
break;
|
||||
case Interface::Unit::Inch:
|
||||
Interface_Static::SetCVal("write.step.unit","INCH");
|
||||
break;
|
||||
default:
|
||||
Interface_Static::SetCVal("write.step.unit","MM");
|
||||
break;
|
||||
}
|
||||
Part::Interface::writeStepUnit(unit);
|
||||
}
|
||||
|
||||
std::string ImportExportSettings::getCompany() const
|
||||
@@ -107,12 +96,12 @@ void ImportExportSettings::setAuthor(const char* name)
|
||||
|
||||
std::string ImportExportSettings::getProductName() const
|
||||
{
|
||||
return Interface_Static::CVal("write.step.product.name");
|
||||
return Part::Interface::writeStepHeaderProduct();
|
||||
}
|
||||
|
||||
void ImportExportSettings::setProductName(const char* name)
|
||||
{
|
||||
Interface_Static::SetCVal("write.step.product.name", name);
|
||||
Part::Interface::writeStepHeaderProduct(name);
|
||||
}
|
||||
|
||||
} // namespace STEP
|
||||
|
||||
@@ -30,7 +30,9 @@
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Mod/Part/App/ImportStep.h>
|
||||
#include <Mod/Part/App/IGES/ImportExportSettings.h>
|
||||
#include <Mod/Part/App/STEP/ImportExportSettings.h>
|
||||
#include <Mod/Part/App/OCAF/ImportExportSettings.h>
|
||||
#include <Mod/Part/App/Interface.h>
|
||||
|
||||
#include "DlgSettingsGeneral.h"
|
||||
@@ -116,50 +118,39 @@ DlgImportExportIges::~DlgImportExportIges()
|
||||
|
||||
void DlgImportExportIges::saveSettings()
|
||||
{
|
||||
int unit = ui->comboBoxUnits->currentIndex();
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("IGES");
|
||||
hGrp->SetInt("Unit", unit);
|
||||
Part::Interface::writeIgesUnit(static_cast<Part::Interface::Unit>(unit));
|
||||
Part::IGES::ImportExportSettings settings;
|
||||
|
||||
hGrp->SetBool("BrepMode", bg->checkedId() == 1);
|
||||
Part::Interface::writeIgesBrepMode(bg->checkedId());
|
||||
int unit = ui->comboBoxUnits->currentIndex();
|
||||
settings.setUnit(static_cast<Part::Interface::Unit>(unit));
|
||||
settings.setBRepMode(bg->checkedId() == 1);
|
||||
|
||||
// Import
|
||||
hGrp->SetBool("SkipBlankEntities", ui->checkSkipBlank->isChecked());
|
||||
settings.setSkipBlankEntities(ui->checkSkipBlank->isChecked());
|
||||
|
||||
// header info
|
||||
hGrp->SetASCII("Company", ui->lineEditCompany->text().toLatin1());
|
||||
hGrp->SetASCII("Author", ui->lineEditAuthor->text().toLatin1());
|
||||
|
||||
Part::Interface::writeIgesHeaderAuthor(ui->lineEditAuthor->text().toLatin1());
|
||||
Part::Interface::writeIgesHeaderCompany(ui->lineEditCompany->text().toLatin1());
|
||||
settings.setCompany(ui->lineEditCompany->text().toLatin1());
|
||||
settings.setAuthor(ui->lineEditAuthor->text().toLatin1());
|
||||
}
|
||||
|
||||
void DlgImportExportIges::loadSettings()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("IGES");
|
||||
int unit = hGrp->GetInt("Unit", 0);
|
||||
ui->comboBoxUnits->setCurrentIndex(unit);
|
||||
Part::IGES::ImportExportSettings settings;
|
||||
|
||||
int value = Part::Interface::writeIgesBrepMode();
|
||||
bool brep = hGrp->GetBool("BrepMode", value > 0);
|
||||
ui->comboBoxUnits->setCurrentIndex(static_cast<int>(settings.getUnit()));
|
||||
|
||||
bool brep = settings.getBRepMode();
|
||||
if (brep)
|
||||
ui->radioButtonBRepOn->setChecked(true);
|
||||
else
|
||||
ui->radioButtonBRepOff->setChecked(true);
|
||||
|
||||
// Import
|
||||
ui->checkSkipBlank->setChecked(hGrp->GetBool("SkipBlankEntities", true));
|
||||
ui->checkSkipBlank->setChecked(settings.getSkipBlankEntities());
|
||||
|
||||
// header info
|
||||
ui->lineEditCompany->setText(QString::fromStdString(hGrp->GetASCII("Company",
|
||||
Part::Interface::writeIgesHeaderCompany())));
|
||||
ui->lineEditAuthor->setText(QString::fromStdString(hGrp->GetASCII("Author",
|
||||
Part::Interface::writeIgesHeaderAuthor())));
|
||||
ui->lineEditProduct->setText(QString::fromLatin1(
|
||||
Part::Interface::writeIgesHeaderProduct()));
|
||||
ui->lineEditCompany->setText(QString::fromStdString(settings.getCompany()));
|
||||
ui->lineEditAuthor->setText(QString::fromStdString(settings.getAuthor()));
|
||||
ui->lineEditProduct->setText(QString::fromStdString(settings.getProductName()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,7 +197,7 @@ DlgImportExportStep::DlgImportExportStep(QWidget* parent)
|
||||
authorValidator->setRegExp(rx);
|
||||
ui->lineEditAuthor->setValidator(authorValidator);
|
||||
|
||||
Part::ImportExportSettings settings;
|
||||
Part::OCAF::ImportExportSettings settings;
|
||||
ui->checkBoxMergeCompound->setChecked(settings.getReadShapeCompoundMode());
|
||||
ui->checkBoxExportHiddenObj->setChecked(settings.getExportHiddenObject());
|
||||
ui->checkBoxImportHiddenObj->setChecked(settings.getImportHiddenObject());
|
||||
@@ -230,12 +221,12 @@ DlgImportExportStep::~DlgImportExportStep()
|
||||
void DlgImportExportStep::saveSettings()
|
||||
{
|
||||
// General
|
||||
Part::ImportExportSettings settings;
|
||||
Part::STEP::ImportExportSettings settings;
|
||||
settings.setWriteSurfaceCurveMode(ui->checkBoxPcurves->isChecked());
|
||||
|
||||
// STEP
|
||||
int unit = ui->comboBoxUnits->currentIndex();
|
||||
settings.setUnit(static_cast<Part::ImportExportSettings::Unit>(unit));
|
||||
settings.setUnit(static_cast<Part::Interface::Unit>(unit));
|
||||
|
||||
// scheme
|
||||
// possible values: AP203, AP214CD (1996), AP214DIS (1998), AP214IS (2002), AP242DIS
|
||||
@@ -263,7 +254,7 @@ void DlgImportExportStep::saveSettings()
|
||||
void DlgImportExportStep::loadSettings()
|
||||
{
|
||||
// General
|
||||
Part::ImportExportSettings settings;
|
||||
Part::STEP::ImportExportSettings settings;
|
||||
ui->checkBoxPcurves->setChecked(settings.getWriteSurfaceCurveMode());
|
||||
|
||||
// STEP
|
||||
|
||||
Reference in New Issue
Block a user