How to join and dissalow join different elements

import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
clr.AddReference(‘RevitAPI’)
import Autodesk

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

clr.AddReference(‘RevitNodes’)
import Revit
clr.ImportExtensions(Revit.Elements)
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

elementA = UnwrapElement(IN[0])
elementB = UnwrapElement(IN[1])

doc = DocumentManager.Instance.CurrentDBDocument

results = []

#Unjoin
TransactionManager.Instance.EnsureInTransaction(doc)
for A in elementA:
for B in elementB:
try:
result = Autodesk.Revit.DB.JoinGeometryUtils.UnjoinGeometry(doc,A,B)
result.append(result)
except:
pass
TransactionManager.Instance.TransactionTaskDone()

#Join
TransactionManager.Instance.EnsureInTransaction(doc)
for A in elementA:
for B in elementB:
try:
result = Autodesk.Revit.DB.JoinGeometryUtils.JoinGeometry(doc,A,B)
result.append(result)
except:
pass
TransactionManager.Instance.TransactionTaskDone()

#Switch Join
TransactionManager.Instance.EnsureInTransaction(doc)
for A in elementA:
for B in elementB:
try:
result = Autodesk.Revit.DB.JoinGeometryUtils.SwitchJoinOrder(doc,A,B)
result.append(result)
except:
pass
TransactionManager.Instance.TransactionTaskDone()
OUT = results

please i will join structral elements and dissallow join non structural elements

See also following topic:

1 Like

hello
i adjusted the title

1 Like

You need to instal the Hotgear package
it has a lot of nodes for join etc

Auto Join without Order.dyn Please do not work

Capture2

the nodes from hotgear are working

I didn’t find These fields

Modify it to achieve this
I’m sorry to waste your time

sdfzeeaz

Goodmorning

i adjusted your script

join - unjoin-switch join order Geometry.dyn (24.3 KB)

2 Likes

Goodmorning
I regret it did not work
https://drive.google.com/file/d/11m8qkRGb1_zI6LI9KCAtGFbtRdjsENoK/view

it depends on the way you use it probably. one time run goes great. two times not. thare for you need to restart dynamo.
But now i put a toggle from the Rhythm package. you can run it as much as you like.

1 Like

join - unjoin-switch join order Geometry.dyn (26.4 KB)

2 Likes

I’m still sorry the problem
Once again Thank you

in my case it works
i put all 3 options in one script
you have to run one option and delete or freeze the other 2

have Revit 2018 and Dynamo version 1.3.2.2480

What version off Dynamo do you use?

my version Revit 2017 and Dynamo version 1.3.2.2480

Works only SwitchJoin.Geometry For one column