Hi everyone,
I’m trying to get the structural properties of the material of my revit elements through a Dynamo script (eg. Unit weight, poisson ratio, Young Modulus etc. ). I first thought of using GetParameterByName nodes but the values of the structural parameters are strangely all equal to zero…
On the REVIT API documentation site, I found a code in C# that seems to do what I want to. However I have troubles to translate this code into python in order to insert it in my Dynamo script and everytime I try something I got a different Warning over my Python Script… (Attribute error, “Read only” parameter, “object is not callable”…)
If anyone knows how to translate this C# script into a Python node and could explain me how to do it, that would be awesome!
Thanks in advance for any help
Arthur
Here is the C# code:
private void ReadMaterialProps(Document document, Material material)
{
ElementId strucAssetId = material.StructuralAssetId;
if (strucAssetId != ElementId.InvalidElementId)
{
PropertySetElement pse = document.GetElement(strucAssetId) as PropertySetElement;
if (pse != null)
{
StructuralAsset asset = pse.GetStructuralAsset();
// Check the material behavior and only read if Isotropic
if (asset.Behavior == StructuralBehavior.Isotropic)
{
// Get the class of material
StructuralAssetClass assetClass = asset.StructuralAssetClass;
// Get other material properties
double poisson = asset.PoissonRatio.X;
double youngMod = asset.YoungModulus.X;
double thermCoeff = asset.ThermalExpansionCoefficient.X;
double unitweight = asset.Density;
double shearMod = asset.ShearModulus.X;
double dampingRatio = asset.DampingRatio;
if (assetClass == StructuralAssetClass.Metal)
{
double dMinStress = asset.MinimumYieldStress;
}
else if (assetClass == StructuralAssetClass.Concrete)
{
double dConcComp = asset.ConcreteCompression;
}
}
}
}
}