Skip to content

Commit

Permalink
Merge pull request #2387 from jmcouffin/tool_move_vp_label
Browse files Browse the repository at this point in the history
New Tool - Move Viewport label
  • Loading branch information
jmcouffin authored Sep 2, 2024
2 parents 2ab9335 + d8cd062 commit 0b2260f
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.")
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ layout:
- Match Title on Sheet in Open Docs
- Create Parallel Section
- Add Views to Sheets
- Move Viewport Label
- Remove Underlay From Selected Views
- -----
- Set View Template Controlled Parameters

0 comments on commit 0b2260f

Please sign in to comment.