PanelScheduleView.CreateInstanceView(Document, ElementId)
Method
Description:
Creates a new instance of this view (using default template)
Creates a new instance of this view (using default template)
Examples
// Create a new panel schedule and switch to that view
public void CreatePanelSchedule(UIDocument uiDocument)
{
Document doc = uiDocument.Document;
Reference selected = uiDocument.Selection.PickObject(ObjectType.Element, "Select an electrical panel");
Element panel = doc.GetElement(selected);
if (null != panel)
{
PanelScheduleView psv = null;
using (Transaction trans = new Transaction(doc, "Create a new panel schedule"))
{
trans.Start();
psv = PanelScheduleView.CreateInstanceView(doc, panel.Id);
trans.Commit();
}
if (null != psv)
{
uiDocument.ActiveView = psv; // make new view the active view
}
else
{
TaskDialog.Show("Revit", "Please select one electrical panel.");
}
}
}
Parameters
Parameter | Type | Description |
---|---|---|
ADoc | Document | The Document |
panelId | ElementId | Element id of the electrical panel element. |
Return Value
Type | Description |
---|---|
PanelScheduleView | The PanelScheduleView |
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | A non-optional argument was null |