Jump to content

use a setq variable in DIESEL


Aftertouch

Recommended Posts

Hello all,

Im having some issues with mijn custom ribbon... i found this code below:

 

$(if,$(=,$(getvar,cvport),1),!PORT,PORT)

This allows makes the button highlighted if the variable CVPORT is 1, and else its a regular button...

 

Now i have a lisp that makes a custom variable:

(setq onoffswitch 1)

 

I want the button to toggle the button based on this variable.

 

In autocad i can use

!onoffswitch

and it returns either 0 or 1 (depending on the state).

 

Now i try to set the code in the ribbon button to:

 

$(if,$(=,$(onoffswitch),1),!PORT,PORT)
and...
$(if,$(=,$(!onoffswitch),1),!PORT,PORT)
and...
$(if,$(=,$($!onoffswitch),1),!PORT,PORT)

 

Now the button shows:

$(IF,??)

 

How can this be fixed?

Link to comment
Share on other sites

  • 2 weeks later...

What i am trying to do is the following:

On startup, a lisp is loaded wich uses a few variables...

(setq aanuitswitchB 0)
(setq aanuitswitchV 0)
(setq aanuitswitchT 0)
(setq aanuitswitchN 0)
(setq aanuitswitchR 0)
(setq aanuitswitchX 0)

there values can change with commands.

 

i did NOT make then local, so the set value can be shown when i use !aanuitswitchB for example. this will return 0 or 1.

I want a ribbon button the be highlighted when 'aanuitswitchB' is 1, and regulat when it is 0.

 

I can only get the highlight option to work with regular AutoCAD variables..

Link to comment
Share on other sites

Diesel only works with system variables. As unit values are saved in system variables there may be a solution though making it part of modemacro may work better than a ribbon button. The ribbon doesn't always reflect correct system variable settings as it doesn't regen every time a command or code is executed the way the "Object Snap Cursor Menu" does. What's the purpose of all those aanuitswitch* variables? Posting code may help get you a solution.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...