Author Topic: Command line display  (Read 6153 times)

0 Members and 1 Guest are viewing this topic.

paulmcz

  • Bull Frog
  • Posts: 202
Command line display
« on: November 16, 2005, 06:33:27 PM »
Code: [Select]
(defun sd (/ s a b oecho)
  (setq oecho (getvar "cmdecho"))
  (setq s (entsel))
  (if s
    (progn
      (setq a (entget (car s)))
      (setq b (cdr (assoc 8 a)))
      (setvar "cmdecho" 0)
      (command "-layer" "s" b "")
      (princ (strcat "\n Current layer = " b)))
    (princ " Nothing selected "))
  (setvar "cmdecho" oecho)
  (princ)
)

Function here works fine but if I make it (defun c:sd........), and user misses the target, the message "Nothing selected" displays only on third line (from the bottom) on Command line window. When user doesn't miss the target, the text "Current layer..." displays on second line. If the user has only 2 text lines visible, the text "Nothing selected" will not display. It's only in 2000+++. It works fine in R14.
How can this be controlled?

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Command line display
« Reply #1 on: November 16, 2005, 06:47:14 PM »
Try this:

(defun sd (/ s a b oecho)
  (setq oecho (getvar "cmdecho"))
  (setq s (entsel))
  (if s
    (progn
      (setq a (entget (car s)))
      (setq b (cdr (assoc 8 a)))
      (setvar "cmdecho" 0)
      (command "-layer" "s" b "")
      (alert (strcat "\n Current layer = " b)))
    (alert " Nothing selected "))
  (setvar "cmdecho" oecho)
  (princ)
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

paulmcz

  • Bull Frog
  • Posts: 202
Re: Command line display
« Reply #2 on: November 16, 2005, 06:56:40 PM »
The problem is that this user hates all dialog boxes.

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Command line display
« Reply #3 on: November 16, 2005, 06:59:07 PM »
Try this:

Code: [Select]
(defun c:sd (/ s obj oname lay)
  (while
    (= s nil)
     (setq s (car (entsel "\n Pick something: ")))
     (if (= s nil)
       (princ "\n You missed, try again...")
     )
  )
  (setq obj   (vlax-ename->vla-object s)
oname (substr (vla-get-ObjectName Obj) 5)
lay   (vla-get-Layer Obj)
  )
  (vl-cmdf "_-layer" "_set" lay "")
  (princ (strcat "You picked a " oname " to set the current layer to " lay))
(princ)
)
« Last Edit: November 16, 2005, 07:13:48 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Command line display
« Reply #4 on: November 16, 2005, 07:08:01 PM »
I have seen this before.  I use A2K4, and I miss prompts at the end of routines that don't issue a command.  If the user misses with the pick, then no command is issued, but if they hit one, then the layer command is issued.  A cheap work around has been to use command the beginning.
Code: [Select]
(defun c:sd ()

(command "cmdecho" (getvar "cmdecho"))
.. rest of routine

)
or

(defun c:sd()

(command "_.undo" "_end")
(command "_.undo" "_group")
.. rest of routine.

(command "_.undo" "_end")
)

Tim
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

paulmcz

  • Bull Frog
  • Posts: 202
Re: Command line display
« Reply #5 on: November 16, 2005, 07:10:52 PM »
Thanks ronjonp.
I am trying to satisfy someone who wants only 2 lines displayed on his command line window. This works fine while he misses. Once he gets it right, all he can see is Command: Command: on command line.

paulmcz

  • Bull Frog
  • Posts: 202
Re: Command line display
« Reply #6 on: November 16, 2005, 07:22:15 PM »
I have seen this before.  I use A2K4, and I miss prompts at the end of routines that don't issue a command.  If the user misses with the pick, then no command is issued, but if they hit one, then the layer command is issued.  A cheap work around has been to use command the beginning.
Code: [Select]
(defun c:sd ()

(command "cmdecho" (getvar "cmdecho"))
.. rest of routine

)
or

(defun c:sd()

(command "_.undo" "_end")
(command "_.undo" "_group")
.. rest of routine.

(command "_.undo" "_end")
)

Tim

That works Tim. I just added the line
(command "cmdecho" (getvar "cmdecho"))
and that did the trick.
Do you have an idea why?

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Command line display
« Reply #7 on: November 16, 2005, 07:22:43 PM »
Paul,

I just tested the last routine I posted and it works with only 2 command lines.

Is there that much real estate lost when 3 command lines are showing? :roll:

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Command line display
« Reply #8 on: November 16, 2005, 07:29:49 PM »
Do you have an idea why?
Nope.  I just remember seeing the questions asked, and answered the same as I have posted here.  If you preform a google groups search you might find an answer.

Glad it worked for you.
Tim
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

paulmcz

  • Bull Frog
  • Posts: 202
Re: Command line display
« Reply #9 on: November 16, 2005, 07:37:54 PM »
Paul,

I just tested the last routine I posted and it works with only 2 command lines.
Ron


I tested your last routine too Ron, but as I said earlier: Command: Command:

Quote
Is there that much real estate lost when 3 command lines are showing?

Well, apparently?! Some people use only 1 line in the land of no Standards.
Thanks again,

Paul

paulmcz

  • Bull Frog
  • Posts: 202
Re: Command line display
« Reply #10 on: November 16, 2005, 07:40:27 PM »
Do you have an idea why?
Nope. I just remember seeing the questions asked, and answered the same as I have posted here. If you preform a google groups search you might find an answer.

Glad it worked for you.
Tim

I've got to remember this one, like you do.
Thanks Tim.

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Command line display
« Reply #11 on: November 17, 2005, 10:28:16 AM »
Strange......here it is in action on Acad 2005:

These animated gif files are SOOOO cool :)

« Last Edit: November 17, 2005, 10:33:10 AM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Command line display
« Reply #12 on: November 17, 2005, 10:36:06 AM »
That's quite a prompt, "ick something:".

:-D
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Bob Wahr

  • Guest
Re: Command line display
« Reply #13 on: November 17, 2005, 10:47:16 AM »
Must be an architectural drawing.

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Command line display
« Reply #14 on: November 17, 2005, 11:17:42 AM »
Quote
That's quite a prompt, "ick something:".
:pissed:

 :-D

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Command line display
« Reply #15 on: November 17, 2005, 09:55:56 PM »
Hi all,

I'm trying to understand what is the difference between your routine..and  "_ai_molc"

if was the selection...

you can make this..

(defun c:sd (/ s a b oecho)
  (setq   oecho (getvar "cmdecho"))
  (setq s (entsel))
  (if s
    (progn
      (setq a (entget (car s)))
      (setq b (cdr (assoc 8 a)))
      (setvar "cmdecho" 0)
      (command "-layer" "s" b "")
      (princ (strcat "\n Current layer = " b)))
    (c:sd))
  (setvar "cmdecho" oecho)
  (princ)
)

also...ronjonp...how do you make your animated gif ?
Keep smile...

paulmcz

  • Bull Frog
  • Posts: 202
Re: Command line display
« Reply #16 on: November 17, 2005, 11:11:02 PM »
Andrea, there is nothing to understand here. There is no difference between the two. The only thing is that I didn't find the way to call "_ai_molc" command from within the lisp routine. It always tells me "Unknown command" but when I type "ai_molc" on command line, AutoCAD remembers it as built-in command.

Your trick (c:sd) replacing "Nothing selected" prompt works well too. Thanks.

Paul.


Dave R

  • Guest
Re: Command line display
« Reply #17 on: November 18, 2005, 08:34:28 AM »
You can call _ai_molc from Lisp by issuing:

Code: [Select]
(C:ai_molc)
Andrea, there is nothing to understand here. There is no difference between the two. The only thing is that I didn't find the way to call "_ai_molc" command from within the lisp routine. It always tells me "Unknown command" but when I type "ai_molc" on command line, AutoCAD remembers it as built-in command.

Your trick (c:sd) replacing "Nothing selected" prompt works well too. Thanks.

Paul.



paulmcz

  • Bull Frog
  • Posts: 202
Re: Command line display
« Reply #18 on: November 18, 2005, 08:49:28 AM »
You can call _ai_molc from Lisp by issuing:

Code: [Select]
(C:ai_molc)
Andrea, there is nothing to understand here. There is no difference between the two. The only thing is that I didn't find the way to call "_ai_molc" command from within the lisp routine. It always tells me "Unknown command" but when I type "ai_molc" on command line, AutoCAD remembers it as built-in command.

Your trick (c:sd) replacing "Nothing selected" prompt works well too. Thanks.

Paul.



Very good! I didn't know that.
Thanks Dave.