Jump to content
Steven P

LISP to Show a Commands Options

Recommended Posts

Steven P

Good morning, 

Is it possible for a LIPS to grab the prompts for a command and scroll through them as the user enters the inputs?

 

A couple of examples

The LISP recognises that a 'ZOOM' command is to be used and prompts the user "All Center Dynamic Extents Previous Scale Window Object". The user inputs the option and the LISP moves on (all done via a DCL Dialogue box)

 

Second example is more complicated but I guess if LISP can do the first this should be possible?

The LISP recognises that a 'PLOT' command is to be used and prompts the user "Detailed Plot Configuration" [pause for input] then "Enter a layout name" [pause for input] and so on

 

 

I am trying to make up a batch routine LISP (yes, I know there are good ones out there, this is for my own amusement). The user enters each command into a dialogue box text box, and then enters all the required options is the next lines. This bit all works. I am just wanting to add the prompts underneath the text box so the user knows what to enter next, rather than having to remember every option for every command.

 

So is it possible to get a LISP to grab these prompt descriptions for each command and then I can use them.

 

 

Thanks in advance, though I am anticipating the simple "no it isn't possible" answer,

Share this post


Link to post
Share on other sites
BIGAL

Have you tried “pause” in your code.

Share this post


Link to post
Share on other sites
Steven P

I know what you're meaning, but isn't quite what I am after, thanks though

Share this post


Link to post
Share on other sites
Grrr
On 2/5/2019 at 1:42 PM, Steven P said:

Is it possible for a LIPS to grab the prompts for a command

Yes,

On 2/5/2019 at 1:42 PM, Steven P said:

and scroll through them as the user enters the inputs?

No, but

On 2/5/2019 at 1:42 PM, Steven P said:

and scroll through them after the user enters the inputs?

Yes.

The technique to achieve the above involves the LOGFILEMODE and the LOGFILENAME variables, and perhaps some REGEX to check for the amount of options within the square brackets.

Enter an option [Close/Open/Join/Width/Fit/Spline/Decurve/Ltype gen/Reverse/Undo]:

 

Although that answer won't satisfy/work on your desired result, you could initially and manually go through all the command options and store them in a hardcoded hirearchical list.

Usually a mass practice is to obtain the desired options via keyword loops, then just pass them to the command-call. And even better is to avoid any command-calls if possible.

 

Share this post


Link to post
Share on other sites
BIGAL

Not sure but Grr started the idea I made a DCL with buttons but its not hard coded rather you make it on the fly with as many buttons as required, you may be able to use it with a heading like "Zoom options" then it passes the Zoom option via code. It can have more or less buttons. The next version on the big list of to do will be true dynamic for number of buttons only 2 lines of code required.

 


; Input  button Dialog box for left right up down etc 4 choices
; By Alan H May 2018
(vl-load-com)

(defun AH:Butts4 (title1 def1 def2 def3 def4 / fo fname )

(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line  "AHbutts : dialog     {" fo)
(write-line  (strcat "    label =" (chr 34) title1 (chr 34) " ;" )fo)
(write-line "    : row    {" fo)
(write-line "    : boxed_radio_column     {" fo)
(write-line "    : radio_button    {" fo)
(write-line  (strcat "key = "  (chr 34) "rb1" (chr 34) ";") fo)
(write-line  (strcat "label = " (chr 34) def1 (chr 34) ";") fo)
(write-line "    }" fo)
(write-line "    : radio_button    {" fo)
(write-line (strcat "    key = "  (chr 34) "rb2" (chr 34) ";") fo)
(write-line (strcat "    label = "(chr 34)def2 (chr 34) ";") fo)
(write-line "    }" fo)
(write-line "    : radio_button    {" fo)
(write-line (strcat "    key = "  (chr 34) "rb3" (chr 34) ";") fo)
(write-line (strcat "    label = "(chr 34)def3 (chr 34) ";") fo)
(write-line "    }" fo)
(write-line "    : radio_button    {" fo)
(write-line (strcat "    key = "  (chr 34) "rb4" (chr 34) ";") fo)
(write-line (strcat "    label = "(chr 34)def4 (chr 34) ";") fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "    ok_only;" fo)
(write-line "    }" fo)
(close fo)
(setq dcl_id (load_dialog fname))
(if (not (new_dialog "AHbutts" dcl_id) )
(exit)
)
(action_tile "rb1"     "(setq val1  $value)")
(action_tile "rb2"     "(setq val2  $value)")
(action_tile "rb3"     "(setq val3  $value)")
(action_tile "rb4"     "(setq val4  $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
(vl-file-delete fname)
)
; these 2 lines are the calling code in a seperate lisp program
; Check valx for = 1 picked button
;(if (not Ah:Butts4)(load "Radio buttons4"))
;(AH:Butts4 "Choose L U D R" "Left" "Right" "Down" "Up")

Share this post


Link to post
Share on other sites
Steven P

Thanks,

 

Grrr - I just tried logfilemode, I didn't know that existed. I'll have a look at what you suggest and see what I can think of. I have a feeling that I was looking for something similar last year and now I'll have to remember what.

 

Big Al - also thanks - yes I can see where you are going with that, combine it with a list of options for each command as its entered, its an approach I hadn't thought of and could give quite a smart interface (I can see perhaps that instead of just radio buttons, it could vary the input type depending on the commands options, so radio button, text box or drop down list, "Zoom" could give radio buttons "All", "Previous" and so on "Save as" could give a text box "File Name". and so on.). 

 

Now all I need to do is forget you even said any of this until work quietens down next week and I can play again.

Share this post


Link to post
Share on other sites
BIGAL

The idea behind a library function is I have radio buttons and text input as seperate dcl's so the two can call the other. Again the calling code is only 2 lines.

 

lee-mac has a list box dcl.

 

The getvals3.lsp has 1 2 or 3 text input and you pass it the labels. I have done up to getvals8.lsp but are changing to a dynamic version any number of entries.

GETVALS3.lsp

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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