Autolisp routine won't work in AutoCAD 2016

Autolisp routine won't work in AutoCAD 2016

Anonymous
Not applicable
759 Views
3 Replies
Message 1 of 4

Autolisp routine won't work in AutoCAD 2016

Anonymous
Not applicable

I've been using a very helpful viewport scaling AutoLisp routine for years.  I like it better than any that AutoCAD has built into the software.  It was written by Ed Jobe.  It worked for version 2014, but no longer works in 2016.  I'm guessing there may be a conflict with new keyboard shortcuts or command names.  If anyone can get this working for 2016, I'd sincerely appreciate it.  The original file is attached, but I've copied the code below as well.  Thanks in advance.

 

;Tip1603:  VS.LSP        Viewport Scale         (c)2000, Ed Jobe

;"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.
;
;Changed command name to avoid conflict with XPlode, Ed Jobe 11/6/97
;
(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

0 Likes
Accepted solutions (1)
760 Views
3 Replies
Replies (3)
Message 2 of 4

hmsilva
Mentor
Mentor

@Anonymous wrote:

I've been using a very helpful viewport scaling AutoLisp routine for years.  I like it better than any that AutoCAD has built into the software.  It was written by Ed Jobe.  It worked for version 2014, but no longer works in 2016.  I'm guessing there may be a conflict with new keyboard shortcuts or command names.  If anyone can get this working for 2016, I'd sincerely appreciate it.  The original file is attached, but I've copied the code below as well.  Thanks in advance.

 

...


Hi karinzCGSPZ,

if you load the code with appload command, don't the code works as expected?

I did try the code in AC2016, and I have not found any conflict with AutoCAD...

 

Henrique

EESignature

0 Likes
Message 3 of 4

Anonymous
Not applicable
Accepted solution
It does work. I just didn't have the upper part of the command toolbar expanded enough to read the results! It appears that this must be expanded more in the latest version of AutoCAD. Thanks so much. I love this routine.

Karin
0 Likes
Message 4 of 4

hmsilva
Mentor
Mentor

@Anonymous wrote:
It does work. I just didn't have the upper part of the command toolbar expanded enough to read the results! It appears that this must be expanded more in the latest version of AutoCAD. Thanks so much. I love this routine.

Karin

You're welcome, Karin!
I'm glad to hear that you got it working.

Henrique

EESignature

0 Likes