Thank you for your comments, I appreciate the help.
I can confirm it doesn't change the layer to defpoints. Not sure why. The command works from the command line here, but not in a lisp routine.
What I use in my routines that does work in 2007 is:
(defun setpower ()
(if
(null (tblsearch "layer" "power"))
(command "-layer" "make" "power" "color" "cyan" "power" "")
)
(setvar "clayer" "power")
)
Martin
I've tried that too. In fact, my old routine from 2004 is like that.
Kerry, thank you for the code, although I think you missed one little thing,
Try this ..
(defun c:sk (/ lay-prev ort-prev asn-prev scale scalex)
(setq lay-prev (getvar "clayer")
ort-prev (getvar "orthomode")
asn-prev (getvar "autosnap")
)
(if [color=red](= [/color] (tblsearch "layer" "DEFPOINTS") [color=red]nil)[/color]
; or ; [color=red](NOT [/color](tblsearch "layer" "DEFPOINTS")[color=red])[/color]
(command ".-layer" "thaw" "DEFPOINTS" "on" "DEFPOINTS" "set" "DEFPOINTS" "")
(command ".-layer" "new" "DEFPOINTS" "color" "7" "DEFPOINTS" "")
)
(setq scalex (* (getvar "dimscale") 0.125))
(or (setq scale (getreal (strcat "Scale : " (rtos scalex))))
(setq scale scalex)
)
(setvar "skpoly" 1)
(setvar "orthomode" 0)
(command ".SKETCH" scale)
(setvar "clayer" lay-prev)
(setvar "orthomode" ort-prev)
(setvar "autosnap" asn-prev)
(princ)
)
// kwb
It's all good, but no, that doesn't do the trick.
I don't understand why this is not working. It isn't turning off the ortho, nor setting the layer properly.
I have other routines that use the same commands & variable settings & they don't screw up like this one.
I've searched all over for a possible overwriting of a command SK but I can't find any so I don't think that's the problem. In fact I changed the command to SKT and tstSK, but it didn't do me any good.
I don't know what else to do with this thing.