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

Method execute

src/App/FeaturePython.cpp:74–105  ·  view source on GitHub ↗

! Calls the execute() method of the Python feature class. If the Python feature class doesn't have an execute() method or if it returns False this method also return false and true otherwise. */

Source from the content-addressed store, hash-verified

72 execute() method or if it returns False this method also return false and true otherwise.
73 */
74bool FeaturePythonImp::execute()
75{
76 FC_PY_CALL_CHECK(execute)
77 Base::PyGILStateLocker lock;
78 try {
79 if (has__object__) {
80 Py::Object res = Base::pyCall(py_execute.ptr());
81 if (res.isBoolean() && !res.isTrue()) {
82 return false;
83 }
84 return true;
85 }
86 else {
87 Py::Tuple args(1);
88 args.setItem(0, Py::Object(object->getPyObject(), true));
89 Py::Object res = Base::pyCall(py_execute.ptr(), args.ptr());
90 if (res.isBoolean() && !res.isTrue()) {
91 return false;
92 }
93 return true;
94 }
95 }
96 catch (Py::Exception&) {
97 if (PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
98 PyErr_Clear();
99 return false;
100 }
101 Base::PyException::throwException(); // extract the Python error text
102 }
103
104 return false;
105}
106
107bool FeaturePythonImp::mustExecute() const
108{

Callers

nothing calls this directly

Calls 4

pyCallFunction · 0.85
ObjectClass · 0.70
ptrMethod · 0.45
getPyObjectMethod · 0.45

Tested by

no test coverage detected