Dimensioning electrical MEP elements

Hi there,

I have been searching for automatic dimensioning everywhere, but only found architectural dimensioning.
I’m working with electrical elements that seemingly just work different.

I can extract Points from them and create line in between etc.
But the Dimension.ByElement does not accept Lines as such.
Kinda stuck at this point.

Any help?

Look at dimensioning to the element references. There are several post in the forum covering that.

I have been looking and i’ve searched beforehand, and aren’t sure what you mean by “element references”.
Do you mean the familyinstance’s originpoint?

More or less. The references are the main reference lines in the element family “Center (Left/Right)” and “Center (Top/Bottom)” and any named reference lines that have been added manually.

I’ve tried retrieving them somehow, even drawn a reference line in the family myself, and i can’t seem to get them.
Also any type of dimensioning node i’m using is always never satisfactory about the data it receives.

Show the graph of what you set up for getting and using the references. Most every family should have the main references as I previously stated. The intersection of those is the insertion point origin for the family. If you manually add reference lines, make sure you name them and set them to a reference type (strong, weak, etc.) else you won’t be able to retrieve them.

Here is some code that may make it easier to pull the references by their names. Make sure your reference name or names is in a list format and the name is inputted exactly as it is in the family (as shown in the clip below).

import clr

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

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

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

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

#Preparing input from dynamo to revit
elements = UnwrapElement(IN[0]) if isinstance(IN[0],list) else [UnwrapElement(IN[0])]
refnames = IN[1]

reference=[]
planes=[]
names=[]

TransactionManager.Instance.EnsureInTransaction(doc)

for e in elements:
	for rf in refnames:
		refs = e.GetReferenceByName(rf)
		if refs is not None:
			reference.append(refs)		
			for r in reference:
				name = (e.GetReferenceName(r))
			names.append(name)

for ref in reference:
	sketchPlane = SketchPlane.Create(doc, ref)
	planes.append(sketchPlane.GetPlane().ToPlane(True))
	

TransactionManager.Instance.TransactionTaskDone()


OUT = reference, planes, names

The above code is embedded in the “Get Family Reference By Reference Name” code block.

Thanks for the code, it definitely gets references from the family types.
Also i have been trying multiple ways of delivering the correct data to the Dimensioning node, but nothing works.
This is the latest state of my script:


Use the “Dimension ByReferences” node and not the “Dimension ByElements” node and only input the references into the node. Leave out the curves.

Sorry it took so long to respond. It’s the holidays :slight_smile:

It doen’t solve the problem because that node requires a ‘Geometric Reference’ while the script you’ve provided retrieves a ‘Reference’.

Also, i noticed you’re using the Genius Loci variant for this node.
Not sure how much it differs from the vanilla “Dimension.ByReferences” node.

In any case: Both give the same warning as in the picture

Please show how you have your graph set up now using the “Dimension.ByReferences” node.

You need the Dynamo reference to the Revit reference - basically you need to wrap the element. This should be done in your Python, but I cannot tell you how or why as you haven’t shared that code.

1 Like

To @jacob.small and @staylor

Hereby i will attach everything involved with my work. It hasn’t changed much though.
Hopefully you can spot what is wrong with my graph and i hope this is enough data about this problem.

This is my Revit workspace for this exercise:

This is my Dynamo workspace:

This is the error i get from the Dimension.ByReference node (vanilla node):

The code i’m using within the Python-script is this (you can find the textual source further back in this thread):

try dimension from genius loci as Samuel show, that one accept autodesk.revit.db.reference

Here is a basic test script with the results. Using the OOTB Dimension.ByReferences node as you have, gave me the same error. But the GeniusLoci node works correctly.

2 Likes

This works GREAT
Thanks for all the help !!

Actually i am working with separate dimensions for each symbol, but i have solved that with the codeblock script and using level-2 on the ‘References’ input slot