This library allows you to access to all material properties defined in Engineering Data. The material is defined for each body and can be retrieved using the geometry API.
libraries/Mechanical/materials.py
libraries/Project/materials.py
libraries/Study/materials.py
import materials
GetListMaterialProperties(mat)
This function returns a list of property names for the material mat given in argument.
GetMaterialPropertyByName(mat, name)
This function returns the material property name for the material mat.
InterpolateData(vx, vy, vin)
This function computes a linear interpolation vout
= f(vin) with f defined by vy = f(vx).
vx represents a list of values
for the input variable.
vy represents a list of values
for the property that depends on the input variable defined by vx.
vin is the value on which the
function has to evaluate the property.
Assume you enter this command:
import materials
mat = ExtAPI.DataModel.GeoData.Assemblies[0].Parts[0].Bodies[0].Material
materials.GetListMaterialProperties(mat)
Results like these are returned:
['Compressive Ultimate Strength', 'Compressive Yield Strength', 'Density', 'Tensile Yield Strength', 'Tensile Ultimate Strength', 'Coefficient of Thermal Expansion', 'Specific Heat', 'Thermal Conductivity', 'Alternating Stress', 'Strain-Life Parameters', 'Resistivity', 'Elasticity', 'Relative Permeability']
Assume that you enter this command:
prop = materials.GetMaterialPropertyByName(mat,"Elasticity")
prop
Results like these are returned:
{"Poisson's Ratio": ['', 0.29999999999999999, 0.29999999999999999, 0.29999999999999999],
'Bulk Modulus': ['Pa', 166666666666.667, 175000000000.0, 183333333333.333],
'Temperature': ['C', 10.0, 100.0, 1000.0], "Young's Modulus": ['Pa', 200000000000.0,
210000000000.0, 220000000000.0],
'Shear Modulus': ['Pa', 76923076923.0769, 80769230769.2308, 84615384615.3846]}Assume that you enter this command:
val = materials.InterpolateData(prop["Temperature"][1:],prop["Young's Modulus"][1:],10.)
val
val = materials.InterpolateData(prop["Temperature"][1:],prop["Young's Modulus"][1:],20.)
val
Results like these are returned:
200000000000.0
201111111111.0