Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

2014 lsp does not work.

8 REPLIES 8
Reply
Message 1 of 9
dirty98
384 Views, 8 Replies

2014 lsp does not work.

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)
)

 

 

8 REPLIES 8
Message 2 of 9
BlackBox_
in reply to: dirty98

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."

Message 3 of 9
dirty98
in reply to: BlackBox_

The drawing is found within the SFSP.

Message 4 of 9
hmsilva
in reply to: dirty98

Try to set the qleader annotation type to none
Command: qleader -> settings -> annotation type -> none.
Then test your code again...

HTH
Henrique

EESignature

Message 5 of 9
dirty98
in reply to: hmsilva

Good idea, I didn't think of that. However it didn't work.

Message 6 of 9
Kent1Cooper
in reply to: dirty98

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].

Kent Cooper, AIA
Message 7 of 9
BlackBox_
in reply to: dirty98

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."

Message 8 of 9
dirty98
in reply to: BlackBox_

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.

Message 9 of 9
BlackBox_
in reply to: dirty98


@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."

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost