PanelScheduleViewCreateInstanceView(Document, ElementId) Method |
Creates a new instance of this view (using default template)
Namespace: Autodesk.Revit.DB.ElectricalAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic static PanelScheduleView CreateInstanceView(
Document ADoc,
ElementId panelId
)
Public Shared Function CreateInstanceView (
ADoc As Document,
panelId As ElementId
) As PanelScheduleView
public:
static PanelScheduleView^ CreateInstanceView(
Document^ ADoc,
ElementId^ panelId
)
static member CreateInstanceView :
ADoc : Document *
panelId : ElementId -> PanelScheduleView
Parameters
- ADoc Document
-
The Document
- panelId ElementId
-
Element id of the electrical panel element.
Return Value
PanelScheduleView
The PanelScheduleView
Exceptions
Example
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;
}
else
{
TaskDialog.Show("Revit", "Please select one electrical panel.");
}
}
}
Public Sub CreatePanelSchedule(uiDocument As UIDocument)
Dim doc As Document = uiDocument.Document
Dim selected As Reference = uiDocument.Selection.PickObject(ObjectType.Element, "Select an electrical panel")
Dim panel As Element = doc.GetElement(selected)
If panel IsNot Nothing Then
Dim psv As PanelScheduleView = Nothing
Using trans As New Transaction(doc, "Create a new panel schedule")
trans.Start()
psv = PanelScheduleView.CreateInstanceView(doc, panel.Id)
trans.Commit()
End Using
If psv IsNot Nothing Then
uiDocument.ActiveView = psv
Else
TaskDialog.Show("Revit", "Please select one electrical panel.")
End If
End If
End Sub
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also