Command line results to Message box

David_Prontnicki
Collaborator
Collaborator

Command line results to Message box

David_Prontnicki
Collaborator
Collaborator

Hi,

 

Is it possible to take the results from a command line command and place them in a message box? For example, the command, LISTAVAILABLEPOINTNUMBERS will display the results in the command line. I would like to take those results and have an alert display them.

 

Thank you

0 Likes
Reply
Accepted solutions (1)
1,320 Views
8 Replies
Replies (8)

Kent1Cooper
Consultant
Consultant

[I assume that's a Civil3D function, since it's not in native AutoCAD.]  Do you know whether it also puts its findings into anything like a variable, from which they could be extracted to put into an (alert) message?

Kent Cooper, AIA
0 Likes

David_Prontnicki
Collaborator
Collaborator

Yes it is a Civil 3D command, and unfortunately no I don't know if it puts its finding into a variable. I have been looking for where the command originates from to see but with no luck.

0 Likes

ВeekeeCZ
Consultant
Consultant
Accepted solution

How about something simple:

 

(defun c:ListAvailablePointNumbers! nil
  (command "ListAvailablePointNumbers")
  (alert (substr (getvar 'LASTPROMPT) 1)) ; change 1 to 26 if you want to show the range only.
  (princ)
)

You may post C3D related questions rather  HERE

David_Prontnicki
Collaborator
Collaborator

BeekeeCZ,

 

Simple is always better. Sometimes you overthink things. 🙂 It seems so obvious now. LOL.

 

Real quick so I understand whats going on:

 

1 - shows the range only

26 - shows nothing

 

Thank you so much!!!!

0 Likes

ВeekeeCZ
Consultant
Consultant

@David_Prontnickiwrote:

 

Real quick so I understand whats going on:

 

1 - shows the range only

26 - shows nothing

 

...

No. At least not to me. This is what is listed to my command-line:

 

Command: LISTAVAILABLEPOINTNUMBERS!
ListAvailablePointNumbers 1-4294967294

Routine then takes a part of the second line starting char number (1 or 26) to the end. So 1 is the whole second line, 26 is just a range. (word "ListAvailabelPointNumbers" has 26 chars or so) 

0 Likes

David_Prontnicki
Collaborator
Collaborator

OK got it. For me the issue is my command line displays like this:

 

Capture.PNG

 

So there is nothing at the 26th char.

 

Thank again!

0 Likes

ВeekeeCZ
Consultant
Consultant

I guess you have 'cmdecho off.

0 Likes

David_Prontnicki
Collaborator
Collaborator

Yes that's what it is. So I added get current cmdecho, set to off, and restore previous. Since I don't know what each person has it set to. That way I can just keep it set to one.

 

Thank you again for all your help.

0 Likes