How I can get Structural aspect aka PropertySetElement from Material?


#1

How I can get Structural aspect aka PropertySetElement from Material with Python script?

2015-09-16 20-43-25 Скриншот экрана


#2

example for Color:

OUT = UnwrapElement(IN[0]).Color


#3

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:

 

2015-09-17_14-55-05


#4

Dimitar , I know it

How I can get Structural aspect aka PropertySetElement from Material ? See screenshot

Ultimately, I want to get the density material


#5

Oh, then you could try something along the lines of this:

2015-09-17_16-56-59

 

 

 

Tho I’m not sure about the internal units that revit uses.


#6

Dimitar, thank you.

You very helpful!
I did not know about and StructuralAssetId and GetStructuralAsset ()


#7

Revit has this odd kind of internal units, which is totally ridiculous, but nevertheless. units need to be converted: density result * 35.31466680911273 = SI unit (kg/m3)


#8

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 !


#9

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