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

Method getElementIndexedName

src/App/ComplexGeoDataPyImp.cpp:335–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333}
334
335PyObject* ComplexGeoDataPy::getElementIndexedName(PyObject* args) const
336{
337 char* input;
338 PyObject* returnID = Py_False;
339 if (!PyArg_ParseTuple(args, "s|O", &input, &returnID)) {
340 return NULL;
341 }
342
343 ElementIDRefs ids;
344 Data::MappedElement res =
345 getComplexGeoDataPtr()->getElementName(input, PyObject_IsTrue(returnID) ? &ids : nullptr);
346 std::string s;
347 Py::String name(res.index.appendToStringBuffer(s));
348 if (!PyObject_IsTrue(returnID)) {
349 return Py::new_reference_to(name);
350 }
351
352 Py::List list;
353 for (auto& id : ids) {
354 list.append(Py::Long(id.value()));
355 }
356 return Py::new_reference_to(Py::TupleN(name, list));
357}
358
359PyObject* ComplexGeoDataPy::getElementMappedName(PyObject* args) const
360{

Callers

nothing calls this directly

Calls 4

new_reference_toFunction · 0.85
getElementNameMethod · 0.45
appendMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected