Hi,
Super duper new to python so please bear with me here. I am trying to create a script that will allow me to automatically generate spot elevations at all slab shape points.
I tried to use the clockwork node SpotElevation.ByPoint but I found it very inconsistent, so I thought I would give it a shot on my own! However, i’m reaching a dead end with an error I don’t know how to diagnose. Error is as follows:
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import Element wrapper extension methods
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
view = doc.ActiveView
slab = UnwrapElement(IN[0])
vert = slab.SlabShapeEditor.SlabShapeVertices
pts=[]
ref=[]
bend=[]
end=[]
for v in vert:
pts.append(v.Position)
ref.append(Reference(slab))
bend.append(XYZ(v.Position.X + 0.5,v.Position.Y + 0.75,v.Position.Z))
end.append(XYZ(v.Position.X + 1,v.Position.Y + 1.5,v.Position.Z))
TransactionManager.Instance.EnsureInTransaction(doc)
for reference, points, bending, ending in zip(ref, pts, bend, end):
doc.Create.NewSpotElevation(view, reference, points, bending, ending, points, True)
TransactionManager.Instance.TransactionTaskDone()
#Assign your output to the OUT variable.
OUT = slab