void DlgImportExportStep::loadSettings() { Base::Reference<ParameterGrp> hPartGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); // General Base::Reference<ParameterGrp> hGenGrp = hPartGrp->GetGroup("General"); int writesurfacecurve = Interface_Static::IVal("write.surfacecurve.mode"); writesurfacecurve = hGenGrp->GetInt("WriteSurfaceCurveMode", writesurfacecurve); ui->checkBoxPcurves->setChecked(writesurfacecurve == 0 ? false : true); // STEP Base::Reference<ParameterGrp> hStepGrp = hPartGrp->GetGroup("STEP"); int unit = hStepGrp->GetInt("Unit", 0); ui->comboBoxUnits->setCurrentIndex(unit); // scheme QString ap = QString::fromStdString(hStepGrp->GetASCII("Scheme", Interface_Static::CVal("write.step.schema"))); if (ap.startsWith(QLatin1String("AP203"))) ui->radioButtonAP203->setChecked(true); else ui->radioButtonAP214->setChecked(true); // header info ui->lineEditCompany->setText(QString::fromStdString(hStepGrp->GetASCII("Company"))); ui->lineEditAuthor->setText(QString::fromStdString(hStepGrp->GetASCII("Author"))); ui->lineEditProduct->setText(QString::fromLatin1( Interface_Static::CVal("write.step.product.name"))); // (h)STEP of Import module ui->checkBoxMergeCompound->onRestore(); }
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(); }
void Workbench::setupCustomToolbars(ToolBarItem* root, const Base::Reference<ParameterGrp>& hGrp) const { std::vector<Base::Reference<ParameterGrp> > hGrps = hGrp->GetGroups(); CommandManager& rMgr = Application::Instance->commandManager(); std::string separator = "Separator"; for (std::vector<Base::Reference<ParameterGrp> >::iterator it = hGrps.begin(); it != hGrps.end(); ++it) { bool active = (*it)->GetBool("Active", true); if (!active) // ignore this toolbar continue; ToolBarItem* bar = new ToolBarItem(root); bar->setCommand("Custom"); // get the elements of the subgroups std::vector<std::pair<std::string,std::string> > items = hGrp->GetGroup((*it)->GetGroupName())->GetASCIIMap(); for (std::vector<std::pair<std::string,std::string> >::iterator it2 = items.begin(); it2 != items.end(); ++it2) { if (it2->first.substr(0, separator.size()) == separator) { *bar << "Separator"; } else if (it2->first == "Name") { bar->setCommand(it2->second); } else { Command* pCmd = rMgr.getCommandByName(it2->first.c_str()); if (!pCmd) { // unknown command // first try the module name as is std::string pyMod = it2->second; try { Base::Interpreter().loadModule(pyMod.c_str()); // Try again pCmd = rMgr.getCommandByName(it2->first.c_str()); } catch(const Base::Exception&) { } } // still not there? if (!pCmd) { // add the 'Gui' suffix std::string pyMod = it2->second + "Gui"; try { Base::Interpreter().loadModule(pyMod.c_str()); // Try again pCmd = rMgr.getCommandByName(it2->first.c_str()); } catch(const Base::Exception&) { } } if (pCmd) { *bar << it2->first; // command name } } } } }
Py::Object ParameterGrpPy::getGroup(const Py::Tuple& args) { char *pstr; if (!PyArg_ParseTuple(args.ptr(), "s", &pstr)) throw Py::Exception(); // 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 return Py::asObject(pcParamGrp); } else { throw Py::RuntimeError("GetGroup failed"); } }
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; }
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()); }
Py::Object TopoShapeEdgePy::getCurve() const { const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape()); BRepAdaptor_Curve adapt(e); switch(adapt.GetType()) { case GeomAbs_Line: { static bool LineOld = true; static bool init = false; if (!init) { init = true; Base::Reference<ParameterGrp> hPartGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); Base::Reference<ParameterGrp> hGenPGrp = hPartGrp->GetGroup("General"); LineOld = hGenPGrp->GetBool("LineOld", false); } if (LineOld) { GeomLineSegment* line = new GeomLineSegment(); Handle(Geom_TrimmedCurve) this_curv = Handle(Geom_TrimmedCurve)::DownCast (line->handle()); Handle(Geom_Line) this_line = Handle(Geom_Line)::DownCast (this_curv->BasisCurve()); this_line->SetLin(adapt.Line()); this_curv->SetTrim(adapt.FirstParameter(), adapt.LastParameter()); PyErr_SetString(PyExc_DeprecationWarning, "For future usage 'Curve' will return 'Line' which is infinite " "instead of the limited 'LineSegment'.\n" "If you need a line segment then use this:\n" "Part.LineSegment(edge.Curve,edge.FirstParameter,edge.LastParameter)\n" "To suppress the warning set BaseApp/Preferences/Mod/Part/General/LineOld to false"); PyErr_Print(); return Py::Object(new LineSegmentPy(line),true); // LinePyOld } else { GeomLine* line = new GeomLine(); Handle(Geom_Line) this_curv = Handle(Geom_Line)::DownCast (line->handle()); this_curv->SetLin(adapt.Line()); return Py::Object(new LinePy(line),true); } } case GeomAbs_Circle: { GeomCircle* circle = new GeomCircle(); Handle(Geom_Circle) this_curv = Handle(Geom_Circle)::DownCast (circle->handle()); this_curv->SetCirc(adapt.Circle()); //Standard_Real dd = adapt.FirstParameter(); //Standard_Real ee = adapt.LastParameter(); return Py::Object(new CirclePy(circle),true); } case GeomAbs_Ellipse: { GeomEllipse* elips = new GeomEllipse(); Handle(Geom_Ellipse) this_curv = Handle(Geom_Ellipse)::DownCast (elips->handle()); this_curv->SetElips(adapt.Ellipse()); return Py::Object(new EllipsePy(elips),true); } case GeomAbs_Hyperbola: { GeomHyperbola* hypr = new GeomHyperbola(); Handle(Geom_Hyperbola) this_curv = Handle(Geom_Hyperbola)::DownCast (hypr->handle()); this_curv->SetHypr(adapt.Hyperbola()); return Py::Object(new HyperbolaPy(hypr),true); } case GeomAbs_Parabola: { GeomParabola* parab = new GeomParabola(); Handle(Geom_Parabola) this_curv = Handle(Geom_Parabola)::DownCast (parab->handle()); this_curv->SetParab(adapt.Parabola()); return Py::Object(new ParabolaPy(parab),true); } case GeomAbs_BezierCurve: { GeomBezierCurve* curve = new GeomBezierCurve(adapt.Bezier()); return Py::Object(new BezierCurvePy(curve),true); } case GeomAbs_BSplineCurve: { GeomBSplineCurve* curve = new GeomBSplineCurve(adapt.BSpline()); return Py::Object(new BSplineCurvePy(curve),true); } #if OCC_VERSION_HEX >= 0x070000 case GeomAbs_OffsetCurve: { Standard_Real first, last; Handle(Geom_Curve) c = BRep_Tool::Curve(e, first, last); Handle(Geom_OffsetCurve) off = Handle(Geom_OffsetCurve)::DownCast(c); if (!off.IsNull()) { GeomOffsetCurve* curve = new GeomOffsetCurve(off); return Py::Object(new OffsetCurvePy(curve),true); } else { throw Py::RuntimeError("Failed to convert to offset curve"); } } #endif case GeomAbs_OtherCurve: break; } throw Py::TypeError("undefined curve type"); }