Structural Framing Is Allow Join Ends

Looking to create a Python to give Bool results for Start and End if Join is Allowed. true/false

I found a Python to set to Allow or Disallow, now looking to create a filter for these items.

Fairly new to Python looking for some help to give me Bool values.

import clr

Import RevitAPI

clr.AddReference(“RevitAPI”)
import Autodesk
from Autodesk.Revit.DB import *

Import DocumentManager and TransactionManager

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)

Unwrap

input = UnwrapElement( IN[0] )
elements =
#force input into list
try:
for e in input:
if e.Category.Name == “Structural Framing”:
elements.append(e)
except:
if input.Category.Name == “Structural Framing”:
elements.append(input)

Start Transaction

doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)

for e in elements:
Autodesk.Revit.DB.Structure.StructuralFramingUtils.IsJoinAllowedAtEnd(e, 0)
Autodesk.Revit.DB.Structure.StructuralFramingUtils.IsJoinAllowedAtEnd(e, 1)

End Transaction

TransactionManager.Instance.TransactionTaskDone()

Wrap

OUT = elements

Please make sure you paste formatted code with the preformatted text option (</> in the formatting toolbar).

You have the method for getting the boolean value. Now you just have to do something depending on whether the method returns true or false. If it’s as simple as creating two lists, then you just need to do that and append each element that meets the condition (or doesn’t).

1 Like

hi

import sys
import clr

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB.Structure import StructuralFramingUtils as sfu

elts=UnwrapElement(IN[0])

stock=[]
for e in elts:
    stock.append([sfu.IsJoinAllowedAtEnd(e,0),sfu.IsJoinAllowedAtEnd(e,1)])
OUT = stock

cordially
christian.stan

Christian,

This works thank you, I was able to modify what you gave me to understand more of what you did. Once I saw it written out it helps me understand better what I was missing. I may not go my route will most likely use yours, but will not know until I start developing the graph more.

Below is a slight modification, just to separate out what was “start” or “end”

import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

import sys
import clr

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB.Structure import StructuralFramingUtils as sfu

elts=UnwrapElement(IN[0])

start=[]
for e in elts:
    start.append([sfu.IsJoinAllowedAtEnd(e,0)])
end=[]
for e in elts:
    end.append([sfu.IsJoinAllowedAtEnd(e,1)])
OUT = start, end
1 Like

Nick,

Thank you for pointing out the </> in formatting tool. I will start using that from here on out.

1 Like

Hi, to avoid adding a list of lists with append, you can hide the [ ]
start.append(sfu.IsJoinAllowedAtEnd(e,0))

Sincerely
christian.stan

1 Like