Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Usually, You assign a material using
oSession = pfcCreate("MpfcCOMGlobal").GetProESession();
CurModel = oSession.CurrentModel;
CurModel.CurrentMaterial = CurModel.RetrieveMaterial(material_name);
But there is a catch.
This code line only imports the number of a certain value. The unit described in the imported *.mtl file is ignored. You have to set units manually by using:
CurModel.CurrentMaterial = CurModel.RetrieveMaterial(material_name);
CurModel.CurrentMaterial.SetPropertyUnits(pfcCreate("pfcMaterialPropertyType").MTL_PROP_MASS_DENSITY, "kg/mm^3", false);
CurModel.CurrentMaterial.SetPropertyUnits(pfcCreate("pfcMaterialPropertyType").MTL_PROP_YOUNG_MODULUS, "MPa", false);
CurModel.CurrentMaterial.SetPropertyUnits(pfcCreate("pfcMaterialPropertyType").MTL_PROP_THERMAL_EXPANSION_COEFFICIENT, "/ K", false);
CurModel.CurrentMaterial.SetPropertyUnits(pfcCreate("pfcMaterialPropertyType").MTL_PROP_SPECIFIC_HEAT, "joule / (kg K)", false);
CurModel.CurrentMaterial.SetPropertyUnits(pfcCreate("pfcMaterialPropertyType").MTL_PROP_THERMAL_CONDUCTIVITY , "W/(m K)", false);