- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to get the last prompt of options in a PLINE command from the [aptly-named, or I used to think so] LASTPROMPT System Variable. But it seems to return the Next-To-Last prompt instead. To see what I mean, put this into the Command line:
(progn (command "_.pline" pause pause) (setq test (getvar 'lastprompt)) (command ""))
That starts a PLINE command; just pick two points for one line segment. It leaves the Pline command running, and saves the last prompt into the 'test' variable before ending the command. So:
_.pline
Specify start point: {first pause -- pick a point}
Current line-width is 0'-0"
Specify next point or [Arc/Halfwidth/Length/Undo/Width]: {second pause -- pick a point}
{after which pick, the following shows at the Command line:}
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:
{and the LASTPROMPT value is saved to 'test', then the code ends the Pline command}
Command: nil {returned by concluding (command) function}
Now, what's in the 'test' variable?
Command: !test
"Specify next point or [Arc/Halfwidth/Length/Undo/Width]:"
That's the previous prompt, at the time of the second pause, not the current or latest prompt at the point in the command at which LASTPROMPT was saved. The latter is what I want to get [specifically, to see the difference that it now has the Close option within it].
Help for LASTPROMPT says:
This string is identical to the last line seen at the Command prompt and includes any user input.
I suppose that last part means it takes the last prompt which was acted on by the User. I had always thought it was the latest prompt appearing at the Command line [isn't that what "last line seen" should mean?], i.e., if in mid-command at the time like this, the current prompt. But apparently that's not the case -- effectively, it seems to operate as though it's really the Subject line of this thread. [No, that Subject is not what I want to do, but a description of what (getvar 'lastprompt) seems to actually be doing, at least in this particular mid-command circumstance.]
Does anyone know of a way to extract the latest/current prompt in this situation? If not, how about some other way of determining that a second point has been designated in PLINE [i.e. a first segment has been defined]? I'm trying to limit a Polyline to one segment, but I can't just use two pauses as in the example, because I want to allow for options first, such as changing the Width or going into Arc mode. The Close [or when in Arc mode, 2-capitals CLose] option doesn't appear in the main prompt or option sub-prompts until a first segment has been drawn, which is why I was looking to that content in the prompt as the "clue" to proceed to what I want to do next, only after the first segment has been completed.
Solved! Go to Solution.