Hooks for action on family placement

Is there any way to create a hook that reacts to a specific family type being placed? I would like to trigger a dialog box upon creation of a new level in the model, but am not seeing any way to do this with command-exec.

to trigger on level creation, try to put these in your hooks folder and reload:

  1. command-exec[ID_OBJECTS_LEVEL].py file:
# pylint: skip-file
import os.path as op
from pyrevit import EXEC_PARAMS
from pyrevit import script

args = EXEC_PARAMS.event_args

output = script.get_output()
output.print_image(
    op.join(op.dirname(__file__), op.basename(__file__).replace('.py', '.gif'))
)

# do stuff
  1. the gif command-exec[ID_OBJECTS_LEVEL].gif
    command-execID_OBJECTS_LEVEL

ha ha. very funny - but really, can you please help me find the right direction to look in? I’ve never worked with hooks before and am a little lost coming from Dynamo world. I don’t want to override the default behavior of the place level command ID, only use it’s execution to trigger a GUI window with a few options on what to do next. I see there is a before-exec, but not a post-exec hook listed in the hooks page on Notion.

can you expand on what you are trying to achieve?
in pseudo code maybe?

Sure - I haven’t actually coded any of this yet, but I would like for a GUI window to pop up after a new level is added to the model. GUI would have a selection box of options on which plan view types to create on the new level - floor plan, reflected ceiling plan, demo plan, etc. GUI box is easy, and I’m familiar enough with view creation in Python to handle that bit - it’s just the actual event trigger I am lost on. Something like this (definitely pseudo-code):

# On event hook for level created...
if level_created:
    # Options GUI
    items = ['Floor Plan', 'Demo Plan', 'RCP']
    selected_options = forms.SelectFromList.show(items, button_name='Select View Types')
    if selected_options:
        #Create views, apply view templates, etc.