I don’t think the issue with the node has been fixed yet. I have made it worked by reverses engineering the node and reading up on a blog post.
See here:https://thebuildingcoder.typepad.com/blog/2017/06/hatch-line-dimensioning-voodoo.html#4
Bellow is the python node I use to get the grid starting point and direction. I have nodes later in the script that take this and reconstruct the grid.
import clr
# Importing Revit Services
clr.AddReference('RevitServices')
from RevitServices.Persistence import *
from RevitServices.Transactions import TransactionManager
# Importing Revit API
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
# Importing Revit Nodes
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
# Importing Geometry Conversion
clr.ImportExtensions(Revit.GeometryConversion)
# Get the current Revit document
doc = DocumentManager.Instance.CurrentDBDocument # Define the inputs
gridCounts = IN[0]
faces = UnwrapElement(IN[1])
linked_doc = UnwrapElement(IN[2])
# Initialize output lists
gridDimsList=[]
refPointsList=[]
dimLineDir=[]
# Function to process a single set of inputs
def process_inputs(gridCount, faceRefs):
# Initialize lists to store the references for vertical and horizontal dimensions
resAr1List = []
resAr2List = []
resAr3List = []
for faceRef in faceRefs: # Iterate over the face references
e = doc.GetElement(faceRef)
faceGeom = e.GetGeometryObjectFromReference(faceRef)
stableRef = faceRef.ConvertToStableRepresentation(doc)
ip = 0
while ip < 2:
index1 = 1 + (ip * gridCount * 2)
index2 = 2 + (ip * gridCount * 2)
#index3 = 3 + (ip * gridCount * 2)
stableHatchString1 = stableRef + '/' + str(index1)
stableHatchString2 = stableRef + '/' + str(index2)
#stableHatchString3 = stableRef + '/' + str(index3)
hatchRef1 = Reference.ParseFromStableRepresentation(doc, stableHatchString1)
hatchRef2 = Reference.ParseFromStableRepresentation(doc, stableHatchString2)
#hatchRef3 = Reference.ParseFromStableRepresentation(doc, stableHatchString3)
resAr1List.append(hatchRef1)
resAr2List.append(hatchRef2)
#resAr3List.append(hatchRef3)
ip += 1
# Create reference arrays for vertical and horizontal dimensions
refArr1 = ReferenceArray()
refArr2 = ReferenceArray()
refArr3 = ReferenceArray()
for r in resAr1List:
refArr1.Append(r)
for r in resAr2List:
refArr2.Append(r)
#for r in resAr3List:
# refArr3.Append(r)
# Create dimensions
spoint = XYZ(0, 0, 0)
epoint = XYZ(10, 0, 0)
TransactionManager.Instance.EnsureInTransaction(doc)
dim1 = doc.Create.NewDimension(doc.ActiveView, Line.CreateBound(spoint, epoint), refArr1)
dim2 = doc.Create.NewDimension(doc.ActiveView, Line.CreateBound(spoint, epoint), refArr2)
#dim3 = doc.Create.NewDimension(doc.ActiveView, Line.CreateBound(spoint, epoint), refArr3)
ElementTransformUtils.MoveElement(doc, dim1.Id, XYZ(0.1, 0, 0))
ElementTransformUtils.MoveElement(doc, dim2.Id, XYZ(0.1, 0, 0))
#ElementTransformUtils.MoveElement(doc, dim3.Id, XYZ(0.1, 0, 0))
gridDimsList.append((dim1.Value, dim2.Value))
refPointsList.append((dim1.Origin.ToPoint(), dim2.Origin.ToPoint()))
dimLineDir.append((dim1.Curve.Direction.ToVector(),dim2.Curve.Direction.ToVector()))
doc.Delete(dim1.Id)
doc.Delete(dim2.Id)
#doc.Delete(dim3.Id)
TransactionManager.Instance.TransactionTaskDone()
# Iterate over each item in the inputs
for idx in range(len(gridCounts)):
gridCount = gridCounts[idx]
faceRefs = faces[idx] if isinstance(faces[idx], list) else [faces[idx]]
process_inputs(gridCount, faceRefs)
# Output the lists of dimension values and reference points
OUT = refPointsList,dimLineDir