Gross Slab Boundary and the Temporary Transaction Trick

Last week I provided an updated version of the CmdSlabBoundary external command to determine a floor slab boundary.

Here is a follow-up to that issue:

Question: The solution provided to retrieve the slab boundary works fine for me if no openings are cut out.

I have a situation where my slabs are cut by openings, however, and I need to retrieve the original uncut gross slab boundary.

Here is an example with two slabs A and B and an opening cutting out part of both of them:

The solution provided retrieves the cut out net slab boundary:

How can I obtain the following original gross uncut slab boundary?

Answer: One way to obtain the unmodified geometry of the slab is to use the temporary transaction trick to temporarily eliminate all openings and other elements affecting its shape.

This technique was used to determine gross material quantities of floors, walls and roofs in the material quantities sample from Scott Conover's Autodesk University 2009 class on analysing building geometry, which was later add to the Revit SDK as the MaterialQuantities sample.

It shows how the transaction handling for the temporary operation can be simply and cleanly encapsulated.

It analyses the material quantities of walls, floors, and roofs, and outputs the result to Excel by implementing the following steps:

1. Collect all roof elements
2. Iterate through each material found in each roof element
3. Find the net volume and area of the material
4. Store the material quantities
5. Write the results to the output file
6. Find the gross material quantities
1. Start a new transaction
2. Delete the elements that cut the host (doors, windows, openings)
3. Find the volume and area for each material
4. Store the material quantities
5. Write the results to the output file
6. Rollback the transaction
7. Repeat the above steps for walls and floors
8. Open the output file in Microsoft Excel

To determine the boundary lines of the floor slab with all opening removed, you could proceed in the same fashion as described in step 6 for obtaining the gross material quantities.

Temporarily delete then openings in a separate transaction, retrieve the original slab geometry, and abort the transaction to restore the original state.

This technique is easy to implement. We reused this method for many different purposes a number of times, e.g.

Addendum: Arnošt Löbel pointed out that this will not always work. Some modifications require the transaction to be committed before they take full effect. The workaround for that is to enclose it within a transaction group and roll back the group at the end.

Apphack @ AU

Do you have an interesting AutoCAD app you would like to publish?

Will you attend Autodesk University 2012 and would you like to win an attractive prize?

If so, take a look at the APPHACK @ AU Hackathon:

The official rules list some great prizes. Unfortunately, they also restrict the participation to AutoCAD apps, so Revit add-ins are not permissible.

Kean Walmsley provides a a few more details.