Application: SlabShapeEditing
Revit Platform: Architecture, Structure
Revit Version: 2009.0
First Released For: 2009.0
Last Modified: 02/26/2008
Modified By: KY Autodesk
Programming Language: C#
Skill Level: Medium
Category: Create
Type: ExternalCommand

Subject: Create SlabShapeVertex and SlabShapeCrease.
Summary: 
This sample demonstrates how to create SlabShapeVertex and SlabShapeCrease, and then use them to edit slab’s shape.

Classes: 
Autodesk.Revit.Editor.SlabShapeEditor
Autodesk.Revit.Editor.SlabShapeCrease
Autodesk.Revit.Editor.SlabShapeCreaseArray
Autodesk.Revit.Editor.SlabShapeCreaseArrayIterator
Autodesk.Revit.Editor.SlabShapeVertex
Autodesk.Revit.Geometry.Line
Autodesk.Revit.Geometry.Edge
Autodesk.Revit.Geometry.CurveArray
Autodesk.Revit.Geometry.GeometryObject

Project Files: 
Command.cs
This file contains a class Command that implements the IExternalCommand interface, get selected slab, creates SlabShapeEditingForm and gets ExternalCommandData.

SlabShapeEditingForm.cs
This file contains a class SlabShapeEditingForm which inherits from Form. This Form has a PictureBox show the geometry info of Slab and some button used to create vertex and crease. 

SlabProfile.cs
This file contains a class SlabProfile which calculates the geometry info of Slab. SlabProfile consists of methods Draw2D(), AddVertex() and AddCrease(). Draw2D() is used to draw Slab curves on the picture box, and AddVertex() and AddCrease() are used to create vertex and crease on slab.

LineTool.cs
This file contains a class named LineTool which provides some methods to draw lines on the form and store the data of drawn lines. It also provide method to draw new created vertex as rectangle

MathTools.cs
This file contains Verctor4 and Matrix4 two classes. These two classes are used to transform points between 3D and 2D.

Description: 
This sample shows user how to:
1.	Create SlabShapeVertex by 
SlabShapeEditor.DrawPoint(Autodesk.Revit.Geometry.XYZ location) method.
2.	Create SlabShapeCrease by
SlabShapeEditor.DrawSplitLine(SlabShapeVertex startVertex, SlabShapeVertex endVertex) method. A crease is consisted by two vertices.
3.	Move new created vertex by
 SlabShapeEditor.ModifySubElement(SlabShapeVertex pVertex, double offset)
4.	Move new created crease by
SlabShapeEditor.ModifySubElement(SlabShapeCrease pCrease, double offset), offset use to set position of midpoint on crease.

Instructions: 
1.	Draw a slab in Revit or open the SlabShapeEditing.rvt, and then select the slab.
2.	Run this command.
3.	Click “create vertex”  button and click mouse in picture box to create a vertex on slab.
4.	Click “create crease”  button and click mouse in picture box to create a crease on slab.
5.	Click “select”  button, then move mouse and click in picture box to select new created vertex or crease, when new vertex or crease turn red, it means you have selected it successfully.
6.	Then input the distance user want to move in the textbox (just input number, unit is feet), click “Update” button.
7.	Click “Reset” button to restore the original shape of slab.
8.	If user wants to observe slab in different direction, just click right mouse button down and move mouse in picture box.