Hi all,
I am still begginer both at Dynamo and Phyton, and i have been trying to make the script for placing Spot Elevations on ducts, cable trays and pipes and it all works well with rectangular ducts and cable trays, but it wont work with round ducts and pipes. I am using Clockwork’s SpotElevation.ByPoint node. After trying various kind of inputs to the node with no success, i started looking into the code and i think that the problem is with referencing elements (lines 30,32). I tried playing with it and changing members of FindReferenceTarget to edge,all,element and curve with various input points from the pipe but i cant make it to work. I will attach one simple example of the script. Hope someone can help me out with this.
Tag - Spot Elevation.dyn (12.6 KB)
Thanks in advance for any help you could provide.
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
try:
ref = refintsec.FindNearest(pt,intsecvec[i].AsPoint().ToXyz()).GetReference()
elementlist.append(doc.Create.NewSpotElevation(view, ref, pt, pt.Add(bend.AsPoint().ToXyz()), pt.Add(end.AsPoint().ToXyz()), pt, leader))
except:
elementlist.append(None)
i += 1
TransactionManager.Instance.TransactionTaskDone()
OUT = elementlist