Material (hwx.inspire)#
- class Material(name='', **kwds)#
Bases:
Named
A material is the physical substance that a part is made of, such as steel, aluminum, or plastic.
The type of material does not determine the visual appearance of a part, only its physical properties.
Base class for all user defined material.
# Name
Type
# Name
Description
destroy
(self)Removes the material from the database.
get
(material=None)Returns the material by its name.
getDefault
()Returns project default material.
getMaterials
()Returns a dictionary of the defined material keys to the material name.
setDefault
(material)Sets projects default material.
Example
from hwx import inspire model = inspire.newModel() block = model.createSolidBlock() # get default material defaultMaterial = inspire.Material.getDefault() print("Default material is: ", defaultMaterial.name) print("Block material is: ", block.material.name) # get a list of existing materials avaliableMaterials = "" for m in inspire.Material.getMaterials(): avaliableMaterials += m + ", " print("") print("Available materials: " + str(avaliableMaterials[:-2])) # assign material to block aluminium = inspire.Material.get('Aluminum (7075-T6)') block.material = aluminium print("") print("Block material is: ", block.material.name) # crate a material mySteelProperties = {"density": 5.3, "youngModulus": 0.1, "thermalExpansion": 0.23, "thermalConductivity": 0.5, } mySteelName = "mysteel" if mySteelName in inspire.Material.getMaterials(): mySteel = inspire.Material.get('mySteel') mySteel.destroy() mySteel = inspire.Material(name=mySteelName, **mySteelProperties) block.material = mySteel # show material properties print("") print("Block material is: " + block.material.name) print("mySteel density: " + str(mySteel.density)) print("mySteel youngModulus: " + str(mySteel.youngModulus)) print("mySteel Thermal Expansion: " + str(mySteel.thermalExpansion)) print("mySteel Thermal Conductivity: " + str(mySteel.thermalConductivity)) # modify some properties mySteel.density = 7.1 mySteel.youngModulus = 0.9 mySteel.thermalExpansion = 1.3 mySteel.thermalConductivity = 1.5 # show modified properties print("Steel density: " + str(mySteel.density)) print("Steel youngModulus: " + str(mySteel.youngModulus)) print("Steel Thermal Expansion: " + str(mySteel.thermalExpansion)) print("mySteel Thermal Conductivity: " + str(mySteel.thermalConductivity)) inspire.fitView()
- destroy()#
Removes the material from the database.
- Returns:
True, if deleted, else False.
- Return type:
bool
- property density#
Specifies density as a mass of a unit volume of a material.
- property stress#
Specifies the yield stress of the material.
The stress value at which the behaviour of the material changes from elastic to plastic. It is the minimum stress at which a solid will undergo permanent deformation or plastic flow without a significant increase in the load or external force.
- property youngModulus#
Specifies the young modulus of the material as a ratio of tensile stress and tensile strain.
This property of the material tells, how easily the material can stretch and deform.
- property thermalExpansion#
Specifies the heat value on the material, when the size and volume increase in small increments.
- property thermalConductivity#
Specifies the the rate at which heat is transferred by conduction through a unit cross-section area of a material, when a temperature gradient exits perpendicular to the area
- property poissonRatio#
Poisson ratio is the ratio of the change in the width per unit width of a material, to the change in its length per unit length.