Hi,
I accessed the slope and span of family symbols.
How do I access each Location Point and Rotation?
import clr
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
categories = doc.Settings.Categories
all_elements = []
for category in categories:
collector = FilteredElementCollector(doc).OfCategoryId(category.Id)
elements = collector.ToElements()
if(len(elements) > 0):
all_elements.extend(elements)
tset = []
tset.append(["Id","type","slope","span","x","y","z","angle"])
for e in all_elements:
pslope = 0
pspan = 0
pref = ""
pskip = 1
pnset = []
for p in e.Parameters:
if("SLOPE" in p.Definition.Name.upper()):
pslope = p.AsDouble()
if("SPAN" in p.Definition.Name.upper()):
pspan = p.AsDouble()
#
if(p.AsString()is None):
continue
param_group = p.Definition.ParameterGroup
param_group_name = LabelUtils.GetLabelFor(param_group).upper()
if(param_group_name != "IFC PARAMETERS"):
continue
pnset.append(p.Definition.Name)
if(param_group_name == "IFC PARAMETERS" and p.Definition.Name == "Reference"):
if p.AsString() == "":
pskip = 1
continue
pref = p.AsString()
pskip = 0
if pskip == 0:
loc = e.Location
lp = None
lpx = None
lpy = None
lpz = None
lr = None
if isinstance(loc, LocationPoint):
lp = loc.Point
lpx = lp.X
lpy = lp.Y
lpz = lp.Z
lr = loc.Rotation
elif isinstance(loc, LocationCurve):
lp = loc.Curve.Evaluate(0.5, True)
curve = loc.Curve
direction = curve.GetEndPoint(1) - curve.GetEndPoint(0)
lr = direction.AngleTo(XYZ(1, 0, 0))
tset.append([e.Id, type(e) , pref, pslope, pspan,lpx,lpy,lpz,lr])
OUT = tset
Thx for your patience,
K.
a.rvt (3.3 MB)
IFCC-01.dyn (10.8 KB)