Hide / Show Objects

Short description

Provides a dialog box for controlling object visibility in AutoCAD. Lets you choose between isolating, hiding, or displaying all objects using radio buttons and confirmation controls.
hideshowobjects 000

Command:

Command: c:HS Opens the “Display Objects Options” dialog where you can select whether to isolate selected objects, hide them, or show all objects again.

Description:

When executed, the program: • Step 1 Writes a temporary DCL file defining a simple dialog with three radio buttons and OK/Cancel controls. • Step 2 Opens the dialog and preselects the last used option (default “Isolate the selected”). • Step 3 Captures which option the user selects and runs the matching visibility function:   – “Isolate the selected” → hides everything else.   – “Hide selected” → hides only the chosen objects.   – “Display all” → shows every hidden object again. • Step 4 Redraws the view after the visibility change. • Step 5 Restores the previous choice as default for next run.

Helper function: (if any)​

Helper Functions Used:writeHSDCL — Creates the DCL dialog definition dynamically and writes it to a temp file.radioHSDCL — Loads and displays the dialog, handles user input, and sets the selected option variable.to_ob_izol — Isolates the selected entities by hiding all others (sets entity visibility attribute 60 = 1 for all non-selected).to_ob_hight — Hides only the selected entities by setting their visibility to 1.to_ob_show — Restores visibility of all entities by setting attribute 60 = 0 for all.

Functionalities:

Main Functionalities:Dialog-driven visibility control — Choose from isolate, hide, or show-all directly via a simple UI.Remembers last selection — Automatically selects the last used option on the next run.Dynamic DCL creation — Builds its dialog at runtime without needing an external DCL file.Automatic screen refresh — Uses “_regen” after every visibility change to update the display.

Result:

Result: Depending on the user’s choice, the drawing updates to show only selected objects, hide them, or reveal all again. Visibility attributes are updated for all entities, and the screen refreshes automatically for immediate effect.
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="Test">
<src:RibbonToolTip.ExpandedContent>
<StackPanel>
<TextBlock Background="AntiqueWhite" TextAlignment="Left">
<Bold>Function Syntax: HS</Bold>
<LineBreak/>
<Bold>Version: 1 Date: 01.04.2011</Bold>
<LineBreak/>
<LineBreak/>
<Hyperlink>https://dwg.ru/dnl/9297</Hyperlink>
<LineBreak/>
<Bold>Command name</Bold><LineBreak/>
<Run>HS (type </Run><Run Foreground="DarkRed">HS</Run><Run> at the AutoCAD command line)</Run><LineBreak/>
<LineBreak/>

<Bold>Description</Bold><LineBreak/>
<Run>This program provides a dialog with three display options that control object visibility by editing the entity </Run><Run Foreground="DarkRed">DXF group code 60</Run><Run> (visibility) on selected entities or on all entities in the drawing, followed by a REGEN to refresh the display.</Run><LineBreak/>
<LineBreak/>

<Bold>User interaction</Bold><LineBreak/>
<Run>• Running </Run><Run Foreground="DarkRed">HS</Run><Run> opens a dialog titled </Run><Run Foreground="DarkRed">Display Objects Options</Run><Run>.</Run><LineBreak/>
<Run>• The user chooses one radio option:</Run><LineBreak/>
<Run>  • <Run Foreground="DarkRed">Isolate the selected</Run>.</Run><LineBreak/>
<Run>  • <Run Foreground="DarkRed">Hide selected</Run>.</Run><LineBreak/>
<Run>  • <Run Foreground="DarkRed">Display all</Run>.</Run><LineBreak/>
<Run>• The user clicks </Run><Run Foreground="DarkRed">OK</Run><Run> to execute or </Run><Run Foreground="DarkRed">Cancel</Run><Run> to exit.</Run><LineBreak/>
<LineBreak/>

<Bold>High-level workflow</Bold><LineBreak/>
<Run>• Writes a temporary DCL file (dialog definition) to the temp folder using </Run><Run Foreground="DarkRed">vl-filename-mktemp</Run><Run>.</Run><LineBreak/>
<Run>• Loads and opens the dialog with </Run><Run Foreground="DarkRed">load_dialog</Run><Run> and </Run><Run Foreground="DarkRed">new_dialog</Run><Run>.</Run><LineBreak/>
<Run>• Remembers the last selected radio option using the global variable </Run><Run Foreground="DarkRed">*HS-last-option*</Run><Run> and preselects it next time.</Run><LineBreak/>
<Run>• On OK, executes one of three routines that set or clear visibility flags on entities using </Run><Run Foreground="DarkRed">entget</Run><Run>, </Run><Run Foreground="DarkRed">entmod</Run><Run>, and a final </Run><Run Foreground="DarkRed">REGEN</Run><Run>.</Run><LineBreak/>
<LineBreak/>

<Bold>Functionalities</Bold><LineBreak/>
<Run>• Provides three visibility operations:</Run><LineBreak/>
<Run>  • Isolate selected objects by hiding everything else.</Run><LineBreak/>
<Run>  • Hide selected objects only.</Run><LineBreak/>
<Run>  • Show all objects by clearing hidden flags globally.</Run><LineBreak/>
<Run>• Uses selection sets for scope control:</Run><LineBreak/>
<Run>  • User selection via </Run><Run Foreground="DarkRed">ssget</Run><Run>.</Run><LineBreak/>
<Run>  • Entire drawing selection via </Run><Run Foreground="DarkRed">ssget "X"</Run><Run>.</Run><LineBreak/>
<Run>• Ensures the visibility group code exists on each entity by adding it when missing.</Run><LineBreak/>
<LineBreak/>

<Bold>Option behavior details</Bold><LineBreak/>
<Run>• Isolate the selected (function </Run><Run Foreground="DarkRed">to_ob_izol</Run><Run>):</Run><LineBreak/>
<Run>  • Prompts the user to select objects to keep visible.</Run><LineBreak/>
<Run>  • Selects all entities in the drawing with </Run><Run Foreground="DarkRed">ssget "X"</Run><Run>.</Run><LineBreak/>
<Run>  • Sets DXF visibility code 60 to 1 for all entities (hide everything).</Run><LineBreak/>
<Run>  • Sets DXF visibility code 60 to 0 for the user selection (unhide selected).</Run><LineBreak/>
<Run>  • Runs </Run><Run Foreground="DarkRed">REGEN</Run><Run> to update display.</Run><LineBreak/>
<LineBreak/>
<Run>• Hide selected (function </Run><Run Foreground="DarkRed">to_ob_hight</Run><Run>):</Run><LineBreak/>
<Run>  • Prompts the user to select objects to hide.</Run><LineBreak/>
<Run>  • Sets DXF visibility code 60 to 1 for that selection only.</Run><LineBreak/>
<Run>  • Runs </Run><Run Foreground="DarkRed">REGEN</Run><Run>.</Run><LineBreak/>
<LineBreak/>
<Run>• Display all (function </Run><Run Foreground="DarkRed">to_ob_show</Run><Run>):</Run><LineBreak/>
<Run>  • Selects all entities in the drawing with </Run><Run Foreground="DarkRed">ssget "X"</Run><Run>.</Run><LineBreak/>
<Run>  • Sets DXF visibility code 60 to 0 for all entities (unhide all).</Run><LineBreak/>
<Run>  • Runs </Run><Run Foreground="DarkRed">REGEN</Run><Run>.</Run><LineBreak/>
<LineBreak/>

<Bold>Important commands and calls highlighted</Bold><LineBreak/>
<Run>• <Run Foreground="DarkRed">vl-filename-mktemp</Run> — creates a unique temp filename for the DCL dialog.</Run><LineBreak/>
<Run>• <Run Foreground="DarkRed">load_dialog</Run> and <Run Foreground="DarkRed">new_dialog</Run> — loads and opens the dialog.</Run><LineBreak/>
<Run>• <Run Foreground="DarkRed">action_tile</Run> — captures the selected radio button and stores it in </Run><Run Foreground="DarkRed">*HS-last-option*</Run><Run>.</Run><LineBreak/>
<Run>• <Run Foreground="DarkRed">ssget</Run> and <Run Foreground="DarkRed">ssget "X"</Run> — builds selection sets for selected-only or all-entities operations.</Run><LineBreak/>
<Run>• <Run Foreground="DarkRed">entget</Run> — reads the entity DXF list.</Run><LineBreak/>
<Run>• <Run Foreground="DarkRed">assoc 60</Run> — retrieves visibility flag if present.</Run><LineBreak/>
<Run>• <Run Foreground="DarkRed">entmod</Run> — writes the updated DXF list back to the entity.</Run><LineBreak/>
<Run>• <Run Foreground="DarkRed">REGEN</Run> — refreshes the display to reflect visibility changes.</Run><LineBreak/>
<LineBreak/>

<Bold>Outputs and messages</Bold><LineBreak/>
<Run>• If the dialog is cancelled: prints </Run><Run Foreground="DarkRed">Command canceled</Run><Run>.</Run><LineBreak/>
<Run>• If OK is pressed but no option is detected: shows alert </Run><Run Foreground="DarkRed">No valid option selected</Run><Run>.</Run><LineBreak/>
<LineBreak/>

<Bold>Operational notes and limitations</Bold><LineBreak/>
<Run>• This routine does not use the native AutoCAD ISOLATEOBJECTS or HIDEOBJECTS commands; it directly edits entity visibility via DXF group code 60.</Run><LineBreak/>
<Run>• Some entity types, xrefs, or special objects may not behave as expected when forced hidden by group code 60.</Run><LineBreak/>
<Run>• Because it edits every entity for isolate and show-all operations, performance can degrade on very large drawings.</Run><LineBreak/>
<Run>• The code block contains duplicated definitions of the dialog writer and runner; functionally they produce the same dialog and behavior, with the later definitions overriding earlier ones.</Run><LineBreak/>


</TextBlock>
            
<Grid>
<Image Source="HideShowObjects_000.jpg" Stretch="Uniform"/>
</Grid>

<Grid>
<MediaElement
 Source="GIF"
 Stretch="Uniform"
 Visibility="Visible"/>
 </Grid>

</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, 🏷️ General menu, 🏷️ General_AutoCAD
0
Would love your thoughts, please comment.x
()
x