I have a simple lisp routine that has worked in previous versions of auto cad and will not work in 2014. It is a leader with a connect to existing block at the end. I am not a cad manager and have limited experience with .lsp. This issue is occurring with other blocks combined with leaders in our lisp routines, such as plan notes. All of our nearly 800 plus routines have been written by former employees over the past 15 years and are designed to what they needed at the time. To allow so many routines they have been separated into mechanical disciplines, electrical disciplines and plumbing disciplines with each one interacting with other routines. I have been blessed with the task of cleaning this mess up. You can see some of what i'm talking about in the following lisp. My error occurs after the line prompt, where the block would insert. I have attached the block that is inserted. Any help is appreciated.
;;;; new to existing symbol
;*******************************************************
; MECH & PLUM
(DEFUN NEW2EXIST (/ PT1 PT2 PT3)
(C:DEFUNBEGIN)
(SETQ TCNT NIL)
(SETVAR "orthomode" 0)
(SETVAR "osmode" 512)
;;(SETVAR "DIMSCALE" 1)
(GETLAYER DISC "TXT")
(SETQ PT1 (GETPOINT "\nSTART OF LEADER: "))
(SETQ PT2 (GETPOINT PT1 "\nEND OF LEADER: "))
(SETQ PT3 (POLAR PT2 (ANGLE PT1 PT2) (* 0.09375 SC)))
(COMMAND "QLEADER" PT1 PT2 "")
(COMMAND "INSERT" "L-CTEX" PT3 SC SC 0)
(MODER)
)
;*******************************************************
; ELEC
(DEFUN E_NEW_2_EXIST (LAY1 AIALAY / PT1 PT2 PT3)
(C:DEFUNBEGIN)
(SETQ TCNT NIL)
(SETVAR "orthomode" 0)
(SETVAR "osmode" 512)
;;(SETVAR "DIMSCALE" 1)
;(IF (= TEAM "Comm")
(GETLAYER DISC LAY1)
;(AIA_GetLay DISC AIALAY)
😉
(SETQ PT1 (GETPOINT "\nSTART OF LEADER: "))
(SETQ PT2 (GETPOINT PT1 "\nEND OF LEADER: "))
(SETQ PT3 (POLAR PT2 (ANGLE PT1 PT2) (* 0.09375 SC)))
(COMMAND "QLEADER" PT1 PT2 "")
(COMMAND "INSERT" "L-CTEX" PT3 SC SC 0)
(MODER)
)
Has L-CTEX.dwg been inserted as part of your 2014 drawing template(s), or at least able to be found within SFSP?
"How we think determines what we do, and what we do determines what we get."
I'm guessing you're missing something that defined the SC variable, presumably something like:
(setq SC (getvar 'dimscale))
or possibly some multiple of that, or something. SC is called for several times here, but not set, at least not within what you posted. It may have been a line in your acaddoc.lsp file before but isn't there in your 2014 installation [yet].
You didn't post all of the dependent sub-functions called in your original code in the OP, so this is the best I could slap together, but is working on my end:
(defun c:FOO (/ *error* orthomode osmode pt1 pt2 cmdecho sc) (defun *error* (msg) (and orthomode (setvar 'orthomode orthomode)) (and osmode (setvar 'osmode osmode)) (and cmdecho (setvar 'cmdecho cmdecho)) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it ) (princ) ) (if (and (setq orthomode (getvar 'orthomode)) (setvar 'orthomode 0) (setq osmode (getvar 'osmode)) (setvar 'osmode 512) (setq pt1 (getpoint "\nSpecify start of leader: ")) (not (initget 32)) (setq pt2 (getpoint pt1 "\nSpecify end of leader: ")) (setq cmdecho (getvar 'cmdecho)) (setvar 'cmdecho 0) (setq sc (getvar 'cannoscalevalue)) ) (command "._undo" "_e" "._undo" "_be" "._qleader" pt1 pt2 "" "._-insert" "L-CTEX" (polar pt2 (angle pt1 pt2) (* 0.09375 sc)) sc sc 0. "._undo" "_e" ) ) (*error* nil) )
"How we think determines what we do, and what we do determines what we get."
I tried the lisp you provided and im still having issues. I'm missing something on my end. I will continue to plug away at it tomorrow. Thanks for the help.
@dirty98 wrote:I tried the lisp you provided and im still having issues. I'm missing something on my end. I will continue to plug away at it tomorrow. Thanks for the help.
No worries; be mindful that I intentionally left out some of your sub-function calls (as you did not post the code for those above), in order to avoid an error on my end.
I can write a code snippet that includes them, if you're not sure how to do that? We will just not be able to test without your additional code.
Cheers
"How we think determines what we do, and what we do determines what we get."