miknick55 Posted October 1, 2019 Share Posted October 1, 2019 Hello, I'm not exactly sure what the term is, but I want to learn how to add the option for user input, similar to many of the standard AutoCAD commands, such as "ZOOM" or "FILLET", that have a default setting with the option to modify the command in the middle. Example: call the fillet command and you can fillet immediately or press "M" for multiple fillets or "R" to change the radius and continue with the command. I have used the "getkword" function a little bit, but it seems like it behaves differently. How would I go about, for a simple example, adding the option to press "M" to add "MULTIPLE" to this program which just changes the current layer, calls the "POINT" command and pauses for location input and then changes the layer back. I want to have the option to call "vportpoint" and be able to have the option to press "M" for multiple, and maybe "T" or something for "M2P", if that's possible. (defun c:vportpoint ( / oldlayer) (setq oldlayer (getvar "clayer")) (command "-layer" "set" "_VPORT" "") (command "point" pause) (setvar "clayer" oldlayer) (princ) ) If you have done something like this with a custom lisp command before your help would be much appreciated! Thank you, Michael Quote Link to comment Share on other sites More sharing options...
pkenewell Posted October 1, 2019 Share Posted October 1, 2019 (edited) A Simple search of "Keywords" in AutoCAD help resulted with this forum answer from Kent Copper: Quote If you construct the prompt with the options in square brackets with initial letters matching a preceding (initget) function's options, and with forward-slash separators, they will do that as in regular AutoCAD commands. An example, from my MakeMore.lsp routine, when the selected object you want to Make More of is a LWPolyline, offering options for the different commands that can make them, i.e. that might have been what made the one you selected: (initget "PLine Rectangle POlygon Donut Cloud Boundary Sketch") (setq S2 (getkword (strcat "\nPolyline Type [PLine/Rectangle/POlygon/Donut/Cloud/Boundary/Sketch] <" S1 ">: " ); strcat ); getkword S2 (cond (S2) (S1)); use User entry, or default for Enter ); setq Kent1Cooper Expert Elite 2019-03-12 This works with any of the (getxxx) functions in AutoLISP. Edited October 1, 2019 by pkenewell Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 2, 2019 Share Posted October 2, 2019 Another approach to kents good work. Multi getvals.lsp is available in download area. (if (not AH:Butts)(load "Multi Radio buttons.lsp")) (if (= but nil)(setq but 1)) (setq ans (ah:butts but "V" '("Please choose" "PLine" "Rectangle" "POlygon" "Donut" "Cloud" "Boundary" "Sketch"))) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.