UCSICON toggle by mistake in the macro in CUI

UCSICON toggle by mistake in the macro in CUI

Karol-Or
Advocate Advocate
1,110 Views
7 Replies
Message 1 of 8

UCSICON toggle by mistake in the macro in CUI

Karol-Or
Advocate
Advocate

I know very little of lisp. i copied the UCSICON on origin in the list of commands in the panels in CUI and somehow changed it to:

$M=$(if,$(and,$(getvar,ucsicon),2),^C^C_ucsicon _no,^C^C_ucsicon _or) 

Why is the first part (^C^C_ucsicon _no)? can't i jump directly to what i want: ^C^C_ucsicon _or

Why does it toggle?

See the screencast

0 Likes
Accepted solutions (1)
1,111 Views
7 Replies
Replies (7)
Message 2 of 8

Kent1Cooper
Consultant
Consultant
Accepted solution

@Karol-Or wrote:

.... i copied the UCSICON on origin in the list of commands in the panels in CUI and somehow changed it to:

$M=$(if,$(and,$(getvar,ucsicon),2),^C^C_ucsicon _no,^C^C_ucsicon _or) 

Why is the first part (^C^C_ucsicon _no)? can't i jump directly to what i want: ^C^C_ucsicon _or

Why does it toggle?

....

 

I'm not at a newer-version location to confirm, and I'm not all that conversant with Diesel syntax, but just looking at it....

 

Note the if near the beginning.  It looks like [but I'm confused by the and in there] it's checking whether the UCSICON System Variable is set to 2, which is the show-it-at-the-Origin-if-possible setting.  The first part following [^C^C_ucsicon _no] would be the 'then' expression -- if it's currently in Origin mode, set it to No-origin mode.  The second part [^C^C_ucsicon _or] would be the 'else' expression -- if it's not  in Origin mode, set it to be.  That's the toggling -- set it to whichever of those two it's not currently set to.

 

If you always want the button to only set it to Origin mode, whether or not that's the current setting, you should be able to eliminate the whole (if) aspect, and just do the part you want:

^C^C_ucsicon _or

Kent Cooper, AIA
0 Likes
Message 3 of 8

Karol-Or
Advocate
Advocate

So the macro is Diesel, not Lisp?

0 Likes
Message 4 of 8

Kent1Cooper
Consultant
Consultant

It's a combination of Diesel expressions [the parts with all the dollar signs] and plain command-macro language [the actual UCSICON commands].  A lot of Diesel expressions look very similar to the equivalent AutoLisp functions in their parentheses and function names, but with grammatical-structure differences [the dollar signs, commas instead of spaces, etc.].

Kent Cooper, AIA
0 Likes
Message 5 of 8

Karol-Or
Advocate
Advocate

Can i use Lisp instead of Diesel in the macros?

0 Likes
Message 6 of 8

cadffm
Consultant
Consultant
Menu-Macros (and Scripts.scr) send informations to commandline,
commandline accept and evaluate lisp statements.
Sure, you can.




Sebastian

Message 7 of 8

Karol-Or
Advocate
Advocate

Thanks

0 Likes
Message 8 of 8

Kent1Cooper
Consultant
Consultant

Some [maybe most?] AutoLisp expressions can be used in macros, though I believe some cannot, but I don't know which.  Try the ones you want, and you'll know quickly enough.

Kent Cooper, AIA