Group Column Headings in a Schedule

I’v created a schedule and formatted its components by using Rhythm package
I’m not a python expert but i’v searched about any node that can grouping schedule columns headers like image below


but no result :worried: :worried:
-I’ve searched in API 2018 and found a method for doing that which is

Autodesk.Revit.DB.ViewSchedule.GroupHeaders(Int32, Int32, Int32, Int32) : Void

I also knew that to apply this action, the schedule view should be the active view before applying the script
Also i’ve read this article from Building Coder

https://thebuildingcoder.typepad.com/blog/2013/04/grouping-schedule-headers-and-how-to-do-something.html

Is there a python script can be made for that ?
Thanks in advance.

You’ll actually want this method:
https://www.revitapidocs.com/2017.1/62a4bc0e-5226-eaed-2881-0bc0a8f259d6.htm

The examples are in C# and VB but they’re pretty close to the Python equivalent. Take a look at some other Python codes on the forum, preferably dealing with schedules, and see what you can put together.

2 Likes

Thanks alot @Nick_Boyts but i’m not a python expert so i cant do anything unfortunately :slight_smile:

That’s why I’m suggesting you go through the forums and see what other people have done. A lot of what you need can be copy/pasted from other python scripts. Just make an attempt. Python is actually pretty easy to learn compared to other languages and can be very rewarding.

2 Likes

it takes too much to learn programming foundations and i have not this margin of time
Thanks a lot dear

Reanimating this thread from 4 years ago, as i was stuck on the same exact topic last night. Reading the posts above to get to the APIDocs was helpful (thank you!), but converting that to Python (or even knowing where to start), was way above my current knowledge base.

It took a combination of Chat GPT, experimenting on my own reviewing other graphs ive made for similar tasks, getting ALMOST there, and then asking on Twitter (thanks @SeanP and @jacob.small ) for fixing the last couple of issues.

In a perfect world, id have liked the Column Indices (2 and 3 in this case) to be inputs… But i had/have no idea how to even modify it to make that happen.

Note that because i was getting helped by GPT, there is probably a bunch of un-needed and stupid stuff, in this graph. But it DOES work. One day if someone else is searching for this solution, maybe they can devote the time to make the additional inputs, and clean up the rest of it. But for anyone else doing the Goog for Grouping Column Headers, this will get you there (even if its ugly).

5 Likes

The Python isn’t actually too bad for being chatGPT initialized, nice one!

You might find it helpful to set the except branch to pass instead of rollback, that way it executes as much as it can versus rolling it all back if any fail.

Personal taste though, some users like to see a report and run what works, others like to cancel it, fix the error then rerun over all.

1 Like

Honestly, if i knew how to cleanly edit it, id probably take the entire Try/Except out. I dont want the node to look like it “succeeded” if it didnt. I want it to look like a bomb went off, so i can hit Edit Undo faster than a jackrabbit. LOL

1 Like

:exploding_head:

3 Likes