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

Method getElementMappedName

src/App/ComplexGeoDataPyImp.cpp:359–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357}
358
359PyObject* ComplexGeoDataPy::getElementMappedName(PyObject* args) const
360{
361 char* input;
362 PyObject* returnID = Py_False;
363 if (!PyArg_ParseTuple(args, "s|O", &input, &returnID)) {
364 return NULL;
365 }
366
367 ElementIDRefs ids;
368 Data::MappedElement res =
369 getComplexGeoDataPtr()->getElementName(input, PyObject_IsTrue(returnID) ? &ids : nullptr);
370 std::string s;
371 Py::String name(res.name.appendToBuffer(s));
372 if (!PyObject_IsTrue(returnID)) {
373 return Py::new_reference_to(name);
374 }
375
376 Py::List list;
377 for (auto& id : ids) {
378 list.append(Py::Long(id.value()));
379 }
380 return Py::new_reference_to(Py::TupleN(name, list));
381}
382
383PyObject* ComplexGeoDataPy::setElementName(PyObject* args, PyObject* kwds)
384{

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