How to get "end element" of a railing?

Hello,

i can`t get these object. the are nested in railing …



(sorry i don`t use english revit)
KR
Andreas

Hi @Draxl_Andreas
is each element railing and two spherical is unique solid? could you upload simple file example

1 Like

@RMohareb ,

there 2 familyinstances loaded into the railing…

but i can `t collect them
grafik

just i get the solid.

KR

Andreas
Geländer_Abschluss.rfa (436 KB)

1 Like

@Draxl_Andreas

can you Active share befor load into railling family . then select it from railling family by GetChildElements

1 Like

@RMohareb ,

it is not exposed :frowning:


i do not get the family even when it is shared

Railing is a system family and the family is loaded to it.


KR
Andreas

1 Like

@Draxl_Andreas

i load your family inside railing family then load it inside the project and it work? can you please share your railing family to test

1 Like

@RMohareb ,

in your test, did you place it in railing? it seems to be a regular family ?

maybe i have to start with a clean project

KR

Andreas

1 Like

Yes it is not railing. I do not know. can you share simple project file

1 Like

@RMohareb ,

Projekt222.rvt (620 KB)

1 Like

@Draxl_Andreas
sorry i can not solve. i can not found the nested family element in the Toprail family. what can i get only the solid as a geometry or as DB. solid element. also i get the uniq Solid id for both edge element it in number “13” which you can select this spesphic solid



Railing.dyn (19.7 KB)

I upgrade to Revit 2024. test and if it help you i will send Brimohareb pak for revit 2022

2 Likes

@RMohareb ,

thank you for your approche…

orginaly idea was to get start and endpoint of railing… so we can see top offset…

my idea was to implement these families and get the familyinstance.Location

KR

Andreas

1 Like

@Draxl_Andreas
If you need only th Position you can get it’s solid by ID i think it constant for each project (you need to get it one time for each project) here on this project is “13” then get the cg of this solid


I don’t believe this will work, as start and end terminations of both handrails and top rails are all incorporated only by reference.

Can you show in the Revit UI what you are after by Top Offset?

@jacob.small ,


f.e. beams have a start and endpoint… now about railings ? or is there just the “flatten” path ?
KR
Andreas

Just the ‘flat’ path. The sketch lines have a property which I don’t believe can be accessed via the API to get the ‘offset height’.

FYI: This will get many of the component types which make up a railing (which is what I thought you were after when I read the original request).

import sys #add the sys class to the Python environment so we can work with the sys objects
import clr #add the CLR (common language runtime) class to the Python environment so we can work with .net libraries
clr.AddReference("RevitNodes") #add Dynamo's Revit nodes library to the clr
import Revit #import Dynamo's Revit node class
clr.ImportExtensions(Revit.Elements) #add the element conversion methods to the CLR
clr.AddReference("RevitServices") #add the Revit services library to the CLR
import RevitServices #import the Revit services class to the Python environment
from RevitServices.Persistence import DocumentManager #import the documet manager class to the Python environment 
clr.AddReference("RevitAPI") #add the Revit API to the CLR
import Autodesk #add the Autodesk class to the Python environment 
from Autodesk.Revit.DB import * #import every class of the Revit API to the Python environment

doc = DocumentManager.Instance.CurrentDBDocument #the current Revit document
elems = UnwrapElement(IN[0]) #import the elements from IN[0] of the Dynamo environment and convert to native Revit elements
if not elems.__class__ == [].__class__ : elems = [elems] #ensure that elems is a list, not an individual object, so that we can always prepare for a loop
railDataSets = [] #empty list to hold the handrail data

for elem in elems: #loop over the elements
	railData = {"Top Rail Type": None, "Top Rail End Termination": None, "Top Rail Start Termination": None, "Primary Handrail Type": None, "Primary Handrail End Termination": None, "Primary Handrail Start Termination": None, "Secondary Handrail Type": None, "Secondary Handrail End Termination": None, "Secondary Handrail Start Termination": None} #build the railing data dictionary
	type = doc.GetElement(elem.GetTypeId()) #get the element type
	topType = doc.GetElement(type.TopRailType) #get the top rail type
	if topType != None: #if there was a top rail
		railData["Top Rail Type"] = topType #set the rail type
		topEndTopTerm = doc.GetElement(topType.EndOrTopTermination) #get the end termination type
		topSrtBotTerm = doc.GetElement(topType.StartOrBottomTermination) #get the start termination type
		railData["Top Rail End Termination"] = topEndTopTerm #set the end termination 
		railData["Top Rail Start Termination"] = topSrtBotTerm #set the start termination 
	primeHandrailType = doc.GetElement(type.PrimaryHandrailType) #get the primary handrail type
	if primeHandrailType != None: #if there was a primary handrail
		railData["Primary Handrail Type"] = primeHandrailType.ToDSType(True) #set the rail type
		primEndTopTerm = doc.GetElement(primeHandrailType.EndOrTopTermination) #get the end termination type
		primSrtBotTerm = doc.GetElement(primeHandrailType.StartOrBottomTermination) #get the start termination type
		railData["Primary Handrail End Termination"] = primEndTopTerm #set the end termination 
		railData["Primary Handrail Start Termination"] = primSrtBotTerm #set the start termination 
	secondHandrailType = doc.GetElement(type.SecondaryHandrailType)
	if secondHandrailType != None: #set the rail type
		railData["Secondary Handrail Type"] = secondHandrailType.ToDSType(True) #set the rail type
		scndEndTopTerm = doc.GetElement(secondHandrailType.EndOrTopTermination) #get the end termination type
		scndSrtBotTerm = doc.GetElement(secondHandrailType.StartOrBottomTermination) #get the start termination type
		railData["Secondary Handrail End Termination"] = scndEndTopTerm #set the end termination 
		railData["Secondary Handrail Start Termination"] = scndSrtBotTerm #set the start termination 
	railDataSets.append(railData) #add the rail data dictionary to the rail datasets list

OUT = railDataSets #return the rail dataset to the Dynamo environment
3 Likes

@jacob.small ,

what have i to input ?

KR

Andreas

Try the CPython engine.

@jacob.small ,

same error

KR
Andreas

Working fine here: