Jump to content

Create list of variables from toggle-box


Manuel_Kunde

Recommended Posts

Hi all, I have variables here from a toggle dialog box that contain either the value 0 or 1.

How can I create a list from them?

 

 (setq vision_pair1 (get_tile "t1")
       vision_pair2 (get_tile "t2")
       vision_pair3 (get_tile "t3")
       vision_pair4 (get_tile "t4")
       vision_pair5 (get_tile "t5")
       vision_pair6 (get_tile "t6")
       vision_pair7 (get_tile "t7")
       vision_pair8 (get_tile "t8")
       vision_pair9 (get_tile "t9")
       vision_pair10 (get_tile "t10")
 )

 

For example, I want to show all variables in an acet-ui-message (or alert-box) that contain the value 1.

 

 

Link to comment
Share on other sites

You dont have to do it that way can just loop trough the toggle buttons as you know they are t+number. Simplest way is look at these programs, Multi Radio Buttons, Multi Getvals and Multi toggles are in the download section here at cadtutor. Yes the Multi Toggles makes a single  list (0 1 0 1 1 1 0 1 0 1)

 

The bit you want

(defun mkv_lst ( / )
(setq v_lst '())
(setq x 1)
(repeat (- (length ahbutlst) 1)
(setq val (strcat "Tb" (rtos x 2 0)))
(setq v_lst (cons (get_tile val) v_lst))
(setq x (+ x 1))
)
)

(setq y 0)
(repeat (- (length ahbutlst) 1)
    (setq keynum (strcat "Tb" (rtos (setq y (+ Y 1)) 2 0)))
    (set_tile keynum "0")
    (mode_tile keynum 3)
)

(action_tile "accept" "(mkv_lst)(done_dialog)")

 

 

  • Like 1
Link to comment
Share on other sites

On 11/12/2021 at 2:48 AM, BIGAL said:

You dont have to do it that way can just loop trough the toggle buttons as you know they are t+number. Simplest way is look at these programs, Multi Radio Buttons, Multi Getvals and Multi toggles are in the download section here at cadtutor. Yes the Multi Toggles makes a single  list (0 1 0 1 1 1 0 1 0 1)

 

I modified this for my needs. Thanks for the code!

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...