CAD Block location

Does the GIF below demonstrate what you want to do?

If so, here is the python script to get the origin of a CAD import.

import clr

# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk

#Custom tolist definition provided by Dimitar Venkov
#https://github.com/dimven/SpringNodes
def tolist(x):
	if hasattr(x,'__iter__'): return x
	else : return [x]

#unwrap all elements to use with API
items = tolist(UnwrapElement(IN[0]))

#lists to append results to
locations = list()

#iterate through the cad imports
for i in items:
	transform = i.GetTotalTransform()
	locations.append(transform.Origin.ToPoint())

#Assign your output to the OUT variable
OUT = locations
6 Likes