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

Method getProperties

src/Mod/Material/App/MaterialPyImp.cpp:369–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367}
368
369Py::Dict MaterialPy::getProperties() const
370{
371 Py::Dict dict;
372
373 // Maintain backwards compatibility
374 dict.setItem(Py::String("CardName"), Py::String(getMaterialPtr()->getName().toStdString()));
375 dict.setItem(Py::String("AuthorAndLicense"),
376 Py::String(getMaterialPtr()->getAuthorAndLicense().toStdString()));
377 dict.setItem(Py::String("Author"), Py::String(getMaterialPtr()->getAuthor().toStdString()));
378 dict.setItem(Py::String("License"), Py::String(getMaterialPtr()->getLicense().toStdString()));
379 dict.setItem(Py::String("Name"), Py::String(getMaterialPtr()->getName().toStdString()));
380 dict.setItem(Py::String("Description"),
381 Py::String(getMaterialPtr()->getDescription().toStdString()));
382 dict.setItem(Py::String("ReferenceSource"),
383 Py::String(getMaterialPtr()->getReference().toStdString()));
384 dict.setItem(Py::String("SourceURL"), Py::String(getMaterialPtr()->getURL().toStdString()));
385
386 auto properties = getMaterialPtr()->getPhysicalProperties();
387 for (auto& it : properties) {
388 QString key = it.first;
389 auto materialProperty = it.second;
390
391 if (!materialProperty->isNull()) {
392 auto value = materialProperty->getDictionaryString();
393 dict.setItem(Py::String(key.toStdString()), Py::String(value.toStdString()));
394 }
395 }
396
397 properties = getMaterialPtr()->getAppearanceProperties();
398 for (auto& it : properties) {
399 QString key = it.first;
400 auto materialProperty = it.second;
401
402 if (!materialProperty->isNull()) {
403 auto value = materialProperty->getDictionaryString();
404 dict.setItem(Py::String(key.toStdString()), Py::String(value.toStdString()));
405 }
406 }
407
408 auto legacy = getMaterialPtr()->getLegacyProperties();
409 for (auto& it : legacy) {
410 auto key = it.first;
411 auto value = it.second;
412
413 if (!value.isEmpty()) {
414 dict.setItem(Py::String(key.toStdString()), Py::String(value.toStdString()));
415 }
416 }
417
418 return dict;
419}
420
421Py::Dict MaterialPy::getPhysicalProperties() const
422{

Callers 6

keysMethod · 0.95
valuesMethod · 0.95
sequence_lengthMethod · 0.45
sequence_itemMethod · 0.45
sequence_containsMethod · 0.45
mapping_subscriptMethod · 0.45

Calls 15

toStdStringMethod · 0.80
getPhysicalPropertiesMethod · 0.80
getDictionaryStringMethod · 0.80
getLegacyPropertiesMethod · 0.80
StringClass · 0.50
getNameMethod · 0.45
getAuthorAndLicenseMethod · 0.45
getAuthorMethod · 0.45
getLicenseMethod · 0.45
getDescriptionMethod · 0.45
getReferenceMethod · 0.45

Tested by

no test coverage detected