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

Method getObject

src/App/DocumentPyImp.cpp:792–819  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

790}
791
792PyObject* DocumentPy::getObject(PyObject* args)
793{
794 DocumentObject* obj = nullptr;
795
796 do {
797 char* name = nullptr;
798 if (PyArg_ParseTuple(args, "s", &name)) {
799 obj = getDocumentPtr()->getObject(name);
800 break;
801 }
802
803 PyErr_Clear();
804 long id = -1;
805 if (PyArg_ParseTuple(args, "l", &id)) {
806 obj = getDocumentPtr()->getObjectByID(id);
807 break;
808 }
809
810 PyErr_SetString(PyExc_TypeError, "a string or integer is required");
811 return nullptr;
812 } while (false);
813
814 if (obj) {
815 return obj->getPyObject();
816 }
817
818 Py_Return;
819}
820
821PyObject* DocumentPy::getObjectsByLabel(PyObject* args)
822{

Callers 3

removeObjectMethod · 0.45
getCustomAttributesMethod · 0.45
setCustomAttributesMethod · 0.45

Calls 2

getObjectByIDMethod · 0.80
getPyObjectMethod · 0.45

Tested by

no test coverage detected