Class InstanceVoidCutUtils

Hello,
I have a problem with a class used (InstanceVoidCutUtils), it is quite possible that I am not using the appropriate class (sorry in advance in this case)

import sys
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

tocut = UnwrapElement(IN[0])
cut = UnwrapElement(IN[1])


TransactionManager.Instance.EnsureInTransaction(doc)
InstanceVoidCutUtils.AddInstanceVoidCut(doc, tocut, cut)
TransactionManager.Instance.TransactionTaskDone()

OUT = 0

error:


I’m trying to cut a beam with a family created and placed in the beam.
thanks in advance
Cordially
christian.stan

My problem comes from a false answer of the family with Void solid (yet I sent the possibility of cutting)

import sys
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

tocut = UnwrapElement(IN[0])
cut = UnwrapElement(IN[1])
Verif_tocut=InstanceVoidCutUtils.CanBeCutWithVoid(tocut)
Verif_cut=InstanceVoidCutUtils.IsVoidInstanceCuttingElement(cut)

#TransactionManager.Instance.EnsureInTransaction(doc)
#InstanceVoidCutUtils.AddInstanceVoidCut(doc, tocut, cut)
#TransactionManager.Instance.TransactionTaskDone()

OUT = Verif_tocut,Verif_cut

but when opening this Void family it is not checked

I don’t understand (one thing escapes me)
Cordially
christian.stan

Show what is being returned in the nodes identified below. This is to help understand why the checkbox is not getting checked.

For the cutting issue, try looking at SolidCutUtils instead of VoidCutUtils and see if you get positive results.

1 Like

Hello, thank you for your interest.
here with the results


I will try your advice with another class in the next few days (it’s getting late at my house and waking up at dawn tomorrow)

Cordially
christian.stan

Hello,
Finally succeeded with a 2nd script to do after 1st script
It must surely be a problem of synchronization (or of me very possible too)


thanks for the advice

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
a = UnwrapElement(IN[0])
b = UnwrapElement(IN[1])

TransactionManager.Instance.EnsureInTransaction(doc)

InstanceVoidCutUtils.AddInstanceVoidCut(doc,a,b)

TransactionManager.Instance.TransactionTaskDone()

edit: beginner solution
Cordially
christian.stan

If that’s the case, then you can try placing a TransactionEnd node before the void cutting python node in your first script.

Cool that you got it to work!

1 Like

Thanks for the compliment, and thanks for the tip, perfect more than a script :+1:

Cordially
christian.stan

1 Like