Application: RotateFramingObjects
Revit Platform: Structure
Revit Version: 2011.0
First Released For: 9.0
Programming Language: C#
Skill Level: Medium
Category: Basics, Structure
Type: ExternalCommand

Subject: Rotate framing objects.
Summary: 
 Demonstrates how to rotate beams, braces or structural columns around their directional axis rather than project axis.

Classes: 
Autodesk.Revit.DB.Element 
Autodesk.Revit.DB.Parameter
Autodesk.Revit.DB.FamilyInstance
Autodesk.Revit.Structural.Enums.StructuralType
Autodesk.Revit.Creation.Application

Project Files: 
RotateFramingObjects.cs
This file contains the class RotateFramingObjects that inherits from IExternalCommand. Its function is to rotate the selected instances.

RotateFramingObjectsForm.cs
This file contains the Form class that can get the angle that the instances will be rotated by or to determined by checking “Relative” or “Absolute”. And if only one instance is selected, the angle input text box will show its current angle, otherwise be blank.

Description: 
-	To rotate an instance of beam or brace, use Parameter.Set(double angle), the parameter should be in the collection of parameters of the beam or brace and its definition name is “Angle”.
-	To rotate an instance of column, use FamilyInstance.Location.Rotate(Line axis, double angle). the axis of column can be determined by its location and a vertical vector.
-	To create a new line, use Autodesk.Revit.Creation.Application.NewLineUnbound(XYZ point, XYZ direction)

Instructions: 
1.	Prepare your Revit project. Make sure there are some structural beams, braces or columns in current document. A sample project file RotateFramingObjects.rvt is available in the sample’s folder.
2.	Select one or some structural beams, braces or columns.
3.	Select radio buttons to decide we take either “relative” or “absolute” rotation.
4.	Input the value of angle that instances are rotated by/to.
5.	Click OK button to rotate the instances.