MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / sSaveParameter

Method sSaveParameter

src/App/ApplicationPy.cpp:613–639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

611}
612
613PyObject* ApplicationPy::sSaveParameter(PyObject* /*self*/, PyObject* args)
614{
615 const char* pstr = "User parameter";
616 if (!PyArg_ParseTuple(args, "|s", &pstr)) {
617 return nullptr;
618 }
619
620 PY_TRY
621 {
622 ParameterManager* param = App::GetApplication().GetParameterSet(pstr);
623 if (!param) {
624 std::stringstream str;
625 str << "No parameter set found with name: " << pstr;
626 PyErr_SetString(PyExc_ValueError, str.str().c_str());
627 return nullptr;
628 }
629 if (!param->HasSerializer()) {
630 std::stringstream str;
631 str << "Parameter set cannot be serialized: " << pstr;
632 PyErr_SetString(PyExc_RuntimeError, str.str().c_str());
633 return nullptr;
634 }
635
636 param->SaveDocument();
637 Py_INCREF(Py_None);
638 return Py_None;
639 }
640 PY_CATCH;
641}
642

Callers

nothing calls this directly

Calls 5

GetParameterSetMethod · 0.80
HasSerializerMethod · 0.80
SaveDocumentMethod · 0.80
c_strMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected