Get Revit.DB.Reference from a grid

Does anyone know how to get the Revit.DB.Reference from a grid?

I’m using the NewDimension method which quires an array of geometric references to which the dimension is to be bound. But the grid does not seem to have any such geometric reference. According to this post, I need to include non visible geometry. But I’m not sure how that is done. Any thoughts?

@Paul_Wintour

Maybe this helps

image

Springs Package

Doesn’t seem to work on grids…

@Dimitar_Venkov any thoughts?

If its just Grids you can use
Maatvoering Stramienen.dyn (62.3 KB)

I posted Element.Geometry+ since it has the method for invisible objects inside it in Python, which might be of use.

The OOTB dimension node only works with line based elements (such as grids). I’m trying to create a string of dimensions to various elements - grids, stairs, walls, etc. For this I need the Revit.DB.Reference. I can get this for the other elements, but not grids. Any other thoughts?

Extract the geometry of the grid and get a reference from the contained curve(s). Be sure to set ComputeReferences to true

@Dimitar_Venkov I’m guessing you mean via Python?

Is this what you mean - Grid > curve > reference

I can get this but to be able to use it for creating a dimension, it needs to be a Revit.DB.Reference doesn’t it?

Last time I checked, clockwork’s node filtered out only solids. You need to use similar code but get the curves of the grid instead. Once you’ve done that with geometry extraction options that had the compute references turned on, you’ll be able to pull out a valid reference for use in dimensions.

Hello! If I understood you correctly, now these referents for grids on the python:
for grid in grids:
____for obj in grid.get_Geometry(opt):
________if isinstance(obj, Line):
________gline = obj
________Ref.Append(gline.Reference)

Hello Myhail, have You resolve this by any chance ? I am searching for same solution but with no API experiance.
Regards

Copy the following code into a Python node :grinning:

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

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

clr.AddReference('RevitAPIUI')
from  Autodesk.Revit.UI import *

doc = DocumentManager.Instance.CurrentDBDocument

def tolist(obj1):
    if hasattr(obj1,'__iter__'): return obj1
    else: return [obj1]

grids=tolist(UnwrapElement(IN[0]))
Ref=[]

opt=Options()
opt.ComputeReferences=True
opt.IncludeNonVisibleObjects=True
opt.View=doc.ActiveView

for grid in grids:
	for obj in grid.get_Geometry(opt):
		if isinstance(obj, Line):
			gline = obj
			Ref.append(gline.Reference)
OUT = Ref
6 Likes

@Paul_Wintour, you can get Reference by this way also;

4 Likes

Master THANK You