Spotelevation leader location

In an attempt to neatly align spotelevations, I’m trying to access the leader location lines.

So roughly:

  • select elements
  • get location through nodes: gives the insertion point of a spot elevation not the leader / shoulder.
  • through python / api I believe this would be the Leader class, which would give access to the elbow.
  • my thought is: after getting the location of the elbows, set that location to a common x-value: done.

Accessing it through python gives ‘no attribute Leader’. Which makes sense however … how would I be able to access it?

import clr
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

elements = UnwrapElement(IN[0])

output = []

for element in elements:
	new = element.Leader
	result = new

#Assign your output to the OUT variable.
OUT = output

If you need to find a command or method, check out the API docs.

Just from a quick glance, it doesn’t seem like you can edit the leader of a spot elevation in API, at least not in the same way you can with a textnote using .Leaders or .GetLeaders(). The only command relevant to leaders from a SpotDimension class tag is .LeaderEndPosition and it raises an error specifically when used for SpotElevations. In fact, most of the class’s functions seem to give the same error saying spot elevations are not able to use it.
.IsTextPositionAdjustable() also returns false, meaning that leader position is not retrievable.

I have seen code like the building coder’s create a spot elevation that lets you set the bends within the constructor but can’t find one for editing the elbow after being created.