TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Coder on September 24, 2019, 10:37:49 AM

Title: initget with ssget
Post by: Coder on September 24, 2019, 10:37:49 AM
Hello guys.

I would like to have a dialog box with my routine but the program uses ssget function at the start up.

I know that I can have the dialog appears every time I run the program but I do prefer to call the dialog once required only.

Code: [Select]
(initget "Dialog")
(setq ss (ssget '((0 . "INSERT")))) ;; type D then show the dialog but this does not work.

Thank you in advance.
Title: Re: initget with ssget
Post by: tombu on September 24, 2019, 11:23:36 AM
You need to post the whole code for anyone to debug it. You didn't even show a "getkword" call, how were you expecting a dialog box to pop up?
Title: Re: initget with ssget
Post by: Coder on September 24, 2019, 11:27:33 AM
No codes yet but I am trying to use the same concept of the command SETBYLAYER although I don't think the getkword function works in this example and I could be wrong.

Thank you.
Title: Re: initget with ssget
Post by: roy_043 on September 24, 2019, 01:05:12 PM
Initget works with a number of get* functions (not just with getkword) and the entsel, nentsel and nentselp functions. But not with ssget.
Title: Re: initget with ssget
Post by: Coder on September 24, 2019, 01:09:40 PM
Initget works with a number of get* functions (not just with getkword) and the entsel, nentsel and nentselp functions. But not with ssget.
Yes, you are right.
I wonder how does the command SETBYLAYER work with ssget !  :reallysad:
Title: Re: initget with ssget
Post by: Lee Mac on September 24, 2019, 04:43:07 PM
As Roy has correctly stated, ssget does not support custom keywords defined by initget, as it already offers a set of keywords representing selection methods. One alternative option is to roll your own selection function (https://www.theswamp.org/index.php?topic=34804) so that you can test for your own defined keywords, or alternatively use a response of ENTER to select a default option and allow the user to exit the selection prompt using ESC (this is the method I opted to use in my Nested Block Counter (http://lee-mac.com/nestedblockcounter.html) program).
Title: Re: initget with ssget
Post by: Coder on September 25, 2019, 04:41:28 AM
Thanks Lee for your kind reply.
Title: Re: initget with ssget
Post by: BIGAL on September 25, 2019, 11:10:54 PM
If you just want say known keywords then something like this could be used.

Code: [Select]
(if (not AH:Butts)(load "Multi Radio buttons.lsp"))
(if (= but nil)(setq but 1))
(setq ans (ah:butts but "V"  '("Pick type " "Insert" "Line" "Arc" "Circle"))) ; ans holds the button picked value
(setq ss (ssget (list (cons 0 ans))))