Create Dimension With OOTB Dimension.ByReferences

Hi all!

I am trying to create a dimension line of selected grids (all selected grids are parallel) using the ootb dynamo package but am receiving an error which I believe has to do with the referenceGeometry.
For the reference I tried to use the Grid.ElementCurveReference but didn’t work and now I am trying to insert the element reference which also isn’t working (as seen image of dynamo script).

Here is the image of script

@zviLNBRQ one function call away. although i would like to see how the ootb one works as well.

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

#Preparing input from dynamo to revit
grids = UnwrapElement(IN[0])

test = []
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

ref_arr = ReferenceArray()
for g in grids:
    ref_arr.Append(Reference(g))

doc.Create.NewDimension(doc.ActiveView, Line.CreateUnbound(grids[0].Curve.GetEndPoint(0), XYZ.BasisX), ref_arr)

TransactionManager.Instance.TransactionTaskDone()
     
OUT = 0
1 Like

Thanks!