How I can get Structural aspect aka PropertySetElement from Material with Python script?
example for Color:
OUT = UnwrapElement(IN[0]).Color
Hello,
You can get the materials with clockwork’s excellent “FamilyType.CompoundStructureLayers” node. After that, you can unwrap a material and query its parameters as usual:
Dimitar , I know it
How I can get Structural aspect aka PropertySetElement from Material ? See screenshot
Ultimately, I want to get the density material
Oh, then you could try something along the lines of this:
Tho I’m not sure about the internal units that revit uses.
Dimitar, thank you.
You very helpful!
I did not know about and StructuralAssetId and GetStructuralAsset ()
Hello,
I’m trying to code this:
Input = a list of materials
Output = a list of these materials’ density:
I’m quite new to coding in Python, so maybe I made a very basic mistake. I read about the use of “Transaction manager” but I don’t know what it is and if I try to copy it in my code as got an error “unknown Transaction Manager”.
Thanks a lot for your help !
I solved my error (coding synthax). This is the final code:
import clr
# Import RevitAPI
clr.AddReference(“RevitAPI”)
import Autodesk
from Autodesk.Revit.DB import ReferencePointArray
# Import DocumentManager
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
doc= DocumentManager.Instance.CurrentDBDocument
elements=[]
for i in IN[0]:
elements.append(UnwrapElement(i))
outlist=[]
for i in range(len(elements)):
Density= doc.GetElement(elements[i].StructuralAssetId).GetStructuralAsset().Density
DensitySI= Density*35.31466680911273
outlist.append(DensitySI)
OUT = outlist