ReferencePlane within Element

Hi,
you can get the reference planes with the method FamilyInstance.GetReferenceByName and indicate which reference you want, in this case I took “Center (Left/Right)”.

Apparently the node you are using takes only model lines as reference, so it’s just easier to use doc.Create.NewDimension in Python, it’s basically working in the same way.

import clr

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

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#Input
element = UnwrapElement(IN[0])
line = UnwrapElement(IN[1]).GeometryCurve
ref = ReferenceArray()

TransactionManager.Instance.EnsureInTransaction(doc)

#Get Reference Planes from Families
for x in element:
	a = FamilyInstance.GetReferenceByName(x,"Center (Left/Right)")
	ref.Append(a)

#Create Dimension
dimension = doc.Create.NewDimension(doc.ActiveView,line,ref)

TransactionManager.Instance.TransactionTaskDone()
	
OUT = dimension

Let me know if it works

7 Likes