def initProperties(self, obj): # Not currently used addObjectProperty(obj, "References", [], "App::PropertyLinkSubList", "Material", "List of material shapes") # Compatibility with FEM material object if addObjectProperty( obj, "Category", ["Solid", "Fluid"], "App::PropertyEnumeration", "Material", "Type of material"): obj.Category = "Fluid" # 'Material' PropertyMap already present in MaterialObjectPython if not obj.Material: mats, name_path_list = CfdTools.importMaterials() obj.Material = mats[name_path_list[[np[0] for np in name_path_list].index('Air')][1]]
def import_materials(self): self.form.PredefinedMaterialLibraryComboBox.clear() self.materials, material_name_path_list = CfdTools.importMaterials() for mat in material_name_path_list: self.form.PredefinedMaterialLibraryComboBox.addItem( QtGui.QIcon(":/icons/freecad.svg"), mat[0], mat[1])