My VS.LSP isn't working with AutoCAD 2012
;VS.LSP Viewport Scale
;"viewport scale"
;Returns paperspace scale of current viewport for
;transparent use at prompt for scale in INSERT.
;Works similar to dim style option.
;To use with scale command, run VS first. ;
(defun get_scale ()
(setq cv (getvar "cvport"));get viewport number
(setq cvh (getvar "viewsize")); get viewport height in ms units
(setq ss (ssget "X" (list '(0 . "viewport") (cons 69 cv))))
(setq enlist (entget (ssname SS 0)))
(setq vsize (assoc 41 enlist));get viewport height in ps units
(setq vsize (cdr vsize));get units (setq ps (/ vsize cvh));get paperspace scale
(setq ps (/ 1 ps))
);end defun (defun c:vs () (cond
;then allow xp to run transparently
;if insert is running
((= (getvar "cmdnames") "INSERT")
(get_scale))
((= (getvar "cmdnames") "DDINSERT")
(get_scale))
;or if no command is running
((= (getvar "cmdnames") "")
(get_scale))
;all others get cancelled
(t (progn
(princ "\nRun VS.LSP by itself.")
(princ "\nCan only run transparently with INSERT or DDINSERT command.")
);end progn
); end t
);end cond
);end defun
@kzalec wrote:
My VS.LSP isn't working with AutoCAD 2012
;VS.LSP Viewport Scale
;"viewport scale"
;Returns paperspace scale of current viewport for
;transparent use at prompt for scale in INSERT.
;Works similar to dim style option.
;To use with scale command, run VS first. ;
(defun get_scale ()
(setq cv (getvar "cvport"));get viewport number
(setq cvh (getvar "viewsize")); get viewport height in ms units
(setq ss (ssget "X" (list '(0 . "viewport") (cons 69 cv))))
(setq enlist (entget (ssname SS 0)))
(setq vsize (assoc 41 enlist));get viewport height in ps units
(setq vsize (cdr vsize));get units
(setq ps (/ vsize cvh));get paperspace scale
(setq ps (/ 1 ps))
);end defun
(defun c:vs () (cond
;then allow xp to run transparently
;if insert is running
((= (getvar "cmdnames") "INSERT")
(get_scale))
((= (getvar "cmdnames") "DDINSERT")
(get_scale))
;or if no command is running
((= (getvar "cmdnames") "")
(get_scale))
;all others get cancelled
(t (progn
(princ "\nRun VS.LSP by itself.")
(princ "\nCan only run transparently with INSERT or DDINSERT command.")
);end progn
); end t
);end cond
);end defun
Looks like you are missing a couple of returns in your code.
Once this is fixed, it works fine here.