Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can a SETQ selection set be programmed to the last selection?

21 REPLIES 21
SOLVED
Reply
Message 1 of 22
murmanator
658 Views, 21 Replies

Can a SETQ selection set be programmed to the last selection?

Im not sure if Im saying that right. I use this little snippet of code in a lot of programs (with different lists of course depending on the program). As I understand it, the part that reads <POOL> and ("POOL") define the default choice in the display and the selection. Ive removed those and there is no default, you must select something. What I want to know is if there is a way to use that part of the code to make the selection whatever the last selection was, instead of a defined default or none. Thank you

 

(IF (NULL TYP)
(PROGN (INITGET "POOL SPA THERAPY WTR-FEATURE")
(SETQ TYP (COND ((GETKWORD "\nSpecify Layer [POOL/SPA/THERAPY/WTR-FEATURE] <POOL>: "))
("POOL")
)
)
)
)

21 REPLIES 21
Message 21 of 22
Kent1Cooper
in reply to: murmanator


@murmanator wrote:

.... I ran into some trouble awhile back NOT using all caps where I had multiple options with the same first letter. I had to cap the second/third letters for it all to work right (there needed to be unique capitalized letters leading off each word) . ....


You don't need unique leading letters, but can capitalize just the first two letters, if that helps, or three if needed, etc.  And you can use just the first letter for the more likely option that starts with it, and more letters for the less likely ones as needed.  Like the LOck option in a command-line -LAYER command, distinguished by use of two letters from the Ltype option that uses the L alone.

Kent Cooper, AIA
Message 22 of 22
Sea-Haven
in reply to: murmanator

If you try my multi Radio buttons.lsp you can use the But value to the last picked button, it is not documented but in the code it uses the global value BUT to choose which radio button to highlight. Ok now part 2 you can save in your dwg the value of BUT using the Ldata function so when you open the dwg again you can search for the value of BUT if not found that means code has not been ran so uses default of 1.

 

 

(if (not AH:Butts)(load "Multi radio buttons.lsp")) ; loads the program if not loaded already
(setq ahdef (vlax-ldata-get "MURM" "AHDEF" ) )
(if (= ahdef nil)(setq ahdef 1)) 	; this is needed to set default button
(setq ans (ah:butts ahdef "V"   '("Please choose " "Pool" "Spa" "Therapy" "Water-feature" )))
(setq ahdef but)
(vlax-ldata-set "MURM" "AHDEF" but)

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report