Application: GeometryCreation_BooleanOperation
Revit Platform: All
Revit Version: 2012.0
First Released For: 2012.0
Programming Language: C#
Skill Level: Medium
Category: Geometry
Type: ExternalCommand

Subject: Geometry Creation & Geometric Boolean Operation
Summary: 
This sample is to demonstrate how to create the geometry solid using GeometryCreationUtils and operate the geometric boolean operation using BooleanOperationUtils. This project will create a constructive solid geometry - CSG tree (http://en.wikipedia.org/wiki/Constructive_solid_geometry, http://en.wikipedia.org/wiki/File:Csg_tree.png) and show it in a new view by AVF – Analysis Visualization Framework.

Classes:
Autodesk.Revit.UI.IExternalCommand
Autodesk.Revit.Document
Autodesk.Revit.Element
Autodesk.Revit.DB;
Autodesk.Revit.DB.Analysis;

Project Files: 
Command.cs
This file contains a class Command which implements IExternalCommand interface. The function of the class is to create two instances of GeometryCreation and AnalysisVisualizationFramework, prepare and create CSG tree.

GeometryCreation.cs
This file contains a class GeometryCreation which can create extrusion, revolved, swept, blend, sweptblend geometry solid and specific center based box, sphere, and cylinder.

BooleanOperation.cs
This file contains a class BooleanOperation which implements the geometric boolean operation – Intersect, Union, Difference between two given solids.

AnalysisVisualizationFramework.cs
This file contains a class AnalysisVisualizationFramework which displays the solids in a new named view.

Description: 
The sample implements IExternalCommand interface, it creates specific geometry solids and operates the geometric boolean operation to create a constructive solid geometry - CSG tree.
-	To create the specific geometry solids, use the method CreateCenterbasedBox, CreateCenterbasedSphere, and CreateCenterbasedCylinder of GeometryCreation.
-	To operate the geometric boolean operation to create CSG tree, use the method BooleanOperation_Intersect, BooleanOperation_Union, BooleanOperation_Union, and BooleanOperation_Difference of BooleanOperation.
-	To view new created solid, use the method PaintSolid of AnalysisVisualizationFramework.

Instructions: 
1.	Set up addin file and start revit to load this sample.
2.	Launch GeometryCreation_BooleanOperation via the external command menu.
3.	The sample will create CSG tree and display the result solid in the view named “CSG Tree”.