Get host via Python, how?

Hello,

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import * 

elementlist =[]

for item in IN[0]:
	try:
		elementlist.append(item.Host)
	except:
		elementlist.append(emptylist)
OUT = elementlist

Actually my list remains emty. how can I get my hostelements.

KR

Andreas

grafik

Hi! The elements are “wrapped” in a DynamoContainer. You need to unwrap them to get the raw Revit API -data from them. Dynamo provides an ´UnwrapElement(IN[0])´ method you can use.

More info here: Python 0.6.3 to 0.7.x Migration · DynamoDS/Dynamo Wiki · GitHub

2 Likes