How to set "Disallow Join" for Structural Framing using Python?


#1

hello all,

i have a lot of structural framings and they all need to be at the end ‘disallowed join’. So when i have to do this by hand it is killing for my brain.

i’ve read some posts that it is possible in Python. Does some one have the code for this? I’ve really no idea where to start.

Also, where do i start if i want to do this my self? I’ve a link here about all kind of revit api docs, but how do i use it in Python?
http://www.revitapidocs.com/2017/6ea65e8b-45f6-afc6-ec04-de60fc248f17.htm


#2

try if this helps


#3

You can read abot clr and references here: Dividing parts with dynamo

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

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

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#Unwrapping Dynamoelement to Revit element.
beams = UnwrapElement(IN[0])

#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
for beam in beams:
	StructuralFramingUtils.DisallowJoinAtEnd(beam,0)
	StructuralFramingUtils.DisallowJoinAtEnd(beam,1)
TransactionManager.Instance.TransactionTaskDone()

OUT = 0

#4

great, it totally worked! Thanks a lot

i just needed to set the lacing on longest


#5

thnx, this is what i was looking for.


#7

check this code:

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

# Import ToDSType(bool) extension method
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.DisallowJoinAtEnd(e, 0)
    Autodesk.Revit.DB.Structure.StructuralFramingUtils.DisallowJoinAtEnd(e, 1)

# End Transaction
TransactionManager.Instance.TransactionTaskDone()

# Wrap
OUT = elements