Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to read all data intelligently from a Panel Schedule

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
1319 Views, 2 Replies

How to read all data intelligently from a Panel Schedule

Anonymous
Not applicable

Recently we have come across a problem in the workflow, our engineers need a slightly complicated design of columns and rows in the panel schedule template. We decided to export all the data generated by previous schedule template into an excel sheet, this excel sheet will have that complicated design of rows and columns. 

 

However, I'm not able to read table data of the panel schedule intelligently. Is there any workaround that API provides?

panel schedule data.PNG

I've checked Revit Lookup, but it doesn't show the values shows in the table data of the panel schedule. 

Would appreciate any help. Thank you

 

0 Likes

How to read all data intelligently from a Panel Schedule

Recently we have come across a problem in the workflow, our engineers need a slightly complicated design of columns and rows in the panel schedule template. We decided to export all the data generated by previous schedule template into an excel sheet, this excel sheet will have that complicated design of rows and columns. 

 

However, I'm not able to read table data of the panel schedule intelligently. Is there any workaround that API provides?

panel schedule data.PNG

I've checked Revit Lookup, but it doesn't show the values shows in the table data of the panel schedule. 

Would appreciate any help. Thank you

 

2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
Accepted solution

Hi 

There is a sample for the panel schedule export in Revit SDK , you have to have basic knowledge of the API to understand it 

but in short, you will have to

 

1 - filter for panel schedule views 

 

ElementClassFilter PanelScheduleViewsAreWanted = new ElementClassFilter(typeof(PanelScheduleView));

 

2 - store them in a list 

 

 List<Element> psViews = fec.ToElements() as List<Element>;

 

3 - pas each panel schedule view to a custom function that creates the excel file and fills it with panel schedule data 

 

new CSVTranslator(psView) as Translator

 

4 - then customize this function to your needs 

private void DumpSectionData(StreamWriter sw, PanelScheduleView psView, SectionType sectionType)
{
int nRows_Section = 0;
int nCols_Section = 0;
getNumberOfRowsAndColumns(m_psView.Document, m_psView, sectionType, ref nRows_Section, ref nCols_Section);

for (int ii = 0; ii < nRows_Section; ++ii)
{
StringBuilder oneRow = new StringBuilder();
for (int jj = 0; jj < nCols_Section; ++jj)
{
try
{
oneRow.AppendFormat("{0},", m_psView.GetCellText(sectionType, ii, jj));
}
catch (Exception)
{
// do nothing.
}
}

sw.WriteLine(oneRow.ToString());
}
}

 

**A better approach is to extract the ElectricalSystemSet under the MepModel for each panel and extract circuits data circuit by circuit then create a separate class for excel creation and any advanced presentation you want

hope that helps 

 

SDK Panel schedule sample.JPG

 

 

Regards,

 

Ahmed Attia

Senior Electrical Engineer - BIM Specialist , LEED GA , P.E.

Facebook Twitter | LinkedIn

 

Hi 

There is a sample for the panel schedule export in Revit SDK , you have to have basic knowledge of the API to understand it 

but in short, you will have to

 

1 - filter for panel schedule views 

 

ElementClassFilter PanelScheduleViewsAreWanted = new ElementClassFilter(typeof(PanelScheduleView));

 

2 - store them in a list 

 

 List<Element> psViews = fec.ToElements() as List<Element>;

 

3 - pas each panel schedule view to a custom function that creates the excel file and fills it with panel schedule data 

 

new CSVTranslator(psView) as Translator

 

4 - then customize this function to your needs 

private void DumpSectionData(StreamWriter sw, PanelScheduleView psView, SectionType sectionType)
{
int nRows_Section = 0;
int nCols_Section = 0;
getNumberOfRowsAndColumns(m_psView.Document, m_psView, sectionType, ref nRows_Section, ref nCols_Section);

for (int ii = 0; ii < nRows_Section; ++ii)
{
StringBuilder oneRow = new StringBuilder();
for (int jj = 0; jj < nCols_Section; ++jj)
{
try
{
oneRow.AppendFormat("{0},", m_psView.GetCellText(sectionType, ii, jj));
}
catch (Exception)
{
// do nothing.
}
}

sw.WriteLine(oneRow.ToString());
}
}

 

**A better approach is to extract the ElectricalSystemSet under the MepModel for each panel and extract circuits data circuit by circuit then create a separate class for excel creation and any advanced presentation you want

hope that helps 

 

SDK Panel schedule sample.JPG

 

 

Regards,

 

Ahmed Attia

Senior Electrical Engineer - BIM Specialist , LEED GA , P.E.

Facebook Twitter | LinkedIn

 

Message 3 of 3
Anonymous
in reply to: Anonymous

Anonymous
Not applicable

So there is no direct way to get the data from panel schedule, I guess we'll have to first export it into csv then extract the data. Thanks for the solution. Appreciate it 🙂

0 Likes

So there is no direct way to get the data from panel schedule, I guess we'll have to first export it into csv then extract the data. Thanks for the solution. Appreciate it 🙂

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report