Skip to content

Add TemporaryGraphics wrapper and developer example bundle#3440

Open
Wurschdhaud wants to merge 7 commits into
pyrevitlabs:developfrom
Wurschdhaud:new-tmpgfx
Open

Add TemporaryGraphics wrapper and developer example bundle#3440
Wurschdhaud wants to merge 7 commits into
pyrevitlabs:developfrom
Wurschdhaud:new-tmpgfx

Conversation

@Wurschdhaud

Copy link
Copy Markdown
Contributor

Description

Adds a new pyrevit.revit.tmpgfx helper module for managing Revit temporary in-canvas controls and click handlers.

  • Adds ControlManager and Handler abstractions for DB.TemporaryGraphicsManager and UI.ITemporaryGraphicsHandler
  • Adds a developer sample bundle under extensions/pyRevitDevTools.extension/.../TemporaryGraphics.pushbutton
  • Includes a warning icon example and basic cleanup support

Checklist

Before submitting your pull request, ensure the following requirements are met:

  • Code follows the PEP 8 style guide.
  • Code has been formatted with Black using the command:
    pipenv run black {source_file_or_directory}
  • Changes are tested and verified to work as expected.

@jmcouffin
jmcouffin requested a review from Copilot June 20, 2026 08:23
@jmcouffin jmcouffin added the Enhancement Enhancement request [class->Improved #{number}: {title}] label Jun 20, 2026
@pyrevitlabs pyrevitlabs deleted a comment from devloai Bot Jun 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new pyrevit.revit.tmpgfx helper module that wraps Revit’s TemporaryGraphicsManager and ITemporaryGraphicsHandler, plus a DevTools sample command demonstrating placing an in-canvas warning icon on a picked element and handling clicks.

Changes:

  • Added pyrevit.revit.tmpgfx with Handler (service registration + click dispatch) and ControlManager (add/remove/clear/sync temporary in-canvas controls).
  • Added a persistent-engine developer example bundle that places a warning icon control on a selected element and shows element info on click.
  • Added a bundle config.py intended to clean up temp graphics/handlers for the persistent example.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 4 comments.

File Description
pyrevitlib/pyrevit/revit/tmpgfx.py New wrapper module around TemporaryGraphics external service handler + per-view control management utilities
extensions/pyRevitDevTools.extension/pyRevitDev.tab/Developer Examples.panel/TemporaryGraphics.pushbutton/script.py Developer sample placing a control and handling clicks via the new wrapper
extensions/pyRevitDevTools.extension/pyRevitDev.tab/Developer Examples.panel/TemporaryGraphics.pushbutton/config.py Cleanup logic for the persistent example bundle
extensions/pyRevitDevTools.extension/pyRevitDev.tab/Developer Examples.panel/TemporaryGraphics.pushbutton/bundle.yaml Declares title and persistent engine requirement for the sample

Comment thread pyrevitlib/pyrevit/revit/tmpgfx.py
Comment thread pyrevitlib/pyrevit/revit/tmpgfx.py
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Wurschdhaud

Copy link
Copy Markdown
Contributor Author

Won't be able to fix the comments for the next 2-3 weeks. So I guess one for the next release

- safeguard against -1 (not documented for Revit API, but little to no overhead)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Enhancement request [class->Improved #{number}: {title}]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants