Application: PanelSchedule
Revit Platform: MEP
Revit Version: 2011.0
First Released For: 2011.0
Programming Language: C#
Skill Level: Beginning
Category: Data Exchange
Type: ExternalCommand

Subject: Show how the Panel Schedule API works.
Summary: 
This sample contains 3 external commands to show how to use the Panel Schedule API:
1.	PanelScheduleExport - gets the panel schedule view data via the API and generates a CSV file or a HTML page for it.
2.	InstanceViewCreation - Create a panel schedule view instance for an electrical panel you selected.
3.	SheetImport - Place the panel schedule view(s) on a sheet view.

Classes: 
Autodesk.Revit.DB.Electrical.PanelScheduleView
Autodesk.Revit.DB.Electrical.PanelScheduleSheetInstance
Autodesk.Revit.DB.SectionType
Autodesk.Revit.DB.TableSectionData

Project Files:                                
CSVTranslator.cs
It contains the class CSVTranslator which is responsible for translating the panel schedule view data from Revit to .CSV format.
HTMLTranslator.cs
It contains the class HTMLTranslator which is responsible for translating the panel schedule view data from Revit to HTML table.
InstanceViewCreation.cs
It contains the class InstanceViewCreation to show how to create a panel schedule for an electrical panel by using the PanelSceduleView.CreateInstanceView API
SheetImport.cs
It contains the class SheetImport to show how to place the panel schedule view(s) (using a PanelScheduleSheetInstance) on a sheet view.

Description: 
Functionalities:
-	Export Revit panel schedule view(s) to HTML page(s).
-	Create a panel schedule view for an electrical panel you selected.
-	Place the panel schedule view(s) on a sheet view.

Implements:
Command PanelScheduleExport:
-	Get all PanelScheduleView instances by ElementClassFilter.
-	Ignore the PanelScheduleView instance which is a template.
-	Get all the table cells by API PanelScheduleView.GetCellText(sectionType, ii, jj);
-	Export the table to a 'table' node in HTML or comma delimited.
Command InstanceViewCreation:
-	Get one electrical panel by Selection.PickObject(ObjectType.Element).
-	Create instance view by PanelScheduleView.CreateInstanceView(doc, selectedPanel.Element.Id).

Command SheetImport:
-	Get one sheet view by doc.ActiveView.
-	Place the panel schedule view on the sheet view by PanelScheduleSheetInstance.Create(doc, psView.Id, sheet).

Instructions: 
Command PanelScheduleExport:
1.	Run Revit MEP 2011.
2.	Make sure the ‘template.html’ file is in the same folder as the external command assembly.
3.	Run this external command.
4.	It generates one CSV file or HTML page for each panel schedule view instance in the Revit document.

Command InstanceViewCreation:
1.	Run Revit MEP 2011.
2.	Switch to a view containing an electrical Panel. 
3.	Run this external command.
4.	Select one electrical panel.
5.	It creates an instance view for the electrical panel you selected.

Command SheetImport:
1.	Run Revit MEP 2011.
2.	Create or open one Sheet view.
3.	Run this external command.
4.	It places the panel schedule view(s) on the sheet view.