@jeremytammik
Sorry for misleading. I meant to say that my implementation of it found only parallel walls, and seemed not to create the dimension line if oblique walls were involved.
I'd love to know how it can be done otherwise, but I've gone through the examples and the API and haven't found a way.
The code I'm using is:
def GetIntersectingElements(doc, origin, vec):
viewTypeCollector = FilteredElementCollector(doc).OfClass(ViewFamilyType).ToElements()
for i in viewTypeCollector:
if i.ViewFamily == ViewFamily.ThreeDimensional:
view3D = i
viewType = i
t = Transaction(doc, "Create Temporary 3D View")
t.Start()
view3D = View3D.CreateIsometric(doc, viewType.Id)
t.Commit()
wallFilter = ElementClassFilter(Wall)
refIntersector = ReferenceIntersector(wallFilter, FindReferenceTarget.Edge, view3D)
referenceWithContext = refIntersector.Find( origin, vec )
refArray = ReferenceArray()
for ref in referenceWithContext:
refArray.Append(ref.GetReference())
return refArray
# MAIN
origin = uidoc.Selection.PickPoint()
tGroup = TransactionGroup(doc, "Create Dimensions XY")
tGroup.Start()
references = GetIntersectingElements( doc, origin, XYZ(1,0,0) )
t2 = Transaction(doc, "Create Dimension X")
t2.Start()
refLine = Line.CreateUnbound( origin, XYZ(1,0,0) )
gridDimension = doc.Create.NewDimension(doc.ActiveView, refLine, references)
t2.Commit()
tGroup.Commit()
This successfully dimensions between a series of walls, but only when parallel.
I was thinking that as per the other approach, finding the intersections between Faces and the Curve could produce more robust results for different kinds of wall orientation.