RemoveInstanceVoidCut Method


Remove a cut applied to the element by a cutting instance with unattached voids.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 17.0.0.0 (17.0.1090.0)
Since: 2011

Syntax

C#
public static void RemoveInstanceVoidCut(
	Document document,
	Element element,
	Element cuttingInstance
)
Visual Basic
Public Shared Sub RemoveInstanceVoidCut ( _
	document As Document, _
	element As Element, _
	cuttingInstance As Element _
)
Visual C++
public:
static void RemoveInstanceVoidCut(
	Document^ document, 
	Element^ element, 
	Element^ cuttingInstance
)

Parameters

document
Type: Autodesk.Revit.DB Document
The document containing the two elements
element
Type: Autodesk.Revit.DB Element
The element being cut
cuttingInstance
Type: Autodesk.Revit.DB Element
The cutting family instance

Examples

Copy C#
// remove all cuts in all family instances created by void-cutting instances
void RemoveVoidCuts(Autodesk.Revit.DB.Document doc, FamilySymbol cuttingSymbol)
{
    FilteredElementCollector collector = new FilteredElementCollector(doc);
    collector.WherePasses(new FamilyInstanceFilter(doc, cuttingSymbol.Id)); // find elements that are family instances of the cutting family

    foreach (FamilyInstance instance in collector)
    {
        foreach (ElementId elementId in InstanceVoidCutUtils.GetElementsBeingCut(instance)) // elements being cut by this instance of the cutting family
        {
            InstanceVoidCutUtils.RemoveInstanceVoidCut(doc, doc.GetElement(elementId), instance); // remove the cut
        }
    }
}
Copy VB.NET
' remove all cuts in all family instances created by void-cutting instances
Private Sub RemoveVoidCuts(doc As Autodesk.Revit.DB.Document, cuttingSymbol As FamilySymbol)
    Dim collector As New FilteredElementCollector(doc)
    collector.WherePasses(New FamilyInstanceFilter(doc, cuttingSymbol.Id))
    ' find elements that are family instances of the cutting family
    For Each instance As FamilyInstance In collector
        For Each elementId As ElementId In InstanceVoidCutUtils.GetElementsBeingCut(instance)
            ' elements being cut by this instance of the cutting family
                ' remove the cut
            InstanceVoidCutUtils.RemoveInstanceVoidCut(doc, doc.GetElement(elementId), instance)
        Next
    Next
End Sub

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException No instance void cut exists between the two elements.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions InvalidOperationException Failed to remove the instance cut from the element

See Also