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
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
@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
@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.