-
-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2387 from jmcouffin/tool_move_vp_label
New Tool - Move Viewport label
- Loading branch information
Showing
5 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...b/Drawing Set.panel/views.stack/Views.pulldown/Move Viewport Label.pushbutton/bundle.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
title: | ||
fr_fr: |- | ||
Déplacer le Titre de la Fenêtre | ||
en_us: |- | ||
Move Viewport Label | ||
de_de: |- | ||
Verschieben des Fenstertitels | ||
ru: |- | ||
Переместить метку окна | ||
tooltip: | ||
fr_fr: |- | ||
Déplacer le Titre de la Fenêtre | ||
https://discourse.pyrevitlabs.io/t/i-developed-a-tool-need-help-to-get-it-into-the-new-release-of-pyrevit/7639/3 | ||
en_us: |- | ||
Move Viewport Label | ||
https://discourse.pyrevitlabs.io/t/i-developed-a-tool-need-help-to-get-it-into-the-new-release-of-pyrevit/7639/3 | ||
de_de: |- | ||
Verschieben des Fenstertitels | ||
https://discourse.pyrevitlabs.io/t/i-developed-a-tool-need-help-to-get-it-into-the-new-release-of-pyrevit/7639/3 | ||
ru: |- | ||
Переместить метку окна | ||
https://discourse.pyrevitlabs.io/t/i-developed-a-tool-need-help-to-get-it-into-the-new-release-of-pyrevit/7639/3 | ||
authors: | ||
- Tim Hevel | ||
- Jean-Marc Couffin (C# to python and refactor) | ||
|
||
min_revit_version: 2022 | ||
context: active-sheet |
Binary file added
BIN
+682 Bytes
...t.panel/views.stack/Views.pulldown/Move Viewport Label.pushbutton/icon.dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+717 Bytes
...ng Set.panel/views.stack/Views.pulldown/Move Viewport Label.pushbutton/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions
22
...tab/Drawing Set.panel/views.stack/Views.pulldown/Move Viewport Label.pushbutton/script.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# encoding: utf-8 | ||
# from https://discourse.pyrevitlabs.io/t/i-developed-a-tool-need-help-to-get-it-into-the-new-release-of-pyrevit/7639/3 | ||
|
||
from pyrevit import DB | ||
from pyrevit.revit import pick_point, pick_element_by_category, Transaction | ||
from pyrevit.forms import alert | ||
|
||
|
||
def move_viewport_label(viewport, point): | ||
viewminpoint = viewport.GetBoxOutline().MinimumPoint | ||
new_label_location = point - viewminpoint | ||
viewport.LabelOffset = new_label_location | ||
|
||
|
||
if __name__ == '__main__': | ||
selected_point = pick_point("Select a point") | ||
selected_viewport = pick_element_by_category(DB.BuiltInCategory.OST_Viewports, "Select a viewport") | ||
if selected_point is not None and selected_viewport is not None: | ||
with Transaction("Move Label to Point"): | ||
move_viewport_label(selected_viewport, selected_point) | ||
else: | ||
alert("Invalid selection. Please try again.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters