Not really a Dynamo question, but happy to leave it out incase someone has some known workaround.
Just in case though I suggest you submit a ticket to Autodesk support via the accounts portal at manage.autodesk.com. No need to bring up dynamo when you do so, just point out that cut slab (or wall) geometry is being written to IFC as an opening but it likely ought to be ______. The IFC team will know pretty quick kf this is expected IFC behavior or how you need to edit the geometry.
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from System.Collections.Generic import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
items1 = UnwrapElement(IN[0])
items2 = UnwrapElement(IN[1])
def CutGeometry(doc, item1, item2):
try:
SolidSolidCutUtils.AddCutBetweenSolids(doc,item1,item2)
return True
except:
try:
InstanceVoidCutUtils.AddInstanceVoidCut(doc,item1,item2)
return True
except: pass
TransactionManager.Instance.EnsureInTransaction(doc)
if isinstance(IN[0], list):
if isinstance(IN[1], list): OUT = [CutGeometry(doc, x, y) for x, y in zip(items1, items2)]
else: OUT = [CutGeometry(doc, x, items2) for x in items1]
else:
if isinstance(IN[1], list): OUT = [CutGeometry(doc, items1, x) for x in items2]
else: OUT = CutGeometry(doc, items1, items2)
TransactionManager.Instance.TransactionTaskDone()
so when i do it manualy it works! when i run the script!
Just to add that I’ve seen a lot of IFC models with these solid cutters. I’ve always assumed they either are meant to be this (so that they exist as an element in the IFC schema), or they’re needed for the IFC to capture this boolean operation due to not being able to achieve it the same way as Revit does natively.
Could be wrong, but it’s very common to see these and often in duplicate/triplicate etc.
This is why I indicated to pass the issue on as a case, which gets funneled to a problem report and added the development backlog as appropriate/possible. Note this may also be an issue with the viewer (ie: Solibri), so doing the same at there end is advisable.
Dug into this with a colleague today after the case was submitted. The code produces an IFC export which is the same as if we did the cuts manually. The only possible difference is that this performs a cut of all elements in list two by all elements in list 1, so you may be cutting an object out of an element which it doesn’t touch, thereby adding a cut element which results in no geometric change…
Testing for geometry intersection before performing the cut would resolve that issue, assuming it is an issue at all.
As a side note, using try/except statements to control data flow isn’t ideal, doubly so when you later a ‘pass’ on the end. Revising the loop to remove the try is advisable.