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

Method getPropertyObjects

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

Source from the content-addressed store, hash-verified

610}
611
612Py::Dict MaterialPy::getPropertyObjects() const
613{
614 Py::Dict dict;
615
616 auto properties = getMaterialPtr()->getPhysicalProperties();
617 for (auto& it : properties) {
618 QString key = it.first;
619 auto materialProperty = it.second;
620
621 // if (materialProperty->getType() == MaterialValue::Array2D) {
622 // auto value = std::static_pointer_cast<Materials::Array2D>(
623 // materialProperty->getMaterialValue());
624 // dict.setItem(Py::String(key.toStdString()),
625 // Py::Object(new Array2DPy(new Array2D(*value)), true));
626 // }
627 // else if (materialProperty->getType() == MaterialValue::Array3D) {
628 // auto value = std::static_pointer_cast<Materials::Array3D>(
629 // materialProperty->getMaterialValue());
630 // dict.setItem(Py::String(key.toStdString()),
631 // Py::Object(new Array3DPy(new Array3D(*value)), true));
632 // }
633 // else {
634 dict.setItem(
635 Py::String(key.toStdString()),
636 Py::Object(new MaterialPropertyPy(new MaterialProperty(materialProperty)), true));
637 // }
638 }
639
640 properties = getMaterialPtr()->getAppearanceProperties();
641 for (auto& it : properties) {
642 QString key = it.first;
643 auto materialProperty = it.second;
644 dict.setItem(
645 Py::String(key.toStdString()),
646 Py::Object(new MaterialPropertyPy(new MaterialProperty(materialProperty)), true));
647 }
648
649 return dict;
650}
651
652PyObject* MaterialPy::keys()
653{

Callers

nothing calls this directly

Calls 5

getPhysicalPropertiesMethod · 0.80
toStdStringMethod · 0.80
StringClass · 0.50
ObjectClass · 0.50

Tested by

no test coverage detected