Py::Object ParameterGrpPy::setUnsigned(const Py::Tuple& args) { char *pstr; unsigned int UInt; if (!PyArg_ParseTuple(args.ptr(), "sI", &pstr,&UInt)) throw Py::Exception(); _cParamGrp->SetUnsigned(pstr,UInt); return Py::None(); }
Py::Object ParameterGrpPy::setBool(const Py::Tuple& args) { char *pstr; int Bool; if (!PyArg_ParseTuple(args.ptr(), "si", &pstr,&Bool)) throw Py::Exception(); _cParamGrp->SetBool(pstr,Bool!=0); return Py::None(); }
Py::Object ParameterGrpPy::setInt(const Py::Tuple& args) { char *pstr; int Int; if (!PyArg_ParseTuple(args.ptr(), "si", &pstr,&Int)) throw Py::Exception(); _cParamGrp->SetInt(pstr,Int); return Py::None(); }
PyObject *ParameterGrpPy::PyNotify(PyObject *args) { char *pstr; if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C return NULL; // NULL triggers exception PY_TRY { _cParamGrp->Notify(pstr); Py_Return; }PY_CATCH; }
PyObject *ParameterGrpPy::PyNotifyAll(PyObject *args) { if (!PyArg_ParseTuple(args, "")) // convert args: Python->C return NULL; // NULL triggers exception PY_TRY { _cParamGrp->NotifyAll(); Py_Return; }PY_CATCH; }
PyObject *ParameterGrpPy::PyGetString(PyObject *args) { char *pstr; char * str=""; if (!PyArg_ParseTuple(args, "s|s", &pstr,&str)) // convert args: Python->C return NULL; // NULL triggers exception PY_TRY { return Py_BuildValue("s",_cParamGrp->GetASCII(pstr,str).c_str()); }PY_CATCH; }
PyObject *ParameterGrpPy::PyGetFloat(PyObject *args) { char *pstr; double Float=0.0; if (!PyArg_ParseTuple(args, "s|d", &pstr,&Float)) // convert args: Python->C return NULL; // NULL triggers exception PY_TRY { return Py_BuildValue("d",_cParamGrp->GetFloat(pstr,Float)); }PY_CATCH; }
PyObject *ParameterGrpPy::PyGetUnsigned(PyObject *args) { char *pstr; unsigned long UInt=0; if (!PyArg_ParseTuple(args, "s|I", &pstr,&UInt)) // convert args: Python->C return NULL; // NULL triggers exception PY_TRY { return Py_BuildValue("I",_cParamGrp->GetUnsigned(pstr,UInt)); }PY_CATCH; }
PyObject *ParameterGrpPy::PyGetInt(PyObject *args) { char *pstr; long Int=0; if (!PyArg_ParseTuple(args, "s|i", &pstr,&Int)) // convert args: Python->C return NULL; // NULL triggers exception PY_TRY { return Py_BuildValue("i",_cParamGrp->GetInt(pstr,Int)); }PY_CATCH; }
Py::Object ParameterGrpPy::setFloat(const Py::Tuple& args) { char *pstr; double Float; if (!PyArg_ParseTuple(args.ptr(), "sd", &pstr,&Float)) throw Py::Exception(); _cParamGrp->SetFloat(pstr,Float); return Py::None(); }
PyObject *ParameterGrpPy::PySetString(PyObject *args) { char *pstr; char * str; if (!PyArg_ParseTuple(args, "ss", &pstr,&str)) // convert args: Python->C return NULL; // NULL triggers exception PY_TRY { _cParamGrp->SetASCII(pstr,str); Py_Return; }PY_CATCH; }
PyObject *ParameterGrpPy::PySetFloat(PyObject *args) { char *pstr; double Float; if (!PyArg_ParseTuple(args, "sd", &pstr,&Float)) // convert args: Python->C return NULL; // NULL triggers exception PY_TRY { _cParamGrp->SetFloat(pstr,Float); Py_Return; }PY_CATCH; }
PyObject *ParameterGrpPy::PySetUnsigned(PyObject *args) { char *pstr; unsigned long UInt; if (!PyArg_ParseTuple(args, "sI", &pstr,&UInt)) // convert args: Python->C return NULL; // NULL triggers exception PY_TRY { _cParamGrp->SetUnsigned(pstr,UInt); Py_Return; }PY_CATCH; }
PyObject *ParameterGrpPy::PyGetGrp(PyObject *args) { char *pstr; if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C return NULL; // NULL triggers exception PY_TRY { // get the Handle of the wanted group Base::Reference<ParameterGrp> handle = _cParamGrp->GetGroup(pstr); if(handle.isValid()){ // crate a python wrapper class ParameterGrpPy *pcParamGrp = new ParameterGrpPy(handle); // increment the reff count //pcParamGrp->_INCREF(); return pcParamGrp; }else{ PyErr_SetString(PyExc_IOError, "GetGroup failed"); return 0L; } }PY_CATCH; }
PyObject *ParameterGrpPy::PySetBool(PyObject *args) { char *pstr; int Bool; if (!PyArg_ParseTuple(args, "si", &pstr,&Bool)) // convert args: Python->C return NULL; // NULL triggers exception PY_TRY { _cParamGrp->SetBool(pstr,Bool!=0); Py_Return; }PY_CATCH; }
DrawViewSpreadsheet::DrawViewSpreadsheet(void) { static const char *vgroup = "Spreadsheet"; Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Labels"); std::string fontName = hGrp->GetASCII("LabelFont", "Sans"); ADD_PROPERTY_TYPE(Source ,(0),vgroup,App::Prop_None,"Spreadsheet to view"); ADD_PROPERTY_TYPE(CellStart ,("A1"),vgroup,App::Prop_None,"The top left cell of the range to display"); ADD_PROPERTY_TYPE(CellEnd ,("B2"),vgroup,App::Prop_None,"The bottom right cell of the range to display"); ADD_PROPERTY_TYPE(Font ,((fontName.c_str())),vgroup,App::Prop_None,"The name of the font to use"); ADD_PROPERTY_TYPE(TextColor,(0.0f,0.0f,0.0f),vgroup,App::Prop_None,"The default color of the text and lines"); ADD_PROPERTY_TYPE(TextSize,(12.0),vgroup,App::Prop_None,"The size of the text"); ADD_PROPERTY_TYPE(LineWidth,(0.35),vgroup,App::Prop_None,"The thickness of the cell lines"); //ADD_PROPERTY_TYPE(Symbol,(""),vgroup,App::Prop_Hidden,"The SVG image of this spreadsheet"); EditableTexts.setStatus(App::Property::Hidden,true); }
QColor QGCustomText::getNormalColor() { QColor result; QGIView *parent; QGraphicsItem* qparent = parentItem(); if (qparent == nullptr) { parent = nullptr; } else { parent = dynamic_cast<QGIView *> (qparent); } if (parent != nullptr) { result = parent->getNormalColor(); } else { Base::Reference<ParameterGrp> hGrp = getParmGroup(); App::Color fcColor; fcColor.setPackedValue(hGrp->GetUnsigned("NormalColor", 0x00000000)); result = fcColor.asValue<QColor>(); } return result; }
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); int value = Interface_Static::IVal("write.iges.brep.mode"); bool brep = hGrp->GetBool("BrepMode", value > 0); if (brep) ui->radioButtonBRepOn->setChecked(true); else ui->radioButtonBRepOff->setChecked(true); // Import ui->checkSkipBlank->setChecked(hGrp->GetBool("SkipBlankEntities", true)); // header info ui->lineEditCompany->setText(QString::fromStdString(hGrp->GetASCII("Company", Interface_Static::CVal("write.iges.header.company")))); ui->lineEditAuthor->setText(QString::fromStdString(hGrp->GetASCII("Author", Interface_Static::CVal("write.iges.header.author")))); //ui->lineEditProduct->setText(QString::fromStdString(hGrp->GetASCII("Product"))); ui->lineEditProduct->setText(QString::fromLatin1( Interface_Static::CVal("write.iges.header.product"))); }
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); switch (unit) { case 1: Interface_Static::SetCVal("write.iges.unit","M"); break; case 2: Interface_Static::SetCVal("write.iges.unit","IN"); break; default: Interface_Static::SetCVal("write.iges.unit","MM"); break; } hGrp->SetBool("BrepMode", bg->checkedId() == 1); Interface_Static::SetIVal("write.iges.brep.mode", bg->checkedId()); // Import hGrp->SetBool("SkipBlankEntities", ui->checkSkipBlank->isChecked()); // header info hGrp->SetASCII("Company", ui->lineEditCompany->text().toLatin1()); hGrp->SetASCII("Author", ui->lineEditAuthor->text().toLatin1()); //hGrp->SetASCII("Product", ui->lineEditProduct->text().toLatin1()); Interface_Static::SetCVal("write.iges.header.company", ui->lineEditCompany->text().toLatin1()); Interface_Static::SetCVal("write.iges.header.author", ui->lineEditAuthor->text().toLatin1()); //Interface_Static::SetCVal("write.iges.header.product", ui->lineEditProduct->text().toLatin1()); }
DrawViewAnnotation::DrawViewAnnotation(void) { static const char *vgroup = "Annotation"; Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Labels"); std::string fontName = hGrp->GetASCII("LabelFont", "osifont"); ADD_PROPERTY_TYPE(Text ,("Default Text"),vgroup,App::Prop_None,"The text to be displayed"); ADD_PROPERTY_TYPE(Font ,(fontName.c_str()),vgroup,App::Prop_None, "The name of the font to use"); ADD_PROPERTY_TYPE(TextColor,(0.0f,0.0f,0.0f),vgroup,App::Prop_None,"The color of the text"); ADD_PROPERTY_TYPE(TextSize,(8.0),vgroup,App::Prop_None,"The size of the text in units"); ADD_PROPERTY_TYPE(MaxWidth,(-1.0),vgroup,App::Prop_None,"The maximum width of the Annotation block"); ADD_PROPERTY_TYPE(LineSpace,(80),vgroup,App::Prop_None,"Line spacing adjustment. 100 is normal spacing."); TextStyle.setEnums(TextStyleEnums); ADD_PROPERTY(TextStyle, ((long)0)); Scale.setStatus(App::Property::Hidden,true); ScaleType.setStatus(App::Property::Hidden,true); }
DrawHatch::DrawHatch(void) { static const char *vgroup = "Hatch"; ADD_PROPERTY_TYPE(DirProjection ,(0,0,1.0) ,vgroup,App::Prop_None,"Projection direction when Hatch was defined"); //sb RO? ADD_PROPERTY_TYPE(Source,(0),vgroup,(App::PropertyType)(App::Prop_None),"The View + Face to be hatched"); ADD_PROPERTY_TYPE(HatchPattern ,(""),vgroup,App::Prop_None,"The hatch pattern file for this area"); ADD_PROPERTY_TYPE(HatchColor,(0.0f,0.0f,0.0f),vgroup,App::Prop_None,"The color of the hatch pattern"); Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw"); std::string defaultDir = App::Application::getResourceDir() + "Mod/Drawing/patterns/"; std::string defaultFileName = defaultDir + "simple.svg"; QString patternFileName = QString::fromStdString(hGrp->GetASCII("PatternFile",defaultFileName.c_str())); if (patternFileName.isEmpty()) { patternFileName = QString::fromStdString(defaultFileName); } QFileInfo tfi(patternFileName); if (tfi.isReadable()) { HatchPattern.setValue(patternFileName.toUtf8().constData()); } }
QString DownloadItem::getDownloadDirectory() const { QString exe = QString::fromLatin1(App::GetApplication().getExecutableName()); #if QT_VERSION >= 0x050000 QString path = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); #else QString path = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); #endif QString dirPath = QDir(path).filePath(exe); Base::Reference<ParameterGrp> hPath = App::GetApplication().GetUserParameter().GetGroup("BaseApp") ->GetGroup("Preferences")->GetGroup("General"); std::string dir = hPath->GetASCII("DownloadPath", ""); if (!dir.empty()) { dirPath = QString::fromUtf8(dir.c_str()); } if (QFileInfo(dirPath).exists() || QDir().mkpath(dirPath)) { return dirPath; } else { return path; } }
void DrawViewSection::getParameters() { Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors"); App::Color cutColor = App::Color((uint32_t) hGrp->GetUnsigned("CutSurfaceColor", 0xC8C8C800)); CutSurfaceColor.setValue(cutColor); App::Color hatchColor = App::Color((uint32_t) hGrp->GetUnsigned("SectionHatchColor", 0x00000000)); HatchColor.setValue(hatchColor); hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw"); std::string defaultDir = App::Application::getResourceDir() + "Mod/Drawing/patterns/"; std::string defaultFileName = defaultDir + "simple.svg"; QString patternFileName = QString::fromStdString(hGrp->GetASCII("PatternFile",defaultFileName.c_str())); if (patternFileName.isEmpty()) { patternFileName = QString::fromStdString(defaultFileName); } QFileInfo tfi(patternFileName); if (tfi.isReadable()) { HatchPattern.setValue(patternFileName.toUtf8().constData()); } }
void ParameterGrp::insertTo(Base::Reference<ParameterGrp> Grp) { // copy group std::vector<Base::Reference<ParameterGrp> > Grps = GetGroups(); std::vector<Base::Reference<ParameterGrp> >::iterator It1; for (It1 = Grps.begin();It1 != Grps.end();++It1) (*It1)->insertTo(Grp->GetGroup((*It1)->GetGroupName())); // copy strings std::vector<std::pair<std::string,std::string> > StringMap = GetASCIIMap(); std::vector<std::pair<std::string,std::string> >::iterator It2; for (It2 = StringMap.begin();It2 != StringMap.end();++It2) Grp->SetASCII(It2->first.c_str(),It2->second.c_str()); // copy bool std::vector<std::pair<std::string,bool> > BoolMap = GetBoolMap(); std::vector<std::pair<std::string,bool> >::iterator It3; for (It3 = BoolMap.begin();It3 != BoolMap.end();++It3) Grp->SetBool(It3->first.c_str(),It3->second); // copy int std::vector<std::pair<std::string,long> > IntMap = GetIntMap(); std::vector<std::pair<std::string,long> >::iterator It4; for (It4 = IntMap.begin();It4 != IntMap.end();++It4) Grp->SetInt(It4->first.c_str(),It4->second); // copy float std::vector<std::pair<std::string,double> > FloatMap = GetFloatMap(); std::vector<std::pair<std::string,double> >::iterator It5; for (It5 = FloatMap.begin();It5 != FloatMap.end();++It5) Grp->SetFloat(It5->first.c_str(),It5->second); // copy uint std::vector<std::pair<std::string,unsigned long> > UIntMap = GetUnsignedMap(); std::vector<std::pair<std::string,unsigned long> >::iterator It6; for (It6 = UIntMap.begin();It6 != UIntMap.end();++It6) Grp->SetUnsigned(It6->first.c_str(),It6->second); }
void PartExport initPart() { std::stringstream str; str << OCC_VERSION_MAJOR << "." << OCC_VERSION_MINOR << "." << OCC_VERSION_MAINTENANCE; #ifdef OCC_VERSION_DEVELOPMENT str << "." OCC_VERSION_DEVELOPMENT; #endif App::Application::Config()["OCC_VERSION"] = str.str(); Base::Console().Log("Module: Part\n"); // This is highly experimental and we should keep an eye on it // if we have mysterious crashes // The argument must be 'Standard_False' to avoid FPE caused by // Python's cmath module. #if !defined(_DEBUG) OSD::SetSignal(Standard_False); #endif PyObject* partModule = Py_InitModule3("Part", Part_methods, module_part_doc); /* mod name, table ptr */ Base::Console().Log("Loading Part module... done\n"); PyObject* OCCError = 0; if (PyObject_IsSubclass(Base::BaseExceptionFreeCADError, PyExc_RuntimeError)) { OCCError = PyErr_NewException("Part.OCCError", Base::BaseExceptionFreeCADError, NULL); } else { Base::Console().Error("Can not inherit Part.OCCError form BaseFreeCADError.\n"); OCCError = PyErr_NewException("Part.OCCError", PyExc_RuntimeError, NULL); } Py_INCREF(OCCError); PyModule_AddObject(partModule, "OCCError", OCCError); PartExceptionOCCError = OCCError; //set global variable ;( PartExceptionOCCDomainError = PyErr_NewException("Part.OCCDomainError", PartExceptionOCCError, NULL); Py_INCREF(PartExceptionOCCDomainError); PyModule_AddObject(partModule, "OCCDomainError", PartExceptionOCCDomainError); PartExceptionOCCRangeError = PyErr_NewException("Part.OCCRangeError", PartExceptionOCCDomainError, NULL); Py_INCREF(PartExceptionOCCRangeError); PyModule_AddObject(partModule, "OCCRangeError", PartExceptionOCCRangeError); PartExceptionOCCConstructionError = PyErr_NewException( "Part.OCCConstructionError", PartExceptionOCCDomainError, NULL); Py_INCREF(PartExceptionOCCConstructionError); PyModule_AddObject(partModule, "OCCConstructionError", PartExceptionOCCConstructionError); PartExceptionOCCDimensionError = PyErr_NewException( "Part.OCCDimensionError", PartExceptionOCCDomainError, NULL); Py_INCREF(PartExceptionOCCConstructionError); PyModule_AddObject(partModule, "OCCDimensionError", PartExceptionOCCDimensionError); //rename the types properly to pickle and unpickle them Part::TopoShapePy ::Type.tp_name = "Part.Shape"; Part::TopoShapeVertexPy ::Type.tp_name = "Part.Vertex"; Part::TopoShapeWirePy ::Type.tp_name = "Part.Wire"; Part::TopoShapeEdgePy ::Type.tp_name = "Part.Edge"; Part::TopoShapeSolidPy ::Type.tp_name = "Part.Solid"; Part::TopoShapeFacePy ::Type.tp_name = "Part.Face"; Part::TopoShapeCompoundPy ::Type.tp_name = "Part.Compound"; Part::TopoShapeCompSolidPy::Type.tp_name = "Part.CompSolid"; Part::TopoShapeShellPy ::Type.tp_name = "Part.Shell"; // Add Types to module Base::Interpreter().addType(&Part::TopoShapePy ::Type,partModule,"Shape"); Base::Interpreter().addType(&Part::TopoShapeVertexPy ::Type,partModule,"Vertex"); Base::Interpreter().addType(&Part::TopoShapeWirePy ::Type,partModule,"Wire"); Base::Interpreter().addType(&Part::TopoShapeEdgePy ::Type,partModule,"Edge"); Base::Interpreter().addType(&Part::TopoShapeSolidPy ::Type,partModule,"Solid"); Base::Interpreter().addType(&Part::TopoShapeFacePy ::Type,partModule,"Face"); Base::Interpreter().addType(&Part::TopoShapeCompoundPy ::Type,partModule,"Compound"); Base::Interpreter().addType(&Part::TopoShapeCompSolidPy ::Type,partModule,"CompSolid"); Base::Interpreter().addType(&Part::TopoShapeShellPy ::Type,partModule,"Shell"); Base::Interpreter().addType(&Part::LinePy ::Type,partModule,"Line"); Base::Interpreter().addType(&Part::PointPy ::Type,partModule,"Point"); Base::Interpreter().addType(&Part::CirclePy ::Type,partModule,"Circle"); Base::Interpreter().addType(&Part::EllipsePy ::Type,partModule,"Ellipse"); Base::Interpreter().addType(&Part::HyperbolaPy ::Type,partModule,"Hyperbola"); Base::Interpreter().addType(&Part::ParabolaPy ::Type,partModule,"Parabola"); Base::Interpreter().addType(&Part::ArcPy ::Type,partModule,"Arc"); Base::Interpreter().addType(&Part::ArcOfCirclePy ::Type,partModule,"ArcOfCircle"); Base::Interpreter().addType(&Part::ArcOfEllipsePy ::Type,partModule,"ArcOfEllipse"); Base::Interpreter().addType(&Part::ArcOfParabolaPy ::Type,partModule,"ArcOfParabola"); Base::Interpreter().addType(&Part::ArcOfHyperbolaPy ::Type,partModule,"ArcOfHyperbola"); Base::Interpreter().addType(&Part::BezierCurvePy ::Type,partModule,"BezierCurve"); Base::Interpreter().addType(&Part::BSplineCurvePy ::Type,partModule,"BSplineCurve"); Base::Interpreter().addType(&Part::OffsetCurvePy ::Type,partModule,"OffsetCurve"); Base::Interpreter().addType(&Part::PlanePy ::Type,partModule,"Plane"); Base::Interpreter().addType(&Part::CylinderPy ::Type,partModule,"Cylinder"); Base::Interpreter().addType(&Part::ConePy ::Type,partModule,"Cone"); Base::Interpreter().addType(&Part::SpherePy ::Type,partModule,"Sphere"); Base::Interpreter().addType(&Part::ToroidPy ::Type,partModule,"Toroid"); Base::Interpreter().addType(&Part::BezierSurfacePy ::Type,partModule,"BezierSurface"); Base::Interpreter().addType(&Part::BSplineSurfacePy ::Type,partModule,"BSplineSurface"); Base::Interpreter().addType(&Part::OffsetSurfacePy ::Type,partModule,"OffsetSurface"); Base::Interpreter().addType(&Part::SurfaceOfExtrusionPy ::Type,partModule,"SurfaceOfExtrusion"); Base::Interpreter().addType(&Part::SurfaceOfRevolutionPy::Type,partModule,"SurfaceOfRevolution"); Base::Interpreter().addType(&Part::RectangularTrimmedSurfacePy ::Type,partModule,"RectangularTrimmedSurface"); Base::Interpreter().addType(&Part::PartFeaturePy ::Type,partModule,"Feature"); PyObject* brepModule = Py_InitModule3("BRepOffsetAPI", 0, "BrepOffsetAPI"); Py_INCREF(brepModule); PyModule_AddObject(partModule, "BRepOffsetAPI", brepModule); Base::Interpreter().addType(&Part::BRepOffsetAPI_MakePipeShellPy::Type,brepModule,"MakePipeShell"); Part::TopoShape ::init(); Part::PropertyPartShape ::init(); Part::PropertyGeometryList ::init(); Part::PropertyShapeHistory ::init(); Part::PropertyFilletEdges ::init(); Part::Feature ::init(); Part::FeatureExt ::init(); Part::FeaturePython ::init(); Part::FeatureGeometrySet ::init(); Part::CustomFeature ::init(); Part::CustomFeaturePython ::init(); Part::Primitive ::init(); Part::Box ::init(); Part::Fractal ::init(); Part::Spline ::init(); Part::Boolean ::init(); Part::Common ::init(); Part::MultiCommon ::init(); Part::Cut ::init(); Part::Fuse ::init(); Part::MultiFuse ::init(); Part::Section ::init(); Part::FilletBase ::init(); Part::Fillet ::init(); Part::Chamfer ::init(); Part::Compound ::init(); Part::Extrusion ::init(); Part::Revolution ::init(); Part::Mirroring ::init(); Part::ImportStep ::init(); Part::ImportIges ::init(); Part::ImportBrep ::init(); Part::CurveNet ::init(); Part::Polygon ::init(); Part::Circle ::init(); Part::Ellipse ::init(); Part::Vertex ::init(); Part::Line ::init(); Part::Ellipsoid ::init(); Part::Plane ::init(); Part::Sphere ::init(); Part::Cylinder ::init(); Part::Prism ::init(); Part::RegularPolygon ::init(); Part::Cone ::init(); Part::Torus ::init(); Part::Helix ::init(); Part::Spiral ::init(); Part::Wedge ::init(); Part::Part2DObject ::init(); Part::Part2DObjectPython ::init(); Part::RuledSurface ::init(); Part::Loft ::init(); Part::Sweep ::init(); Part::Offset ::init(); Part::Thickness ::init(); // Geometry types Part::Geometry ::init(); Part::GeomPoint ::init(); Part::GeomCurve ::init(); Part::GeomBezierCurve ::init(); Part::GeomBSplineCurve ::init(); Part::GeomCircle ::init(); Part::GeomArcOfCircle ::init(); Part::GeomArcOfEllipse ::init(); Part::GeomArcOfParabola ::init(); Part::GeomArcOfHyperbola ::init(); Part::GeomEllipse ::init(); Part::GeomHyperbola ::init(); Part::GeomParabola ::init(); Part::GeomLine ::init(); Part::GeomLineSegment ::init(); Part::GeomOffsetCurve ::init(); Part::GeomTrimmedCurve ::init(); Part::GeomSurface ::init(); Part::GeomBezierSurface ::init(); Part::GeomBSplineSurface ::init(); Part::GeomCylinder ::init(); Part::GeomCone ::init(); Part::GeomSphere ::init(); Part::GeomToroid ::init(); Part::GeomPlane ::init(); Part::GeomOffsetSurface ::init(); Part::GeomTrimmedSurface ::init(); Part::GeomSurfaceOfRevolution ::init(); Part::GeomSurfaceOfExtrusion ::init(); IGESControl_Controller::Init(); STEPControl_Controller::Init(); // set the user-defined settings Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); // 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", 1); Interface_Static::SetIVal("write.surfacecurve.mode", writesurfacecurve); //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").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","IN"); break; default: Interface_Static::SetCVal("write.iges.unit","MM"); break; } //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","IN"); 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()); }
static PyObject * importer(PyObject *self, PyObject *args) { char* Name; char* DocName=0; if (!PyArg_ParseTuple(args, "et|s","utf-8",&Name,&DocName)) return 0; std::string Utf8Name = std::string(Name); PyMem_Free(Name); std::string name8bit = Part::encodeFilename(Utf8Name); PY_TRY { //Base::Console().Log("Insert in Part with %s",Name); Base::FileInfo file(Utf8Name.c_str()); App::Document *pcDoc = 0; if (DocName) { pcDoc = App::GetApplication().getDocument(DocName); } if (!pcDoc) { pcDoc = App::GetApplication().newDocument("Unnamed"); } Handle(XCAFApp_Application) hApp = XCAFApp_Application::GetApplication(); Handle(TDocStd_Document) hDoc; hApp->NewDocument(TCollection_ExtendedString("MDTV-CAF"), hDoc); if (file.hasExtension("stp") || file.hasExtension("step")) { try { STEPCAFControl_Reader aReader; aReader.SetColorMode(true); aReader.SetNameMode(true); aReader.SetLayerMode(true); if (aReader.ReadFile((const char*)name8bit.c_str()) != IFSelect_RetDone) { PyErr_SetString(Base::BaseExceptionFreeCADError, "cannot read STEP file"); return 0; } Handle_Message_ProgressIndicator pi = new Part::ProgressIndicator(100); aReader.Reader().WS()->MapReader()->SetProgress(pi); pi->NewScope(100, "Reading STEP file..."); pi->Show(); aReader.Transfer(hDoc); pi->EndScope(); } catch (OSD_Exception) { Handle_Standard_Failure e = Standard_Failure::Caught(); Base::Console().Error("%s\n", e->GetMessageString()); Base::Console().Message("Try to load STEP file without colors...\n"); Part::ImportStepParts(pcDoc,Utf8Name.c_str()); pcDoc->recompute(); } } else if (file.hasExtension("igs") || file.hasExtension("iges")) { Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("IGES"); try { IGESControl_Controller::Init(); IGESCAFControl_Reader aReader; // http://www.opencascade.org/org/forum/thread_20603/?forum=3 aReader.SetReadVisible(hGrp->GetBool("SkipBlankEntities", true) ? Standard_True : Standard_False); aReader.SetColorMode(true); aReader.SetNameMode(true); aReader.SetLayerMode(true); if (aReader.ReadFile((const char*)name8bit.c_str()) != IFSelect_RetDone) { PyErr_SetString(Base::BaseExceptionFreeCADError, "cannot read IGES file"); return 0; } Handle_Message_ProgressIndicator pi = new Part::ProgressIndicator(100); aReader.WS()->MapReader()->SetProgress(pi); pi->NewScope(100, "Reading IGES file..."); pi->Show(); aReader.Transfer(hDoc); pi->EndScope(); } catch (OSD_Exception) { Handle_Standard_Failure e = Standard_Failure::Caught(); Base::Console().Error("%s\n", e->GetMessageString()); Base::Console().Message("Try to load IGES file without colors...\n"); Part::ImportIgesParts(pcDoc,Utf8Name.c_str()); pcDoc->recompute(); } } else { PyErr_SetString(Base::BaseExceptionFreeCADError, "no supported file format"); return 0; } ImportOCAFExt ocaf(hDoc, pcDoc, file.fileNamePure()); ocaf.loadShapes(); pcDoc->recompute(); } catch (Standard_Failure) {
App::DocumentObjectExecReturn *MultiFuse::execute(void) { std::vector<TopoDS_Shape> s; std::vector<App::DocumentObject*> obj = Shapes.getValues(); std::vector<App::DocumentObject*>::iterator it; for (it = obj.begin(); it != obj.end(); ++it) { if ((*it)->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) { s.push_back(static_cast<Part::Feature*>(*it)->Shape.getValue()); } } bool argumentsAreInCompound = false; TopoDS_Shape compoundOfArguments; //if only one source shape, and it is a compound - fuse children of the compound if (s.size() == 1){ compoundOfArguments = s[0]; if (compoundOfArguments.ShapeType() == TopAbs_COMPOUND){ s.clear(); TopoDS_Iterator it(compoundOfArguments); for (; it.More(); it.Next()) { const TopoDS_Shape& aChild = it.Value(); s.push_back(aChild); } argumentsAreInCompound = true; } } if (s.size() >= 2) { try { std::vector<ShapeHistory> history; #if OCC_VERSION_HEX <= 0x060800 TopoDS_Shape resShape = s.front(); if (resShape.IsNull()) throw Base::Exception("Input shape is null"); for (std::vector<TopoDS_Shape>::iterator it = s.begin()+1; it != s.end(); ++it) { if (it->IsNull()) throw Base::Exception("Input shape is null"); // Let's call algorithm computing a fuse operation: BRepAlgoAPI_Fuse mkFuse(resShape, *it); // Let's check if the fusion has been successful if (!mkFuse.IsDone()) throw Base::Exception("Fusion failed"); resShape = mkFuse.Shape(); ShapeHistory hist1 = buildHistory(mkFuse, TopAbs_FACE, resShape, mkFuse.Shape1()); ShapeHistory hist2 = buildHistory(mkFuse, TopAbs_FACE, resShape, mkFuse.Shape2()); if (history.empty()) { history.push_back(hist1); history.push_back(hist2); } else { for (std::vector<ShapeHistory>::iterator jt = history.begin(); jt != history.end(); ++jt) *jt = joinHistory(*jt, hist1); history.push_back(hist2); } } #else BRepAlgoAPI_Fuse mkFuse; TopTools_ListOfShape shapeArguments,shapeTools; shapeArguments.Append(s.front()); for (std::vector<TopoDS_Shape>::iterator it = s.begin()+1; it != s.end(); ++it) { if (it->IsNull()) throw Base::Exception("Input shape is null"); shapeTools.Append(*it); } mkFuse.SetArguments(shapeArguments); mkFuse.SetTools(shapeTools); mkFuse.Build(); if (!mkFuse.IsDone()) throw Base::Exception("MultiFusion failed"); TopoDS_Shape resShape = mkFuse.Shape(); for (std::vector<TopoDS_Shape>::iterator it = s.begin(); it != s.end(); ++it) { history.push_back(buildHistory(mkFuse, TopAbs_FACE, resShape, *it)); } #endif if (resShape.IsNull()) throw Base::Exception("Resulting shape is null"); Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part/Boolean"); if (hGrp->GetBool("CheckModel", false)) { BRepCheck_Analyzer aChecker(resShape); if (! aChecker.IsValid() ) { return new App::DocumentObjectExecReturn("Resulting shape is invalid"); } } if (hGrp->GetBool("RefineModel", false)) { try { TopoDS_Shape oldShape = resShape; BRepBuilderAPI_RefineModel mkRefine(oldShape); resShape = mkRefine.Shape(); ShapeHistory hist = buildHistory(mkRefine, TopAbs_FACE, resShape, oldShape); for (std::vector<ShapeHistory>::iterator jt = history.begin(); jt != history.end(); ++jt) *jt = joinHistory(*jt, hist); } catch (Standard_Failure) { // do nothing } } this->Shape.setValue(resShape); if (argumentsAreInCompound){ //combine histories of every child of source compound into one ShapeHistory overallHist; TopTools_IndexedMapOfShape facesOfCompound; TopAbs_ShapeEnum type = TopAbs_FACE; TopExp::MapShapes(compoundOfArguments, type, facesOfCompound); for (std::size_t iChild = 0; iChild < history.size(); iChild++){ //loop over children of source compound //for each face of a child, find the inex of the face in compound, and assign the corresponding right-hand-size of the history TopTools_IndexedMapOfShape facesOfChild; TopExp::MapShapes(s[iChild], type, facesOfChild); for(std::pair<const int,ShapeHistory::List> &histitem: history[iChild].shapeMap){ //loop over elements of history - that is - over faces of the child of source compound int iFaceInChild = histitem.first; ShapeHistory::List &iFacesInResult = histitem.second; TopoDS_Shape srcFace = facesOfChild(iFaceInChild + 1); //+1 to convert our 0-based to OCC 1-bsed conventions int iFaceInCompound = facesOfCompound.FindIndex(srcFace)-1; overallHist.shapeMap[iFaceInCompound] = iFacesInResult; //this may overwrite existing info if the same face is used in several children of compound. This shouldn't be a problem, because the histories should match anyway... } } history.clear(); history.push_back(overallHist); } this->History.setValues(history); } catch (Standard_Failure& e) { return new App::DocumentObjectExecReturn(e.GetMessageString()); } } else { throw Base::Exception("Not enough shape objects linked"); } return App::DocumentObject::StdReturn; }
void PartExport initPart() { std::stringstream str; str << OCC_VERSION_MAJOR << "." << OCC_VERSION_MINOR << "." << OCC_VERSION_MAINTENANCE; App::Application::Config()["OCC_VERSION"] = str.str(); // see Init.py #if defined (_OCC64) #if OCC_VERSION_HEX < 0x060503 App::GetApplication().addImportType("STEP (*.step *.stp)","Part"); App::GetApplication().addExportType("STEP (*.step *.stp)","Part"); #else App::GetApplication().addImportType("STEP with colors (*.step *.stp)","ImportGui"); App::GetApplication().addExportType("STEP with colors (*.step *.stp)","ImportGui"); #endif #endif // This is highly experimental and we should keep an eye on it // if we have mysterious crashes // The argument must be 'Standard_False' to avoid FPE caused by // Python's cmath module. //#if defined(FC_OS_LINUX) OSD::SetSignal(Standard_False); //#endif PyObject* partModule = Py_InitModule3("Part", Part_methods, module_part_doc); /* mod name, table ptr */ Base::Console().Log("Loading Part module... done\n"); // Add Types to module Base::Interpreter().addType(&Part::TopoShapePy ::Type,partModule,"Shape"); Base::Interpreter().addType(&Part::TopoShapeVertexPy ::Type,partModule,"Vertex"); Base::Interpreter().addType(&Part::TopoShapeWirePy ::Type,partModule,"Wire"); Base::Interpreter().addType(&Part::TopoShapeEdgePy ::Type,partModule,"Edge"); Base::Interpreter().addType(&Part::TopoShapeSolidPy ::Type,partModule,"Solid"); Base::Interpreter().addType(&Part::TopoShapeFacePy ::Type,partModule,"Face"); Base::Interpreter().addType(&Part::TopoShapeCompoundPy ::Type,partModule,"Compound"); Base::Interpreter().addType(&Part::TopoShapeCompSolidPy ::Type,partModule,"CompSolid"); Base::Interpreter().addType(&Part::TopoShapeShellPy ::Type,partModule,"Shell"); Base::Interpreter().addType(&Part::LinePy ::Type,partModule,"Line"); Base::Interpreter().addType(&Part::PointPy ::Type,partModule,"Point"); Base::Interpreter().addType(&Part::CirclePy ::Type,partModule,"Circle"); Base::Interpreter().addType(&Part::EllipsePy ::Type,partModule,"Ellipse"); Base::Interpreter().addType(&Part::HyperbolaPy ::Type,partModule,"Hyperbola"); Base::Interpreter().addType(&Part::ParabolaPy ::Type,partModule,"Parabola"); Base::Interpreter().addType(&Part::ArcPy ::Type,partModule,"Arc"); Base::Interpreter().addType(&Part::ArcOfCirclePy ::Type,partModule,"ArcOfCircle"); Base::Interpreter().addType(&Part::BezierCurvePy ::Type,partModule,"BezierCurve"); Base::Interpreter().addType(&Part::BSplineCurvePy ::Type,partModule,"BSplineCurve"); Base::Interpreter().addType(&Part::OffsetCurvePy ::Type,partModule,"OffsetCurve"); Base::Interpreter().addType(&Part::PlanePy ::Type,partModule,"Plane"); Base::Interpreter().addType(&Part::CylinderPy ::Type,partModule,"Cylinder"); Base::Interpreter().addType(&Part::ConePy ::Type,partModule,"Cone"); Base::Interpreter().addType(&Part::SpherePy ::Type,partModule,"Sphere"); Base::Interpreter().addType(&Part::ToroidPy ::Type,partModule,"Toroid"); Base::Interpreter().addType(&Part::BezierSurfacePy ::Type,partModule,"BezierSurface"); Base::Interpreter().addType(&Part::BSplineSurfacePy ::Type,partModule,"BSplineSurface"); Base::Interpreter().addType(&Part::OffsetSurfacePy ::Type,partModule,"OffsetSurface"); Base::Interpreter().addType(&Part::SurfaceOfExtrusionPy ::Type,partModule,"SurfaceOfExtrusion"); Base::Interpreter().addType(&Part::SurfaceOfRevolutionPy::Type,partModule,"SurfaceOfRevolution"); Base::Interpreter().addType(&Part::RectangularTrimmedSurfacePy ::Type,partModule,"RectangularTrimmedSurface"); Base::Interpreter().addType(&Part::PartFeaturePy ::Type,partModule,"Feature"); PyObject* brepModule = Py_InitModule3("BRepOffsetAPI", 0, "BrepOffsetAPI"); Py_INCREF(brepModule); PyModule_AddObject(partModule, "BRepOffsetAPI", brepModule); Base::Interpreter().addType(&Part::BRepOffsetAPI_MakePipeShellPy::Type,brepModule,"MakePipeShell"); Part::TopoShape ::init(); Part::PropertyPartShape ::init(); Part::PropertyGeometryList ::init(); Part::PropertyShapeHistory ::init(); Part::PropertyFilletEdges ::init(); Part::Feature ::init(); Part::FeatureExt ::init(); Part::FeaturePython ::init(); Part::FeatureGeometrySet ::init(); Part::CustomFeature ::init(); Part::CustomFeaturePython ::init(); Part::Primitive ::init(); Part::Box ::init(); Part::Boolean ::init(); Part::Common ::init(); Part::MultiCommon ::init(); Part::Cut ::init(); Part::Fuse ::init(); Part::MultiFuse ::init(); Part::Section ::init(); Part::FilletBase ::init(); Part::Fillet ::init(); Part::Chamfer ::init(); Part::Extrusion ::init(); Part::Revolution ::init(); Part::Mirroring ::init(); Part::ImportStep ::init(); Part::ImportIges ::init(); Part::ImportBrep ::init(); Part::CurveNet ::init(); Part::Polygon ::init(); Part::Circle ::init(); Part::Ellipse ::init(); Part::Vertex ::init(); Part::Line ::init(); Part::Ellipsoid ::init(); Part::Plane ::init(); Part::Sphere ::init(); Part::Cylinder ::init(); Part::Cone ::init(); Part::Torus ::init(); Part::Helix ::init(); Part::Wedge ::init(); Part::Part2DObject ::init(); Part::Part2DObjectPython ::init(); Part::RuledSurface ::init(); Part::Loft ::init(); Part::Sweep ::init(); Part::Offset ::init(); Part::Thickness ::init(); // Geometry types Part::Geometry ::init(); Part::GeomPoint ::init(); Part::GeomCurve ::init(); Part::GeomBezierCurve ::init(); Part::GeomBSplineCurve ::init(); Part::GeomCircle ::init(); Part::GeomArcOfCircle ::init(); Part::GeomEllipse ::init(); Part::GeomHyperbola ::init(); Part::GeomParabola ::init(); Part::GeomLine ::init(); Part::GeomLineSegment ::init(); Part::GeomOffsetCurve ::init(); Part::GeomTrimmedCurve ::init(); Part::GeomSurface ::init(); Part::GeomBezierSurface ::init(); Part::GeomBSplineSurface ::init(); Part::GeomCylinder ::init(); Part::GeomCone ::init(); Part::GeomSphere ::init(); Part::GeomToroid ::init(); Part::GeomPlane ::init(); Part::GeomOffsetSurface ::init(); Part::GeomTrimmedSurface ::init(); Part::GeomSurfaceOfRevolution ::init(); Part::GeomSurfaceOfExtrusion ::init(); // set the user-defined units Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); int unit = hGrp->GetInt("Unit", 0); switch (unit) { case 1: Interface_Static::SetCVal("write.iges.unit","M"); Interface_Static::SetCVal("write.step.unit","M"); break; case 2: Interface_Static::SetCVal("write.iges.unit","IN"); Interface_Static::SetCVal("write.step.unit","IN"); break; default: Interface_Static::SetCVal("write.iges.unit","MM"); Interface_Static::SetCVal("write.step.unit","MM"); break; } }
void AutoSaver::saveDocument(const std::string& name, AutoSaveProperty& saver) { Gui::WaitCursor wc; App::Document* doc = App::GetApplication().getDocument(name.c_str()); if (doc) { // Set the document's current transient directory std::string dirName = doc->TransientDir.getValue(); dirName += "/fc_recovery_files"; saver.dirName = dirName; // Write recovery meta file QFile file(QString::fromLatin1("%1/fc_recovery_file.xml") .arg(QString::fromUtf8(doc->TransientDir.getValue()))); if (file.open(QFile::WriteOnly)) { QTextStream str(&file); str.setCodec("UTF-8"); str << "<?xml version='1.0' encoding='utf-8'?>" << endl << "<AutoRecovery SchemaVersion=\"1\">" << endl; str << " <Status>Created</Status>" << endl; str << " <Label>" << QString::fromUtf8(doc->Label.getValue()) << "</Label>" << endl; // store the document's current label str << " <FileName>" << QString::fromUtf8(doc->FileName.getValue()) << "</FileName>" << endl; // store the document's current filename str << "</AutoRecovery>" << endl; file.close(); } // make sure to tmp. disable saving thumbnails because this causes trouble if the // associated 3d view is not active Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetParameterGroupByPath ("User parameter:BaseApp/Preferences/Document"); bool save = hGrp->GetBool("SaveThumbnail",false); hGrp->SetBool("SaveThumbnail",false); getMainWindow()->showMessage(tr("Please wait until the AutoRecovery file has been saved..."), 5000); //qApp->processEvents(); // open extra scope to close ZipWriter properly Base::StopWatch watch; watch.start(); { if (!this->compressed) { RecoveryWriter writer(saver); if (hGrp->GetBool("SaveBinaryBrep", true)) writer.setMode("BinaryBrep"); writer.putNextEntry("Document.xml"); doc->Save(writer); // Special handling for Gui document. doc->signalSaveDocument(writer); // write additional files writer.writeFiles(); } else { std::string fn = doc->TransientDir.getValue(); fn += "/fc_recovery_file.fcstd"; Base::FileInfo tmp(fn); Base::ofstream file(tmp, std::ios::out | std::ios::binary); if (file.is_open()) { Base::ZipWriter writer(file); if (hGrp->GetBool("SaveBinaryBrep", true)) writer.setMode("BinaryBrep"); writer.setComment("AutoRecovery file"); writer.setLevel(1); // apparently the fastest compression writer.putNextEntry("Document.xml"); doc->Save(writer); // Special handling for Gui document. doc->signalSaveDocument(writer); // write additional files writer.writeFiles(); } } } std::string str = watch.toString(watch.elapsed()); Base::Console().Log("Save AutoRecovery file: %s\n", str.c_str()); hGrp->SetBool("SaveThumbnail",save); } }
void DlgImportExportStep::saveSettings() { int unit = ui->comboBoxUnits->currentIndex(); Base::Reference<ParameterGrp> hPartGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); // General Base::Reference<ParameterGrp> hGenGrp = hPartGrp->GetGroup("General"); int writesurfacecurve = ui->checkBoxPcurves->isChecked() ? 1 : 0; hGenGrp->SetInt("WriteSurfaceCurveMode", writesurfacecurve); Interface_Static::SetIVal("write.surfacecurve.mode", writesurfacecurve); // STEP Base::Reference<ParameterGrp> hStepGrp = hPartGrp->GetGroup("STEP"); hStepGrp->SetInt("Unit", unit); switch (unit) { case 1: Interface_Static::SetCVal("write.step.unit","M"); break; case 2: Interface_Static::SetCVal("write.step.unit","IN"); break; default: Interface_Static::SetCVal("write.step.unit","MM"); break; } // scheme if (ui->radioButtonAP203->isChecked()) { Interface_Static::SetCVal("write.step.schema","AP203"); hStepGrp->SetASCII("Scheme", "AP203"); } else { // possible values: AP214CD (1996), AP214DIS (1998), AP214IS (2002) Interface_Static::SetCVal("write.step.schema","AP214IS"); hStepGrp->SetASCII("Scheme", "AP214IS"); } // header info hStepGrp->SetASCII("Company", ui->lineEditCompany->text().toLatin1()); hStepGrp->SetASCII("Author", ui->lineEditAuthor->text().toLatin1()); //hStepGrp->SetASCII("Product", ui->lineEditProduct->text().toLatin1()); // (h)STEP of Import module ui->checkBoxMergeCompound->onSave(); }