Tagging Valves - Leader in Python

I need a bit of a leg up with an Automatically Tagging effort.

I do have it working, but I have precious little coding experience beyond AutoLISP and a little of VBA. I have only a little idea what this Phython Script is doing.

How can I make some sense out of this Python Script?
Is there a good place to go for Revit Python Properties and Methods and Syntax reference?
(Intellesense inside Python Script node would be a big help)

Take a look at the Revit API documentation. You can dive into each of the tag properties to see exactly which data type Revit expects to be stored within it. Take line 38 for example.

tag.LeaderEndCondition = LeaderEndCondition.Free

This is the IndependentTag’s LeaderEndCondition property. This property contains an actual LeaderEndCondition.

If we look at the LeaderEndCondition Enumeration, we can see that there are two options: Free or Attached.

We can access these members directly by either typing
LeaderEndCondition.Free
or
LeaderEndCondition.Attached

In the next line, I’m not sure exactly where the .ToXyz() method is coming from, but it looks like it might be from the Revit.GeometryConversion extension in line 20.

I tried using… LeaderEndCondition.Attached

When I do… the tags are thrown to the other side of the elements and the Python Script node generates this Warning.

Warning:
IronPythonEvaluator.EvaluateIronPythonScript 
operation failed. 
Traceback (most recent call last):
  File "<string>", line 40, in <module>
Exception: There is no leader end because the
tag does not use a free end leader.

I should’ve looked a little more deeply into the rest of the code–maybe the LeaderEndCondition was a bad example. Attached leaders do not report leader ends, according to the documentation, hence the Exception. So, you would be able to change the LeaderEndCondition to Attached, but it would prevent the LeaderEnd property from being accessed.