Application: FoundationSlab
Revit Platform: All
Revit Version: 2011.0
First Released For: 9.1
Programming Language: C#
Skill Level: Medium
Category: Elements
Type: ExternalCommand

Subject: Create Foundation Slab.
Summary: 
This sample demonstrates how to create Foundation Slab.

Classes: 
Autodesk.Revit.UI.IExternalCommand 
Autodesk.Revit.DB.Floor
Autodesk.Revit.DB.FloorType
Autodesk.Revit.DB.Document 

Project Files: 
Command.cs
This file contains the class Command which implements interface IExternalCommand. It creates an instance of SlabData for FoundationSlabForm and show the form.

RegularSlab.cs
This file contains a class of regular slab. Create an octagonal profile for the floor according to its bounding box

FoundationSlabForm.cs
This file contains a class to show properties and profiles of the foundation slabs.

SlabData.cs
This file contains a class SlabData that is a mediator between RevitAPI and FoundationSlabForm. It has a collection of functions to create FoundationSlabs, find out all regular horizontal slabs, get the floor profile, verify whether the floor is planar etc.

Sketch.cs
This file contains an internal class for drawing slabs' profiles.

Description: 
-	To get slabs, iterate through the document looking for ‘Floor’ objects.
-	The Mark property can be found in floor parameter: BuiltInParameter.ALL_MODEL_MARK.
-	Foundation slab types can be found by iterating through the document looking for ‘FloorType’ objects with category named ‘Structural Foundations’.
-	A Foundation Slab can be created by ‘NewFloor’ method with the given horizontal profile and using a specified foundation slab style. 
-	Structural slab's profile can be found in its AnalyticalModel property. Nonstructural floor's profile can be formed through its Geometry property.
-	The octagonal profile is an array of planar lines that represent the horizontal profile of the octagonal foundation slab.
-	Make sure the profile of slab is a closed outline, or else it could not be created by Revit.

Instructions: 
1.	Prepare your Revit project.
Open or new a Revit project and make sure there are some floors in the document. A sample project file FoundationSlab.rvt is available in the sample’s folder.
2.	Run the command.
3.	In the Regular Slabs group, select the floors you want to make change.
4.	In the bottom of the dialog, select the Foundation Slab Type to be applied.
5.	You can see the preview of the converting results in the Picture Box. Click OK button to create octagonal slabs for the selected floors.