Spot Coordinate Tag using python

python

#1

Hi Community,

Im trying to recreate Clockworks “Spot Elevationby points” but instead of elevation i want to put spot coordinates to selected elements.

Would it be possible? if yes any help would be much appreciated.

Thank you.

    import clr
    clr.AddReference('RevitAPI')
    from Autodesk.Revit.DB import *

    clr.AddReference("RevitNodes")
    import Revit
    clr.ImportExtensions(Revit.GeometryConversion)

    clr.AddReference("RevitServices")
    import RevitServices
    from RevitServices.Persistence import DocumentManager
    from RevitServices.Transactions import TransactionManager

    doc = DocumentManager.Instance.CurrentDBDocument
    views = UnwrapElement(IN[0])
    pts = UnwrapElement(IN[1])
    bend = UnwrapElement(IN[2])
    end = UnwrapElement(IN[3])
    leader = UnwrapElement(IN[4])
    isoview = UnwrapElement(IN[5])
    intsecvec = UnwrapElement(IN[6])
    elementlist = []

    i = 0;
    TransactionManager.Instance.EnsureInTransaction(doc)
    for pt in pts:
    	view = views[i]
    	pt = pt.ToXyz()
    	refintsec = ReferenceIntersector(isoview)
    	refintsec.TargetType = FindReferenceTarget.Face
    	ref = refintsec.FindNearest(pt,intsecvec[i].AsPoint().ToXyz()).GetReference()
    	elementlist.append(doc.Create.NewSpotCoordinate(view, ref, pt, pt.Add(bend.AsPoint().ToXyz()), pt.Add(end.AsPoint().ToXyz()), pt, leader))
    	i += 1
    TransactionManager.Instance.TransactionTaskDone()

    OUT = elementlist

#2

Could you tell us what the error is that is coming out of the python node.


#3

Hi here’s the error message

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 31, in
AttributeError: ‘NoneType’ object has no attribute ‘GetReference’