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

Method getPyPathValue

src/Mod/Sketcher/App/PropertyConstraintList.cpp:265–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265bool PropertyConstraintList::getPyPathValue(const App::ObjectIdentifier& path, Py::Object& res) const
266{
267 if (path.numSubComponents() != 2 || path.getPropertyComponent(0).getName() != getName()) {
268 return false;
269 }
270
271 const ObjectIdentifier::Component& c1 = path.getPropertyComponent(1);
272
273 const Constraint* cstr = nullptr;
274
275 if (c1.isArray()) {
276 cstr = _lValueList[c1.getIndex(_lValueList.size())];
277 }
278 else if (c1.isSimple()) {
279 ObjectIdentifier::Component c1 = path.getPropertyComponent(1);
280 for (auto c : _lValueList) {
281 if (c->Name == c1.getName()) {
282 cstr = c;
283 break;
284 }
285 }
286 }
287 if (!cstr) {
288 return false;
289 }
290 Quantity q = cstr->getPresentationValue();
291 res = new Base::QuantityPy(new Base::Quantity(q));
292 return true;
293}
294
295void PropertyConstraintList::setPyObject(PyObject* value)
296{

Callers

nothing calls this directly

Calls 6

numSubComponentsMethod · 0.80
getPresentationValueMethod · 0.80
getNameFunction · 0.50
getNameMethod · 0.45
getIndexMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected