Hook for pre create similar or create an element

We often have to work in multiple disciplines inside of one model and often forget to change our worksets.

Having a hook script for right after “create similar or create instance” but before picking a host or whatever, have a script that can run and check the category, workset, current view, whatever we want and possibly stop the current action and prompt the user that they were about to make a mistake.

Looking at the revit API maybe the only way to do this is via the DocumentChanged event, but that would only trigger after the transaction has completed?

Was curious if anyone else had tried to accomplish something like this.

Hi Patrick,

One of these hooks should help, right?


More info: Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.

1 Like

Hmmm… I figured that would only work when an add-in is executed not a normal revit function, but you may be right…

@patrickmRN , did you ever get a solution for this? I was thinking of something similar to this concept but instead of prompting after each command, I was hoping to have a prompt to specify workset whenever opening any workshared model.