Jump to content

Multiple Toggles.lsp 1.0.0

   (2 reviews)

1 Screenshot

About This File

Multiple Toggles is a library routine that allows you to create as many Toggles of input as required (subject to Autocad limits) using a dialouge rather than the command line. 
Its use is intended where you want the user to pick one or more values. It can be used where you want to run a number of functions, pick multiple values to be used.
It can be used in most lisp code with just a couple of lines of code, compared to a hard coded solution of around 50+ lines repeated every time you want to use a dcl. 
To use just save the "Multiple Toggles.lsp" to a directory that is included in you Autocad search path. If you need more information how to do this send an email to info@alanh.com.au  
It only requires 2 lines of code in any lisp to use.
(if (not AH:Toggs)(load "Multiple toggles.lsp"))
(setq ans (AH:toggs (list "Change blank for yes " "Blocks" "Dimension" "Hatch" "Images" "Viewports" )))

In the example above the variable ans will have the toggle Values 1 or 0 for a toggle clicked on eg ("1" "0" "1" "0" "1") depending on toggle selected.
If you want further information or conversion of your code email info@alanh.com.au

  • Like 1

User Feedback

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.


  • This will not be shown to other users.
  • Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
    Add a review...

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

Jonathan Handojo

· Edited by Jonathan Handojo

   1 of 1 member found this review helpful 1 / 1 member

A very nice and useful code that saves you many lines of typing out. A few improvements from my perspective:


  1. Localise the variable DCL_ID
  2. Localise the function MKV_LST within the AH:TOGGS function.
  3. Reverse your return. When I selected several checkboxes, the result returned from AH:Toggs is the reverse of what's selected. (Supposedly you selected "Dimensions" in the above example as well.


If you fix it up, I'll reconsider giving 5 stars ;)

Link to review


It is great and useful! Could you please add 2 more toggles: "Select All" and "Select None" in cases many options for quickly?

Response from the author:

The code expects a list so can have as many toggles as you like up to a screen limit.


(setq ans (reverse (ah:toggs   '("A B C D" "A" "B" "C" "D"))))

(setq ans (reverse  (ah:toggs '("Choose a number" "1" "2" "3" "4" "5" "6" "7" "8" "9" "10"))))

(setq ans (reverse (ah:toggs   '("Yes or No" "Yes" "No"))))

Link to review
  • Create New...