ReferencePlane within Element

Hello everyone,

I am trying create automatic measurements within Dynamo on a Revit project.
Now I am struggeling to get the ReferencePlanes out of an Element. I didnt find any node to select the Reference Plane of an Element?

Any help would be appreciated.
Thanks :slight_smile:


these are my families. (This dimensions are done by hand)

and here you can see there are Reference planes inside which I want to select.

my Skript so far:


How to get the Reference planes out of Elements to put it into “referenceElements”?

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

I have just tried to adopt the code to my project.

For the workflow i try to accomplish it however needs some modification, is it possible to get the reference, by finding the intersection point of the two reference planes “Center (Left/Right)” and “Center (Front/Back)”?
As shown below, the dimensions are not set to the center of the X, if the family has been rotated.

Further more, it would need to be able to run on a list of multiple sub lists if possible, I guess that could be relatively easy for people with python knowledge :laughing:.

Hi,

Use the Genius Loci package. There a lot of nodes to retrieve references and create dimensions.

2 Likes