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

Method getPropertyByName

src/App/PropertyContainerPyImp.cpp:51–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51PyObject* PropertyContainerPy::getPropertyByName(PyObject* args)
52{
53 char* pstr {};
54 int checkOwner = 0;
55 if (!PyArg_ParseTuple(args, "s|i", &pstr, &checkOwner)) {
56 return nullptr;
57 }
58
59 if (checkOwner < 0 || checkOwner > 2) {
60 PyErr_SetString(PyExc_ValueError, "'checkOwner' expected in the range [0, 2]");
61 return nullptr;
62 }
63
64 App::Property* prop = getPropertyContainerPtr()->getPropertyByName(pstr);
65 if (!prop) {
66 PyErr_Format(Base::PyExc_FC_PropertyError, "Property container has no property '%s'", pstr);
67 return nullptr;
68 }
69
70 if (!checkOwner || (checkOwner == 1 && prop->getContainer() == getPropertyContainerPtr())) {
71 return prop->getPyObject();
72 }
73
74 Py::TupleN res(Py::asObject(prop->getContainer()->getPyObject()),
75 Py::asObject(prop->getPyObject()));
76
77 return Py::new_reference_to(res);
78}
79
80PyObject* PropertyContainerPy::getPropertyTouchList(PyObject* args)
81{

Callers 14

getPropertyTouchListMethod · 0.45
getTypeOfPropertyMethod · 0.45
getTypeIdOfPropertyMethod · 0.45
setEditorModeMethod · 0.45
setPropertyStatusMethod · 0.45
getPropertyStatusMethod · 0.45
getEditorModeMethod · 0.45
getGroupOfPropertyMethod · 0.45
dumpPropertyContentMethod · 0.45

Calls 3

new_reference_toFunction · 0.85
getContainerMethod · 0.45
getPyObjectMethod · 0.45

Tested by

no test coverage detected