Hi,
I want to dimension curtain walls in revit with dynamo. So i found a piece of python code that can do this.
when i enter only one element of each it works fine, but when i want do more at the same time is shows the warning in the picture. How can i fix the error. I attatched the script in the topic. Thanx in advance.
import clr
#The inputs to this node will be stored as a list in the IN variables.
wall = UnwrapElement(IN[0])
lineElement = UnwrapElement(IN[1])
view = UnwrapElement(IN[2])
dimlist=
clr.AddReference(“RevitAPI”)
from Autodesk.Revit.DB import *
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Transactions import TransactionManager
from RevitServices.Persistence import DocumentManager
def isParallel(v1,v2):
return v1.CrossProduct(v2).IsAlmostEqualTo(XYZ(0,0,0))
line = lineElement.GeometryCurve
lineDir = line.GetEndPoint(1) - line.GetEndPoint(0)
refArray = ReferenceArray()
doc = DocumentManager.Instance.CurrentDBDocument
options = Options()
options.ComputeReferences = True
options.IncludeNonVisibleObjects = True
geoElement = wall.get_Geometry(options)
#get side references
for obj in geoElement:
if isinstance(obj,Solid):
for f in obj.Faces:
faceNormal = f.FaceNormal
if isParallel(faceNormal,lineDir):
refArray.Append(f.Reference)
#get grid references
for id in wall.CurtainGrid.GetVGridLineIds():
gridLine = doc.GetElement(id)
gridGeo = gridLine.get_Geometry(options)
for obj in gridGeo:
if isinstance(obj,Line):
refArray.Append(obj.Reference)
TransactionManager.Instance.EnsureInTransaction(doc)
dimlist = doc.Create.NewDimension(view, line, refArray)
TransactionManager.Instance.TransactionTaskDone()
#Assign your output to the OUT variable.
OUT = dimlist