# Dimensioning electrical MEP elements

**URL:** <https://forum.dynamobim.com/t/dimensioning-electrical-mep-elements/106227>\
**Category:** Uncategorized\
**Tags:** revit, dynamo\
**Created:** [December 1, 2024, 1:35pm UTC](https://forum.dynamobim.com/t/dimensioning-electrical-mep-elements/106227 "2024-12-01T13:35:35Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![d\_kemkes](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/d_kemkes/32/189315_2.png) [@d\_kemkes](https://forum.dynamobim.com/u/d_kemkes)\
**Post date:** [December 1, 2024, 1:35pm UTC](https://forum.dynamobim.com/t/dimensioning-electrical-mep-elements/106227/1 "2024-12-01T13:35:35Z")

</div>

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?

 ![Auto Dim_2024-12-01_02-25-59](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/a/ba04079c93cc2a60498fbcec166d4bdbad3c8769.png)

---

<div class="post-metadata">

**Author:** ![staylor](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/staylor/32/94307_2.png) [@staylor](https://forum.dynamobim.com/u/staylor)\
**Post date:** [December 2, 2024, 3:45pm UTC](https://forum.dynamobim.com/t/dimensioning-electrical-mep-elements/106227/2 "2024-12-02T15:45:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![d\_kemkes](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/d_kemkes/32/189315_2.png) [@d\_kemkes](https://forum.dynamobim.com/u/d_kemkes)\
**Post date:** [December 4, 2024, 7:47pm UTC](https://forum.dynamobim.com/t/dimensioning-electrical-mep-elements/106227/4 "2024-12-04T19:47:53Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![staylor](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/staylor/32/94307_2.png) [@staylor](https://forum.dynamobim.com/u/staylor)\
**Post date:** [December 4, 2024, 8:16pm UTC](https://forum.dynamobim.com/t/dimensioning-electrical-mep-elements/106227/5 "2024-12-04T20:16:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![d\_kemkes](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/d_kemkes/32/189315_2.png) [@d\_kemkes](https://forum.dynamobim.com/u/d_kemkes)\
**Post date:** [December 7, 2024, 12:35pm UTC](https://forum.dynamobim.com/t/dimensioning-electrical-mep-elements/106227/6 "2024-12-07T12:35:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![staylor](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/staylor/32/94307_2.png) [@staylor](https://forum.dynamobim.com/u/staylor)\
**Post date:** [December 9, 2024, 2:18pm UTC](https://forum.dynamobim.com/t/dimensioning-electrical-mep-elements/106227/7 "2024-12-09T14:18:26Z")

</div>

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).

```auto
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.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/2/d2db9a45807408f66b5a3f118ad704405c0c960a.png)

---

<div class="post-metadata">

**Author:** ![d\_kemkes](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/d_kemkes/32/189315_2.png) [@d\_kemkes](https://forum.dynamobim.com/u/d_kemkes)\
**Post date:** [December 15, 2024, 12:54pm UTC](https://forum.dynamobim.com/t/dimensioning-electrical-mep-elements/106227/8 "2024-12-15T12:54:55Z")

</div>

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:

 ![Auto Dimensions (1)_2024-12-14_04-22-30](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/e/0e5d3f1af0231e753327e9f0b08bd35325625be3.png)  
 ![Warning message](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/4/3458e15e1847723a40eeda3a501b8a1ba7da3612.png)

---

<div class="post-metadata">

**Author:** ![staylor](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/staylor/32/94307_2.png) [@staylor](https://forum.dynamobim.com/u/staylor)\
**Post date:** [December 16, 2024, 1:35pm UTC](https://forum.dynamobim.com/t/dimensioning-electrical-mep-elements/106227/9 "2024-12-16T13:35:50Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/b/5bdbdf8b7558771ac06ecf0aa6d9bef7ca649147.png)

---

<div class="post-metadata">

**Author:** ![d\_kemkes](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/d_kemkes/32/189315_2.png) [@d\_kemkes](https://forum.dynamobim.com/u/d_kemkes)\
**Post date:** [December 27, 2024, 4:30pm UTC](https://forum.dynamobim.com/t/dimensioning-electrical-mep-elements/106227/10 "2024-12-27T16:30:49Z")

</div>

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

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

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/5/852b4330427c95bd5127d826e5b70f504b0b2de4.png)

---

<div class="post-metadata">

**Author:** ![staylor](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/staylor/32/94307_2.png) [@staylor](https://forum.dynamobim.com/u/staylor)\
**Post date:** [December 30, 2024, 1:17pm UTC](https://forum.dynamobim.com/t/dimensioning-electrical-mep-elements/106227/11 "2024-12-30T13:17:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [December 30, 2024, 2:28pm UTC](https://forum.dynamobim.com/t/dimensioning-electrical-mep-elements/106227/12 "2024-12-30T14:28:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![d\_kemkes](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/d_kemkes/32/189315_2.png) [@d\_kemkes](https://forum.dynamobim.com/u/d_kemkes)\
**Post date:** [December 31, 2024, 11:02am UTC](https://forum.dynamobim.com/t/dimensioning-electrical-mep-elements/106227/13 "2024-12-31T11:02:23Z")

</div>

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:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/3/2352a289718f825f4e5323de9d3b893e331a7c6c.png)

This is my Dynamo workspace:

 ![Auto Dimensions_2024-12-31_11-46-47](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/6/a66c859df040a1b71242378cb172dd235e53cf0a.png)

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

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/5/852b4330427c95bd5127d826e5b70f504b0b2de4.png)

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

 ![Code](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/0/009ebe3375c8ffa199c4a47ae13a8608c5c65b9f.png)

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [December 31, 2024, 11:25am UTC](https://forum.dynamobim.com/t/dimensioning-electrical-mep-elements/106227/14 "2024-12-31T11:25:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![staylor](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/staylor/32/94307_2.png) [@staylor](https://forum.dynamobim.com/u/staylor)\
**Post date:** [December 31, 2024, 1:33pm UTC](https://forum.dynamobim.com/t/dimensioning-electrical-mep-elements/106227/15 "2024-12-31T13:33:06Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/5/a59d2bb3437611c31ce88d10be3048f14da00ead.png)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/d/8db2fd0ce790f95f54eee91e9cc3c508c0c5a6f8.png)

---

<div class="post-metadata">

**Author:** ![d\_kemkes](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/d_kemkes/32/189315_2.png) [@d\_kemkes](https://forum.dynamobim.com/u/d_kemkes)\
**Post date:** [January 4, 2025, 9:40am UTC](https://forum.dynamobim.com/t/dimensioning-electrical-mep-elements/106227/17 "2025-01-04T09:40:38Z")

</div>

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
