For specific API, please refer to the official documentation. Here is the keyword for cutting Void.

Overview

Application Scenarios

In actual projects, if you want to make a family to cut a component, you need to create a void extrusion, and then execute the cut command to cut off the model component we want to cut.
It is widely used in quantity calculation to execute join/cut commands, or connection order in actual engineering.
Or in projects with high precision requirements or where the owner delays settlement, there will also be some strange requirements, such as this structural beam cutting architectural wall I encountered.

Basic Logic

  1. First, take out the Solid of the structural beam in the linked structural model.
  2. Get all walls, intersect with the structural beam Solid obtained in the previous step, and take out the intersecting Solid.
  3. The second step will produce two directions:
    [ ] Each InsertSolid is generated as a family.
    [x] Merge into a large InsetSolid geometry, and create it separately with the corresponding name in one family.
  4. After generating the void shape (I used void extrusion here), modify the family parameter (Cut with Voids when Loaded) into the family. In this step, the online resources are all manual modifications which cannot meet the requirements of this function, so I will provide a piece of code below.
  5. Place it at the specified position and perform the cut operation between components.
  6. Complete.

Creating Void Family

Creating Family File

This step replaces the actual operation of File -> New File -> Category. We get the family document to draw shapes and modify parameters in the document.

Here I created a Metric Generic Model family.

1
2
3
var app = commandData.Application.Application;
var rfaDoc = app
.NewFamilyDocument(@"C:\ProgramData\Autodesk\RVT 2019\Family Templates\Chinese\Metric Generic Model.rft");

Creating Void Extrusion

  1. The command used here gets the intersection of solids.
1
2
var insert = BooleanOperationsUtils
.ExecuteBooleanOperation(wallSolid, solid, BooleanOperationsType.Intersect);
  1. Because the Solid cannot be specified to be created as a solid in the family (if there is a way, please tell me), because the cutting beam is relatively regular, we can just get the top and bottom surfaces to make a void extrusion. But my project may be relatively simple, and the structural beam will not have other shapes. If we want to get the openings of pipes and wall beams, we need to get two sides to make an extrusion at this time.

For convenience, we can directly use a window family to facilitate later statistical calculations, but the window family cannot cover oblique extrusions and arc intersections, so temporarily abandon the window family and use a unified void extrusion for cutting.

Create void extrusion, bool value represents whether it is solid or void.

1
2
3
var z =Math.Abs( face1.Evaluate(new UV(0, 0)).Z - face2.Evaluate(new UV(0, 0)).Z);
// Create void model
var extrusion = rfaDoc.FamilyCreate.NewExtrusion(false, arrA, SketchPlane.Create(rfaDoc, array0[0].GetPlane()), z);

Modify Family Parameter Cut with Voids when Loaded

Parameter Location

![Image Description](https://cdn.bimath.com/blog/pg/6c2fd6efceefac462896b1f4e1407694.png)

Here we need to take a look at the content represented by each data in the family.

  1. Family Type [Family Symbol]
    Can be created using the following command. After creating, we can add a parameter such as material inside.
1
rfaDoc.FamilyManager.NewType("111")

If we want to connect the dimension made in the family to this, we can use

1
2
3
AssociateElementParameterToFamilyParameter(
Autodesk.Revit.DB.Parameter elementParameter,
FamilyParameter familyParameter)

Connect to family parameters so that parameters can be modified in the project file.
2. Family Parameters
The family parameters here refer to some family parameters of the Family Type above, but we cannot get the parameters we want to modify.

![Image Description](https://cdn.bimath.com/blog/pg/Snipaste_2026-01-04_16-58-25.png)
  1. Owner Family
    This is our target value, representing the value of this part in Revit.
![Image Description](https://cdn.bimath.com/blog/pg/Snipaste_2026-01-04_16-58-29.png)

When we open it, we will find that there are basic categories of the family and property values seen in the family property interface, so we need to take this part for modification. Here the boolean parameter cannot be modified by AsValueString, just assign 1/0 directly.

1
2
var para = rfaDoc.OwnerFamily.get_Parameter(BuiltInParameter.FAMILY_ALLOW_CUT_WITH_VOIDS);
para.Set(1);

In this way, our family operation is completed. Next, load the family into the project to complete the creation of the void family.

1
var family = rfaDoc.LoadFamily(doc);

Execute Cut Operation

The cut command and join command in Revit are

![Image Description](https://cdn.bimath.com/blog/pg/Snipaste_2026-01-04_16-58-32.png)

Cut

1
InstanceVoidCutUtils

Join

1
JoinGeometryUtils

If traversing the entire project, walls that do not intersect will report an error if directly clicked to cut, so such walls need to be filtered. The code can be modified according to actual operations here.

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using (Transaction trans = new Transaction(doc, "Modify"))
{
trans.Start();
BiMassUntil.Until.TaskDialog(walls.Count.ToString());
foreach (var wall in walls)
{
// BiMassUntil.Until.TaskDialog(can.ToString());
try
{
InstanceVoidCutUtils.AddInstanceVoidCut(doc, wall, instance);
}
catch (InvalidOperationException e)
{
Console.WriteLine(e);
continue;
}

}

trans.Commit();
}