Creating a Schedule for Panel Schedules

Creating a Schedule for Panel Schedules

glenn.john.sanford
Observer Observer
4,938 Views
12 Replies
Message 1 of 13

Creating a Schedule for Panel Schedules

glenn.john.sanford
Observer
Observer

I work with very large projects with hundreds of panels. I want to be able to create a schedule that will show the panel name and the drawing number where I drop my panel schedules on for easy reference.

0 Likes
4,939 Views
12 Replies
Replies (12)
Message 2 of 13

L.Maas
Mentor
Mentor

The only way I could think of is making use of Dynamo.

Possibly you can extract the sheet data with Dynamo and store that information in a new parameter. Then you could schedule it

Louis

EESignature

Please mention Revit version, especially when uploading Revit files.

0 Likes
Message 3 of 13

J.Wehmer
Collaborator
Collaborator

I just tried a few different Dynamo graphs, but it looks like the "Sheet Number" parameter is not exposed in the API for PanelSchedules. It looks like anything pertaining to the PanelSchedule-Sheet interaction is not available through dynamo.

 

 


-Please click accept as solution if this answers your question!
0 Likes
Message 4 of 13

stever66
Advisor
Advisor

I thought it might be an easy macro to write, but when I googled it, someone else has already did most of the work:

 

http://bimextension.com/revit-macro-scheduling-electrical-panel-schedules/

 

With a few slight modifications, I got a dialog box that listed all the panel schedules, and the sheets they were on.  And following the instructions, I could just hit copy (cntrl-C) while the box was showing, and paste all the text into excel.

 

With a little more effort, I think someone could get this to spit out a schedule directly.

 

Anyway, here is the code I used (I had to change the first few lines).  Just follow the instructions for making a macro (make it an "Application Macro".) and paste the text below as noted:

 

             //UIApplication uiApp = this.Application;      
             //Application app = uiApp.Application;  
             //UIDocument uiDoc = uiApp.ActiveUIDocument;   
             //Document Doc = uiDoc.Document;  
             
            UIDocument uiDoc = this.ActiveUIDocument;  
            Document Doc = this.ActiveUIDocument.Document;
               
             StringBuilder sb = new StringBuilder();   
               
             ElementCategoryFilter sheetcf = new ElementCategoryFilter(BuiltInCategory.OST_Sheets);  
             FilteredElementCollector sheetCollector = new FilteredElementCollector(Doc);   
             IList<Element> sheetlist = sheetCollector.WherePasses(sheetcf).WhereElementIsNotElementType().ToElements();   
           
             foreach(Element sheet in sheetlist) {   
                 ElementCategoryFilter panelcf = new ElementCategoryFilter(BuiltInCategory.OST_PanelScheduleGraphics);   
                 FilteredElementCollector panelCollector = new FilteredElementCollector(Doc, sheet.Id);   
                 IList<Element> panellist = panelCollector.WherePasses(panelcf).WhereElementIsNotElementType().ToElements();   
                 foreach(Element panel in panellist) {   
                     sb.AppendLine(panel.Name+" \t"+sheet.get_Parameter(BuiltInParameter.SHEET_NUMBER).AsString());   
                 }   
            }             
             TaskDialog.Show("Revit", sb.ToString()); 

 

0 Likes
Message 5 of 13

stever66
Advisor
Advisor

Make sure you save before you run it.  It took a little time on my project that only had about 25 sheets.  (Maybe 45 seconds?)

If you have trouble getting it to build, make sure you add the "using" statement as described.  And all the braces {} should occur in pairs (an opening brace, some code, and a closing brace).  Get an extra one somewhere, or if you are missing one, it won't build.

 

0 Likes
Message 6 of 13

jabrittain
Community Visitor
Community Visitor

I have been trying to figure out an easy way to do this for some time now, and I just figured out a way to schedule what sheets schedules are on.  I am working on a small project, 30 schedules across 5 sheets and it took less than 5 minutes to schedule them all, but the time is in getting them set up, as quick as you can open and close a schedule is how long it takes to schedule each one. It looks like a lot of steps but it is very easy, and it is the most elegant way I have found to create a Schedule of Schedules while still using only Revit.

1) Identify an unused text parameter in your panel.  I used "comments" but it can be any parameter that allows you to type text.

2) go to Manage>panel schedule templates>edit template and choose whatever template you are using.

3) In any available location, add the text parameter from step one.  It doesn't matter where or what it looks like because we will get rid of it later. Save your template.

4) go to Manage>panel schedule templates>manage templates>apply templates and update your templates.

5) Create a new Electrical Equipment schedule with two columns: Panel Name and the text parameter you chose from step one. You may have to apply a filter depending on how you name electrical equipment. What I did was put a filter on the text column that does not show if Comments = "none".  so basically after I scheduled my schedules, I just typed none in the empty columns to remove them.  There's a bunch of different ways you could filter that will be easier based on your naming conventions, so just go with what's easier.

6) Now, got to your first sheet that has schedules and click into one to edit it.

7) Where ever you placed your new text parameter from step 3, type the sheet number. I suggest for the first schedule on each sheet, that you copy the sheet number, that way on each new schedule on that sheet, you can open, ctrl+v, and close.

😎 Do this for all schedules and sheets.

9) Now that all the schedules are scheduled, repeat step 3, except delete the parameter you added.

10) repeat step 4.

11) Since you were editing parameters within the Panel family, you should be left with a neat, semi-smart panel schedule.

 

 

0 Likes
Message 7 of 13

balddude
Enthusiast
Enthusiast

stever66,

 

Could you post a screen shot of what the macro looks like in the editor? When I copy and paste your text, I get a bunch of error messages when I try to build it.

 

jabrittain, your way works, but if it isn't automated. It seems like it would take a while to manually add the sheet number to each panelboard.

 

Thanks.

0 Likes
Message 8 of 13

stever66
Advisor
Advisor

It looks like the link with all the details is dead, and it doesn't look like I posted all the code since it was in the link.

 

Try making a new C# application Module, called "PanelSchedules" (that has to match the namespace label in the code.)  Delete all the code in the editor window, and copy and paste this in:

 

 

/*
 * Created by SharpDevelop.
 * User: me
 * Date: 7/27/2018
 * Time: 4:34 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PanelSchedules
{
    [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
    [Autodesk.Revit.DB.Macros.AddInId("07CED510-90F8-4823-AE69-59FE326EE7C7")]
	public partial class ThisApplication
	{
		private void Module_Startup(object sender, EventArgs e)
		{

		}

		private void Module_Shutdown(object sender, EventArgs e)
		{

		}

		#region Revit Macros generated code
		private void InternalStartup()
		{
			this.Startup += new System.EventHandler(Module_Startup);
			this.Shutdown += new System.EventHandler(Module_Shutdown);
		}
		#endregion
		public void CreatePanelSchedule()
			
			
		{        
            UIDocument uiDoc = this.ActiveUIDocument;  
            Document Doc = this.ActiveUIDocument.Document;
               
             StringBuilder sb = new StringBuilder();   
               
             ElementCategoryFilter sheetcf = new ElementCategoryFilter(BuiltInCategory.OST_Sheets);  
             FilteredElementCollector sheetCollector = new FilteredElementCollector(Doc);   
             IList<Element> sheetlist = sheetCollector.WherePasses(sheetcf).WhereElementIsNotElementType().ToElements();   
           
             foreach(Element sheet in sheetlist) {   
                 ElementCategoryFilter panelcf = new ElementCategoryFilter(BuiltInCategory.OST_PanelScheduleGraphics);   
                 FilteredElementCollector panelCollector = new FilteredElementCollector(Doc, sheet.Id);   
                 IList<Element> panellist = panelCollector.WherePasses(panelcf).WhereElementIsNotElementType().ToElements();   
                 foreach(Element panel in panellist) {   
                     sb.AppendLine(panel.Name+" \t"+sheet.get_Parameter(BuiltInParameter.SHEET_NUMBER).AsString());   
                 }   
            }             
             TaskDialog.Show("Revit", sb.ToString());     
		}
		
		
	}
}

 

 

Then try building it.  It should create a macro called CreatePanelSchedule, and you shouldn't get any errors.

 

Save your project before running the macro.  Mine took about 30 seconds even where there were only 3 schedules in the project.

 

It pops up a dialog box, and Control-C will copy the contents that you can paste to excel.

0 Likes
Message 9 of 13

balddude
Enthusiast
Enthusiast

One small edit to the code, and it worked!

 

At this line -  namespace PanelSchedule - I had to change it to "namespace CreatePanelSchedule". After that it works!

 

Thanks for the help.

0 Likes
Message 10 of 13

stever66
Advisor
Advisor

Glad it worked!

 

Like I mentioned, whatever you name the module when you create it has to match what is on the “namespace” line, so you must of named your module, so you must have named your module “CreatePanelSchedule”.

0 Likes
Message 11 of 13

Anonymous
Not applicable

Thank you very much for sharing your code. It seems that it does not work for me. Please, see the error messages I got after hitting "Build". I am very new to C# and still in the process of getting families with its syntax. I did make sure that I named the module under the same name as the workspace in the script, as you indicated.  Could you tell what I am doing wrong, based on these error messages? 


Thank you in advance!

0 Likes
Message 12 of 13

stever66
Advisor
Advisor

There are both application macros, and document macros.   They are shown on different tabs in the window where you create a new macro.   The code I posted only works in an application level macro.   From all the errors, I’m guessing you created a document level macro.  Try making another new macro, and making sure it’s an application level macro.

Message 13 of 13

Anonymous
Not applicable

That is exactly right! Thank you for explaining me the different between application macros and document macros.

 

After changing the tab to the application level, it worked for me, as well!

0 Likes