GoToLayout

Short description

  • Opens a DCL dialog to filter layout names with wildcards and quickly switch the current tab to the selected match.
  • Includes optional preview switching while browsing and remembers the last used filter pattern across runs.
gotolayout 000

Command:

  • Command: GoToLayout

Description:

  • Builds a unique temporary DCL file each run and launches a dialog titled Go To Layout with a filter edit box and a matches list.
  • Reads available tabs from layoutlist and explicitly includes Model so both model and paper-space tabs can be targeted.
  • Filters using case-insensitive wcmatch against the user pattern, treating an empty pattern as *, and sorts matches case-insensitively for predictable navigation.
  • Provides browsing controls: selecting a list item or using < Prev and Next > updates the highlighted match, with wrap-around at the ends.
  • When Preview switch while browsing is enabled, the routine switches CTAB live as the selection changes; OK finalizes the selection, Cancel restores the original tab.

Helper function: (if any)​

  • _gtl:temp-dcl-path generates a unique temp DCL filepath in the TEMP directory for each run.
  • _gtl:write-dcl writes the dialog definition to the temp file, including filter input, preview toggle, count text, match list, and navigation buttons.
  • _gtl:layouts-raw returns layout names and adds Model so it is included in the match set.
  • _gtl:sort-ci sorts strings case-insensitively for consistent ordering.
  • _gtl:filter-layouts filters layout names using case-insensitive wcmatch; empty filter becomes *.
  • _gtl:fill-list fills the matches list box with the current filtered list.
  • gtl:_set-ctab-if-preview switches CTAB to the currently indexed match when preview is enabled.
  • gtl:update rebuilds matches when the pattern changes, updates the count label, selects the first match, and enables or disables OK and navigation depending on whether any matches exist.
  • gtl:on-list updates the current index from the list selection and triggers preview switching if enabled.
  • gtl:prev and gtl:next navigate the match list with wrap-around and trigger preview switching if enabled.
  • c:GoToLayout manages dialog lifecycle, stores the original tab, persists the last pattern, and applies or restores CTAB based on OK or Cancel.

Functionalities:

  • Wildcard filter input supporting * and ? to quickly narrow layout names.
  • Case-insensitive matching and sorting for reliable results regardless of layout name casing.
  • Preview toggle that can switch CTAB live as the user browses matches.
  • Navigation buttons < Prev and Next > with wrap-around to cycle through matches efficiently.
  • Automatic enabling and disabling of OK and navigation when zero layouts match the filter pattern.
  • Remembers the last used pattern in a global variable so subsequent runs start with the previous filter.
  • Restores the original tab on cancel or dialog close for safe browsing workflows.

Result:

  • On OK, switches CTAB to the selected layout or Model tab and prints a confirmation line.
  • If no matches exist, OK is disabled and the command prevents switching; if reached defensively, the routine restores the original tab and reports no matches.
  • On Cancel or close, restores the original tab and prints Cancelled. Original tab restored.
  • Always unloads the dialog and deletes the temporary DCL file after the dialog closes.
  • If the DCL file cannot be written or the dialog cannot be loaded, prints an error message and exits without changing tabs.

Images, animations etc.

gotolayout 000
Pixel

Additional info:

Share this page:

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Tags: General_AutoCAD, Layouts, Lisp, Model Space, Paper Space
0
Would love your thoughts, please comment.x
()
x