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

Method getEnumerationsOfProperty

src/App/PropertyContainerPyImp.cpp:478–505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476 Py_Return;
477 }
478 PY_CATCH
479}
480
481PyObject* PropertyContainerPy::getEnumerationsOfProperty(PyObject* args)
482{
483 char* pstr {};
484 if (!PyArg_ParseTuple(args, "s", &pstr)) {
485 return nullptr;
486 }
487
488 Property* prop = getPropertyContainerPtr()->getPropertyByName(pstr);
489 if (!prop) {
490 PyErr_Format(PyExc_AttributeError, "Property container has no property '%s'", pstr);
491 return nullptr;
492 }
493
494 PropertyEnumeration* enumProp = freecad_cast<PropertyEnumeration*>(prop);
495 if (!enumProp) {
496 Py_Return;
497 }
498
499 std::vector<std::string> enumerations = enumProp->getEnumVector();
500 Py::List ret;
501 for (const auto& it : enumerations) {
502 ret.append(Py::String(it));
503 }
504 return Py::new_reference_to(ret);
505}
506
507Py::List PropertyContainerPy::getPropertiesList() const
508{

Callers

nothing calls this directly

Calls 5

new_reference_toFunction · 0.85
StringClass · 0.70
getPropertyByNameMethod · 0.45
getEnumVectorMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected