Good morning everyone,
I am using dynamo in order to accelerate the process of joining elements.
I have several hundreds of structural framing, structural columns and floors that I need to join in order to avoid double concrete volumes in schedules.
In this video I have found a python script that does what I want, allowing me to join, unjoin or switch join order for a certain group of objects.
The problem is that I am dealing with a really large quantity of elements, this is why I want to apply this definition to group of elements that do not necessarily intersect. This leads to a massive amount of warnings.
Thanks to the âdoes intersect?â node I can get where I want in terms of lists: for example, I would have a list of n floors and a list of n sub-lists in which all the beams intersecting each floor are contained.
Obviousluy the python script wonât work with this list structure.
I know that there might be alternative solutions to my problem (like solving the warnings in a second moment or other) and I appreciate all kind of suggestions, but I really want to improve my python skills.
For this reason I would like to ask how can I adapt the scripts shown in the video in order to get there.
I think this can be useful for many people: there are several python scripts out there, they can be applied to a single set of elements but they donât always work with sublists.
Thanks in advance!
This is the code of the video:
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 = []
TransactionManager.Instance.EnsureInTransaction(doc)
for A in elementA:
for B in elementB:
try:
result = Autodesk.Revit.DB.JoinGeometryUtils.JoinGeometry(doc,A,B)
#The function on the previous line can be replaced with SwitchJoinOrder or UnjoinGeometry.
results.append(result)
except:
pass
TransactionManager.Instance.TransactionTaskDone()
#Assign your output to the OUT variable.
OUT = results