Bakery Element Void Cut (change for Join)

bakery

#1

Hello,

I dont have any experience with programming and i found this custom node of Bakery the Element Void Cut.

Now i was wondering if it’s possible to make it for Joining elements, i tried something myself, but obvious it didnt work :slight_smile:

import clr

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

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

def tolist(obj1):
	if hasattr(obj1,"__iter__"): return obj1
	else: return [obj1]

def output1(l1):
	if len(l1) == 1: return l1[0]
	else: return l1

ToBeJoin = UnwrapElement(tolist(IN[0]))
Join = UnwrapElement(tolist(IN[1]))
out1 = []

joinU = SolidSolidCutUtils
TransactionManager.Instance.EnsureInTransaction(doc)
for i in xrange(len(ToBeJoin)):
	if joinU.IsAllowedForSolidCut(ToBeJoin[i]):
		count = 0
		for j in xrange(len(Join)):
			if joinU.CanElementCutElement(Join[j]) and \
			not joinU.CutExistsBetweenElements(ToBeJoin[i],Join[j]):
				try: 
					joinU.AddCutBetweenSolids(doc,ToBeJoin[i],Join[j])
					count += 1
				except: pass
		out1.append("%s out of %s join created." %(count, len(Join)) )
	else:
		out1.append("Element could not be Joined")
TransactionManager.Instance.TransactionTaskDone()

OUT = output1(out1)