kulkul-
I’m with Timon on this - what you showed only will work if the columns are slanted column. It is possible to change the columns to slanted, pull the locations and/or curves, then switch back to vertical columns, but that taxes the system pretty good if you have more than a handful of columns (note the conversation in the post Einar referenced)
Timon-
Try this bit of Python Script (it’s essentially a modification of element .location + the top and bottom offset calculations)
import clr
import math
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
clr.AddReference("DSCoreNodes")
from DSCore import*
doc = DocumentManager.Instance.CurrentDBDocument
columnz = UnwrapElement(IN[0])
projectElevBool = IN[1]
startpointlist = list()
endpointlist = list()
rotations = list()
curves = list()
columnstyle=list()
for col in columnz:
paramlist = col.Parameters
rotparam = BuiltInParameter.STRUCTURAL_BEND_DIR_ANGLE
colstyle=-1
baselevel = -1
toplevel=-1
baseoff ='nada'
topoff = 'nada'
for p in paramlist:
if p.Definition.Name =='Column Style':
colstyle = col.get_Parameter(p.Definition).AsInteger()
if p.Definition.Name =='Base Level':
baselevel= doc.GetElement(col.get_Parameter(p.Definition).AsElementId())
if p.Definition.Name =='Base Offset':
baseoff= col.get_Parameter(p.Definition).AsDouble()
if p.Definition.Name =='Top Level':
toplevel= doc.GetElement(col.get_Parameter(p.Definition).AsElementId())
if p.Definition.Name =='Top Offset':
topoff= col.get_Parameter(p.Definition).AsDouble()
if projectElevBool == True:
basel = baselevel.ProjectElevation
topel = toplevel.ProjectElevation
else:
basel = baselevel.Elevation
topel = toplevel.Elevation
if colstyle ==0:
columnloc =col.Location.Point
rotations.append(math.degrees(col.Location.Rotation))
#rotations.append(col.Location.Rotation)
newXYZbottom =XYZ(columnloc.X,columnloc.Y,basel + baseoff)
newXYZTop =XYZ(columnloc.X,columnloc.Y,topel + topoff)
startpointlist.append(newXYZbottom.ToPoint())
endpointlist.append(newXYZTop.ToPoint())
curves.append(Line.ByStartPointEndPoint(newXYZbottom.ToPoint(),newXYZTop.ToPoint()))
columnstyle.append(0)
elif colstyle ==1 or colstyle ==2:
startpointlist.append(col.Location.Curve.GetEndPoint(0).ToPoint())
endpointlist.append(col.Location.Curve.GetEndPoint(1).ToPoint())
rotations.append(math.degrees(col.get_Parameter(rotparam).AsDouble()))
#rotations.append(col.get_Parameter(rotparam).AsDouble())
curves.append(col.Location.Curve.ToProtoType())
columnstyle.append(2)
else:
columnloc =col.Location.Point
rotations.append(math.degrees(col.Location.Rotation))
newXYZbottom =XYZ(columnloc.X,columnloc.Y,basel + baseoff)
newXYZTop =XYZ(columnloc.X,columnloc.Y,topel + topoff)
startpointlist.append(newXYZbottom.ToPoint())
endpointlist.append(newXYZTop.ToPoint())
rotations.append(-1*math.degrees(col.Location.Rotation))
#rotations.append(col.Location.Rotation)
curves.append(Line.ByStartPointEndPoint(newXYZbottom.ToPoint(),newXYZTop.ToPoint()))
columnstyle.append(0)
OUT = (startpointlist,endpointlist,curves,rotations,columnstyle)