AnnoAllOff

Short description

  • Opens a DCL picker to choose Model/Layout tabs, then sets ANNOALLVISIBLE to 0 on the selected tabs.
  • Provides quick selection controls for All or None before applying the change.
annoalloff 000

Command:

  • Command: AAOFF

Description:

  • Builds a temporary DCL dialog at runtime that lists all tabs (including Model) and allows multi-selection.
  • After the user confirms the selection, the routine switches to each chosen tab and runs the command ANNOALLVISIBLE with value 0.
  • Stores and restores key environment state such as CTAB, TILEMODE, and MSPACE so the user returns to the prior context after execution.
  • Note: the variable ANNOALLVISIBLE is maintained per Model tab and per Layout tab, so this routine applies changes per tab rather than per viewport entity.

Helper function: (if any)​

  • AAOFF:WriteDcl writes the DCL definition to a temporary .dcl file used to display the selection dialog.
  • AAOFF:GetTabNames enumerates the document layouts via ActiveX and returns a list of tab names including Model.
  • AAOFF:MakeAllIndexString generates the space-separated index string required by a multi-select list box to select all items.
  • AAOFF:IdxList->Names converts the list box index string into the corresponding tab name list for processing.
  • AAOFF:SetAnnoAllVisible0 iterates selected tabs, forces paperspace on layouts, executes ANNOALLVISIBLE to set it to 0, then restores the previous tab and mode settings.
  • c:AAOFF orchestrates the workflow: builds the tab list, shows the dialog, handles All/None actions, applies the setting, and cleans up temporary files.

Functionalities:

  • Runtime DCL generation creates a dialog file in a temp location and loads it for the session.
  • Multi-select tab picker allows choosing any combination of Model and Layout tabs for updating.
  • All button selects every tab in the list box using a generated index string.
  • None button clears the selection to prevent changes from being applied.
  • Per-tab update switches CTAB for each chosen tab and sets ANNOALLVISIBLE to 0.
  • Layout handling forces paperspace on layout tabs by setting MSPACE false when TILEMODE indicates a layout context.
  • State restoration restores prior CTAB, TILEMODE, and MSPACE values after processing.

Result:

  • If the user confirms a selection, ANNOALLVISIBLE becomes 0 on each selected tab and the prior tab/mode state is restored afterward.
  • If no tabs are selected, prints AAOFF: Nothing selected. No changes made.
  • If the dialog is cancelled, prints AAOFF: Cancelled.
  • If the dialog cannot be loaded, prints AAOFF: Could not load dialog.
  • Always deletes the temporary DCL file and unloads the dialog definition at the end of the routine.

Images, animations etc.

annoalloff 000
Pixel

XAML code:

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:src="clr-namespace:Autodesk.Windows;assembly=AdWindows">
    
    <src:RibbonToolTip x:Key="AnnoAllOff">
        <src:RibbonToolTip.ExpandedContent>
            <StackPanel>
                <TextBlock Background="AntiqueWhite" TextAlignment="Left">
				<Bold>Function Syntax: AAOFF</Bold>
				<LineBreak/>
				<Hyperlink>AI+https://forums.autodesk.com/t5/autocad-forum/annotative-objects-not-displaying-in-layout-viewports/td-p/7949416</Hyperlink>
				<LineBreak/>		
<Bold>Program purpose</Bold><LineBreak/>
This AutoLISP program defines the command <Bold><Span Foreground="DarkRed">AAOFF</Span></Bold> to help you set the AutoCAD system variable <Bold><Span Foreground="DarkRed">ANNOALLVISIBLE</Span></Bold> to <Bold><Span Foreground="DarkRed">0</Span></Bold> for user-selected tabs (Model and Layouts).<LineBreak/>

<Bold>What the user must do</Bold><LineBreak/>
The user runs the command <Bold><Span Foreground="DarkRed">AAOFF</Span></Bold> and then selects which tabs to update from a multi-select list.<LineBreak/>

<Bold>Key user interface behavior</Bold><LineBreak/>
The program builds a temporary <Bold><Span Foreground="DarkRed">DCL</Span></Bold> dialog at runtime, displays it, and deletes the temporary DCL file after use.<LineBreak/>
The dialog contains a list of all available tabs including <Bold>Model</Bold> and each <Bold>Layout</Bold> name.<LineBreak/>
Multi-selection is supported, and the dialog provides quick selection buttons.<LineBreak/>

<Bold>Functionalities</Bold><LineBreak/>
• <Bold>Builds a dialog dynamically</Bold> by writing a DCL definition into a temporary file (for example <Span Foreground="DarkRed">AAOFF.dcl</Span>).<LineBreak/>
• <Bold>Lists all drawing tabs</Bold> (Model plus all Layout tabs) by querying the active document layouts collection.<LineBreak/>
• <Bold>Defaults to selecting all tabs</Bold> when the dialog opens, so the operation applies everywhere unless the user narrows it down.<LineBreak/>
• <Bold>Provides selection shortcuts</Bold> via buttons:<LineBreak/>
• <Span Foreground="DarkRed">All</Span> selects every tab in the list.<LineBreak/>
• <Span Foreground="DarkRed">None</Span> clears the selection.<LineBreak/>
• <Bold>Applies the change per selected tab</Bold> by switching to each chosen tab using <Span Foreground="DarkRed">CTAB</Span> and then executing the command <Span Foreground="DarkRed">ANNOALLVISIBLE</Span> with value <Span Foreground="DarkRed">0</Span>.<LineBreak/>
• <Bold>For layout tabs, forces Paper Space</Bold> before applying the change by setting the document <Span Foreground="DarkRed">MSPACE</Span> state to false when <Span Foreground="DarkRed">TILEMODE</Span> indicates a layout environment.<LineBreak/>
• <Bold>Restores the prior environment</Bold> after processing, including restoring the previous <Span Foreground="DarkRed">CTAB</Span>, <Span Foreground="DarkRed">TILEMODE</Span>, and <Span Foreground="DarkRed">MSPACE</Span> values as applicable.<LineBreak/>
• <Bold>Handles no-selection and cancel cases</Bold> with clear console feedback and no changes applied when appropriate.<LineBreak/>

<Bold>Important technical notes</Bold><LineBreak/>
<Span Foreground="DarkRed">ANNOALLVISIBLE</Span> is stored per Model tab and per Layout tab, not per viewport entity, so the program correctly iterates through tabs rather than viewports.<LineBreak/>
The operation is implemented by calling the AutoCAD command line: <Span Foreground="DarkRed">._ANNOALLVISIBLE</Span> then <Span Foreground="DarkRed">0</Span> for each selected tab.<LineBreak/>

<Bold>Major components in the code</Bold><LineBreak/>
<Bold><Span Foreground="DarkRed">AAOFF:WriteDcl</Span></Bold> writes the dialog definition to a temporary DCL file.<LineBreak/>
<Bold><Span Foreground="DarkRed">AAOFF:GetTabNames</Span></Bold> returns a list of tab names including Model and layouts from the active document.<LineBreak/>
<Bold><Span Foreground="DarkRed">AAOFF:MakeAllIndexString</Span></Bold> generates the default selection string for the list box such as 0 1 2 ... n-1.<LineBreak/>
<Bold><Span Foreground="DarkRed">AAOFF:IdxList->Names</Span></Bold> converts the selected list box indices into tab name strings.<LineBreak/>
<Bold><Span Foreground="DarkRed">AAOFF:SetAnnoAllVisible0</Span></Bold> performs the tab switching and sets <Span Foreground="DarkRed">ANNOALLVISIBLE</Span> to <Span Foreground="DarkRed">0</Span>, then restores the original state.<LineBreak/>
<Bold><Span Foreground="DarkRed">c:AAOFF</Span></Bold> is the command entry point that orchestrates dialog creation, selection capture, execution, and cleanup.<LineBreak/>

<Bold>Outputs and user feedback</Bold><LineBreak/>
If the user selects one or more tabs, the program updates those tabs and exits quietly.<LineBreak/>
If the user selects nothing, it prints: A AOFF: Nothing selected. No changes made.<LineBreak/>
If the user cancels, it prints: A AOFF: Cancelled.<LineBreak/>
If the dialog cannot load, it prints: A AOFF: Could not load dialog.<LineBreak/>
</TextBlock>
                
                <!-- Use MediaElement for GIF (static first frame) and Image as fallback -->
 
 
            </StackPanel>
        </src:RibbonToolTip.ExpandedContent>
    </src:RibbonToolTip>
</ResourceDictionary>

Additional info:

Share this page:

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Tags: 🏷️ Autocad Lisps, 🏷️ Layouts, 🏷️ Layouts_menu, 🏷️ Paper Space
0
Would love your thoughts, please comment.x
()
x