Application: PanelEdgeLengthAngle
Revit Platform: All
Revit Version: 2011.0
First Released For: 2010.0
Programming Language: C#
Skill Level: Beginning
Category: Geometry
Type: ExternalCommand

Subject: Divided surface panel measurement 

Summary: 
Measure the edge length and angle of curtain panels in divided surfaces. Save the length and angle data to the instance parameters of curtain panels.

Classes: 
	Autodesk.Revit.UI.IExternalCommand
	Autodesk.Revit.DB.DividedSurface
	Autodesk.Revit.DB.Panel

Project Files:

Command.cs
	This file contains the SetLengthAngleParams class and is invoked when the external command. This class is used to compute the length and angle data and update the parameters.

Description: 
1.	Find divided surfaces in the massing family
2.	Find all panels in the DividedSurface elements. The panels are FamilyInstance elements returned by the DividedSurface.GetTileFamilyInstance(GridNode, tileIndex) method.
3.	Check the parameters of each panel, make sure the “Length1” to “Length4” and “Angle1” to “Angle4” parameters exist
4.	Get the edges of each panel using FamilyInstance.get_Geometry(opt)
a.	For partial border panels, get_Geometry returns the panel geometry in a Solid object
b.	For uncut panels, their geometry is found through Instance.SymbolGeometry.Objects
5.	Compute the length of each edge and the angle between 2 edges, store the data to the length and angle parameters.

Instructions: 
1.	Open a curtain panel by pattern family from the Data folder, for example, “Rectangle Surface.rfa” (at .\ Data\Platform\Imperial\Library\Architectural\Curtain Panel By Pattern\Rectangle Surface.rfa)
2.	Add 8 instance parameters: “Length1” to “Length4” with the type of Length, and “Angle1” to “Angle4” with the type of Angle
3.	Create one or more massing forms with divided surfaces, load the panel family into this massing family, and apply “Rectangle Surface” pattern to the divided surfaces
4.	Run this command
5.	The length and angle values are computed and set to the “Length1” to “Length4” and “Angle1” to “Angle4” parameters