iLogic Drawing Layer Visibility Toggle

iLogic Drawing Layer Visibility Toggle

dave_novak
Participant Participant
78 Views
1 Reply
Message 1 of 2

iLogic Drawing Layer Visibility Toggle

dave_novak
Participant
Participant

Hello, I would like to figure out (with a little help from my friends) how to get Drawings to show the correct Visibility State in the Layer Drop Down after running the following iLogic Rule:

 

If ThisDrawing.Document.StylesManager.Layers("Visible Narrow (ANSI)").Visible = False Then
	ThisDrawing.Document.StylesManager.Layers("Visible Narrow (ANSI)").Visible = True
	
ElseIf ThisDrawing.Document.StylesManager.Layers("Visible Narrow (ANSI)").Visible = True Then ThisDrawing.Document.StylesManager.Layers("Visible Narrow (ANSI)").Visible = False End If iLogicVb.UpdateWhenDone = True

 When I run this Rule the Lightbulb Icon in the Layer Drop Down doesn't change states unless I execute an Update All Sheets command.

 

2025-09-18_12-32-11.png

 

Any help would be greatly appreciated 

0 Likes
79 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

Interesting observation.  Seems to just be user interface lag.  After I run a rule like that, if I immediately check the drop-down list, it will not be accurate, but if I click the 'Edit Layers' button to view the layers, it is slow to open, but it will always be updated.  Then, if I check the drop-down list again, it will be updated.  There must be something going on when the command behind that 'edit layers' button gets executed that forces the update to happen, but not when clicking the tool for the drop-down control.  Updating the Document and the active Sheet does not seem to effect it at all, because it seems to be managed by the built-in user interface functionality.

By the way, it would be much more efficient to get the Layer object to a variable first, then just use a single line of code to 'Toggle' its visibility, like this:  oLayer.Visible = Not oLayer.Visible.  Using the 'Not' keyword it a great shortcut for toggling Booleans.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes