Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

command "layer"

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
m.pepin
510 Views, 3 Replies

command "layer"

I got a routine with than line of code in it: (command "layer" "N" "1" "T" "1" "S" "1" "") which make a layer named 1 and set it current. In AutoCAD 2004 the routine works but in AutoCAD 2011 it does make layer 1 but it doesn't make current. When I paste the line of code in the command line it works but not in my routine??

Any ideas.

Thanks

3 REPLIES 3
Message 2 of 4
hmsilva
in reply to: m.pepin


@m.pepin wrote:

I got a routine with than line of code in it: (command "layer" "N" "1" "T" "1" "S" "1" "") which make a layer named 1 and set it current. In AutoCAD 2004 the routine works but in AutoCAD 2011 it does make layer 1 but it doesn't make current. When I paste the line of code in the command line it works but not in my routine??


No AutoCAD in this laptop... so, untested

(initcommandversion)
(command "layer" "N" "1" "T" "1" "S" "1" "")

HTH

Henrique

EESignature

Message 3 of 4
rkmcswain
in reply to: m.pepin

FWIW - it works here in 2013, both ways.
R.K. McSwain     | CADpanacea | on twitter
Message 4 of 4
Kent1Cooper
in reply to: m.pepin


@m.pepin wrote:

I got a routine with than line of code in it: (command "layer" "N" "1" "T" "1" "S" "1" "") which make a layer named 1 and set it current. In AutoCAD 2004 the routine works but in AutoCAD 2011 it does make layer 1 but it doesn't make current. ....


I couldn't say [older version here] whether this by itself would get around the issue, but even if it still requires that (initcommandversion) function first, you can also try:

 

(command ".layer" "T" "1" "M" "1" "")

 

The Make option sets it current in the process, so you don't need to use the Set option.  And Thawing it first covers the possibility that it already exists but is frozen, since if that's the case, Make won't be able to set it current.  The Thaw option won't care if it doesn't exist yet, and the Make option won't care if it does exist already.

Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost