Show and Tell. What cool stuff are you working on?

Thought it would be fun to see what others are working on. Any cool tools? Useful utilities you want to share? Good tips and tricks you discovered/solved working in python and the Revit API?

1 Like

Most used scripts:
Mass Room Tags - Tags all rooms from architectural link in all views
Schedule Resizer - Resizes schedule column widths to the max characters so that text does not wrap except where you put in a dedicated line return.

Most recent scripts:
Place AV Speakers on a Line - Select points in a plan view, script will build a line/curves/spline (based on your selection) and place speakers along it at a specified spacing.
Check Electrical Oneline - We place Detail items with parameters for our onelines, this script will backcheck that for each detail item we have a 3D element and the relevant parameters are the same.

3 Likes

I can’t post the actual code, but I’ll post the synopsis for how the mass room tags works. @Dartanyon
Selections:
Linked document to tag
What room tag type to use
Maximum scale factor of view to tag
Keeping existing room tags / delete existing room tags
Select phase to tag (if multiple phases)

Deletes unhosted/broken room tags where:
int(str(roomtag.TaggedRoomId.LinkedElementId)) == -1
Moves tags to rooms where:
if not r.IsInRoom:

For each level in the active project:
Create new floor plan view
Ensure link is visible in ‘new view’
Tag all linked rooms in ‘new view’
Grab room tags visible in ‘new view’
For each view in the project that is associated to the same level:
Gather all room tags visible in ‘project view’
Compare against list from ‘new view’ and create any missing tags (you could probably also copy view to view here, but that’s not how I wrote it).

1 Like

Hey Martin,

Totally understand, thanks so much for sharing this! Broken tags are specifically a mega nuisance, I may try to make a tool to target those specifically. Interesting logic, really appreciate the insight. I’ll give it a shot and let you know how it goes!

Cheers,

Hi, @martin.servold.

No pressure, but is there any chance you could post your script “Check Electrical Oneline”? We, too, use Detail Item families for our electrical schematic design drawings and having something like what you mentioned would be super helpful.

Again, no pressure :+1:

On our end, the most exciting pyRevit stuff we’ve worked on is a tab full of our electrical oneline symbols - each icon custom designed in Photoshop, with a button script that will pull in the symbol (Detail Item family) and get the user ready to place anywhere :blush:

We have a set of Dynamo scripts for building programing. But they were created by different users and some are a few years old and use custom nodes that are a hassle to make sure everyone has the same packages/versions. So my approach is
Step 1: get them mapped to a Custom Tab (working on that today)
Step 2: rewrite/recreate them as python scripts (which will actually be Many, Many steps :stuck_out_tongue: )

" Tag all linked rooms in ‘new view’" ----> Can you please post a snippet of how to select all linked rooms in new view please?

I just grab every room in the linked document in question and tag each and every one of them in the ‘new’ view.
The phase settings of the ‘new’ view takes care of filtering which ones are visible.
So, for each phase selected there is a separate ‘new’ view that shows the respective phase.

linkRooms = DB.FilteredElementCollector(linkdoc)\
    .OfCategory(DB.BuiltInCategory.OST_Rooms)\
    .WhereElementIsNotElementType()\
    .ToElements()

currentTags2 = DB.FilteredElementCollector(doc, tempView.Id)\
    .OfCategory(DB.BuiltInCategory.OST_RoomTags)\
    .WhereElementIsNotElementType()\
    .ToElements()
1 Like