PDA

View Full Version : auto running lisp


PHOTOS4ME
2009-07-31, 08:20 PM
I'm using adt 2004 and have created a lisp to aid in my elevation drawings. For some reason it has decided to run automatically when starting a new drawing. Has anyone else had this problem?

here is the code:

(defun c:test () (Setq oldecho (getvar "cmdecho"))

(Setq oldsnap (getvar "osmode"))

(setvar "cmdecho" 0)

;unloads all unnecessary layers

(command "-layer" "off" "*RP*" "on" "rp*a*" "off" "rp*anno*" "off" "rp*flor*" "")

(command "select" "all" "")

(command "mocoro" "p" "" "0,0" "c" "-240,0" "x" "r" "90" "c" "1200,600" "x" "r" "180" "c" "3000,400" "x" "r" "270" "x")


;uses express tool move/copy/rotate to copy/rotate xrefs for front/left/right/rear elevations


(setq a

(strcase (getstring "\nHeight first floor? (8,9,10): ")); determins which block to insert

);setq

(command "osmode" 0);sets the osnap to none

;explodes the block upon insertion

(cond
((= a "8") (command "-insert" "*el8" "0,0" "1" "0"))
((= a "9") (command "-insert" "*el9" "0,0" "1" "0"))
((= a "10") (command "-insert" "*el10" "0,0" "1" "0"))


);cond

(setvar "osmode" 1);changes to select only endpoints
(princ)


(cond
((= a "8") (setq w (strcase (getstring "\nDoes it have 1 or 2 flrs?(1,2,):"))))
((= a "9") (setq x (strcase (getstring "\nDoes it have 1 or 2 flrs?(1,2,):"))))
((= a "10") (setq y (strcase (getstring "\nDoes it have 1 or 2 flrs?(1,2,):"))))


);cond

(command "-xref" "unload" "*") (command "-xref" "reload" "RP*-2"))

;draws a line representing a predetermined wall heights at operator inputed x-cords

(while (setq pt1 (getpoint "\nSelect corners of the house: ")
x (car pt1)
y -667.125

);setq


(cond
((= w "1") (command "line" (list x y 0) "@115.25<90" ""))
((= w "2") (command "line" (list x y 0) "@225<90" ""))

);cond



(cond

((= x "1") (command "line" (list x y 0) "@127.25<90" ""))
((= x "2") (command "line" (list x y 0) "@237<90" ""))

);cond

(cond
((= y "1") (command "line" (list x y 0) "@139.25<90" ""))
((= y "2") (command "line" (list x y 0) "@249<90" ""))

);cond

(setvar "osmode" oldsnap)

(setvar "cmdecho" oldecho)

);while

);ends
(princ)

;(cond
; ((= w 2) (command "-xref" "unload" "*") (command "-xref" "reload" "*-3"))
; ((= x 2) (command "-xref" "unload" "*") (command "-xref" "reload" "*-3"))
; ((= y 1) (command "-xref" "unload" "*") (command "-xref" "reload" "*-3"))
;);cond

rkmcswain
2009-07-31, 08:28 PM
The "test" function must have been added to your "acaddoc.lsp" or xxx.MNL (where "xxx" is a menu that gets loaded)

PHOTOS4ME
2009-07-31, 08:57 PM
i've even tried renaming the file and changing the lisp command and it wants to run even when you first load it into acad.

RobertB
2009-07-31, 09:21 PM
Load your code in the VLIDE and check your parens. You have mismatched parens.