- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In a previous post, I presented an issue that needs to be solved by a DIESEL expression. The task is to create a macro that toggles the current layer color between red and green.
I set up USERI1 and USERI2 via -setvar as values "1", and "3" to act as their respective color values for red and green. Then I created a layer command to set the layer color via the variable vice a straight, typed-in value (in this case "1" for "red" using the -layer color command). I also set the cecolor to "bylayer", so both the block and layer match.
I know my variable works, because when I use this macro, the layer turns red (from any color):
^C^C-layer;c;$M=$(getvar, USERI1);;;
However, I don't know enough about DIESEL syntax to set up the logic toggle between layer color red and green properly. I am not a programmer nor do I have any experience beyond a week or so of Autocad automation. What mistakes am I making below? Is the logic sound?
^C^C-layer;c;$M=$(if,$(=,$(getvar,USERI1),getvar,USERI2);;,getvar,USERI1;;)
I also toyed with this which sets up the layer color in red first, then moves on to the logic toggle:
^C^C-layer;c;$M=$(getvar, USERI1)^C;$M=$(if,$(=,$(getvar,USERI1),getvar,USERI2;;,getvar,USERI1;;)
Beyond the first macro listed above, none of the others work. Any CONCRETE, non-cryptic, help would be appreciated. Even a tangential example using a USERI variable working properly would help. I'm a working family guy, taking night school classes so my ability to spend hours trying to learn DIESEL is limited, but I'm trying!
Solved! Go to Solution.