TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: DanB on October 05, 2011, 04:30:16 PM

Title: Layer Previous
Post by: DanB on October 05, 2011, 04:30:16 PM
Using the following code:
Code: [Select]
  (defun c:lp ()
   (command ".layerp")
  )

Why do I not get the various outputs at the command line, such as "Restored previous layer status." or "*No previous layer status*" that I get if I type "layerp" on the command line? I have other similar shortcuts I have made for ".laycur" and ".laymcur" that still continue to show their respective outputs.

Thanks
Dan
Title: Re: Layer Previous
Post by: alanjt on October 05, 2011, 04:39:35 PM
Check your CMDECHO variable.
Title: Re: Layer Previous
Post by: Ketxu on October 05, 2011, 11:04:14 PM
Check your CMDECHO variable.
Right, Set it's value back to 1 and problem will be solved. If in some of your rountine you set it to 0 at begin, you should re-set it's value at the end
Title: Re: Layer Previous
Post by: huiz on October 06, 2011, 02:35:28 AM
If you just make shortcuts, you also can use aliases wich will fire the command instead of running it inside lisp.
Title: Re: Layer Previous
Post by: irneb on October 06, 2011, 04:30:00 AM
I think we're missing something here. CmdEcho? Are you sure? That's not going to affect the text displayed from inside the LayerP command is it? I thought that would turn on/off the display of issuing the LayerP command onto the command-line.

Now NoMutt may have an influence ... I'd think.

But!  :laugh: I think we're going too far with this. The code tells me there's a nil that will display on the command line. And as people generally make the command-line as small as possible, this probably scrolls the LayerP's message off-screen.

So try modifying your code thus:
Code: [Select]
(defun c:lp ()
  (command "_.LayerP")
  (princ)
)
That should sort out the nil at the end of the "shortcut".
Title: Re: Layer Previous
Post by: DanB on October 06, 2011, 09:03:01 AM
I at one point I did have the (princ) in my code and my cmdecho was in fact set to zero(0). Changing it to one(1) has gotten the desired results.

If anyone cares to share a different approach it is welcome but I have a startup LISP routine that loads my custom routines as well as where I create small codes for my own command aliases. This is how I track my own preference settings and customization.

Thanks for feedback.
Title: Re: Layer Previous
Post by: CAB on October 06, 2011, 03:13:12 PM
FYI

http://forums.cadalyst.com/showthread.php?t=6390