PDA

View Full Version : LISP Problem


csorensen
2008-11-26, 05:42 PM
Can somebody help me? I'm trying to write a lisp to reset some of the variables that occasionally get "changed" back to our company standards. Then adding it to the toolbar. But I can't seem to get it to change the variables back except for MTEXTED. Anybody's help will be greatly appreciate as I don't even know enough about LISP to be dangerous.

tedg
2008-11-26, 05:54 PM
Can somebody help me? I'm trying to write a lisp to reset some of the variables that occasionally get "changed" back to our company standards. Then adding it to the toolbar. But I can't seem to get it to change the variables back except for MTEXTED. Anybody's help will be greatly appreciate as I don't even know enough about LISP to be dangerous.
Just off the top of my head, a routine to change or reset variables looks something like this:

(DEFUN C:MYSETVARS ()
(SETVAR "OSMODE" 703)
(SETVAR "REGENMODE" 1)
(SETVAR "GRIDMODE" 0)
(SETVAR "SNAPMODE" 0)
(SETVAR "LIMCHECK" 0)
(SETVAR "BLIPMODE" 0)
(SETVAR "PLINEGEN" 1)
(SETVAR "UCSICON" 1)
(SETVAR "MIRRTEXT" 0)
(SETVAR "BINDTYPE" 1)
(SETVAR "DIMASSOC" 2)
(SETVAR "VISRETAIN" 1)
(SETVAR "FILEDIA" 1)
(SETVAR "ATTDIA" 1)
(SETVAR "ATTREQ" 1)
(SETVAR "INSBASE" (list 0.0 0.0 0.0))
(SETVAR "HPASSOC" 1)
(SETVAR "SAVETIME" 15)
)
(PRINC)
Variables can get reset when opening each drawing too.
You may want to do a "search" in these forums for Acad.lsp and Acaddoc.lsp too.

csorensen
2008-11-26, 06:24 PM
I meant to attach what I had.

(DEFUN C:VARSET ()
(SETVAR "ATTDIA" 1)
(SETVAR "DIMFRAC" 0)
(SETVAR "DTEXTED" 1)
(SETVAR "FILEDIA" 1)
(SETVAR "HIGHLIGHT" 1)
(SETVAR "MBUTTONPAN" 0)
(SETVAR "REMEMBERFOLDERS" 0)
(SETVAR "SELECTIONAREA" 0)
(SETVAR "TRAYNOTIFY" 1)
(SETVAR "UCSDETECT" 0)
(SETVAR "ZOOMFACTOR" 90)
(SETVAR "PICKADD" 1)
(SETVAR "LUNITS" 4)
(COMMAND "MTEXTED" INTERNAL)
(PRINC)
)

tedg
2008-11-26, 07:09 PM
It worked for me, however I'm using ADT 2006, so "UCSDETECT" doesn't seem to be a variable I have, so I disabled it to test it.
One other thing, you need to add " " to your MTEXTED variable because acad doesn't recognize it as a standard variable= "INTERNAL".
See my comments in RED

(DEFUN C:VARSET ()
(SETVAR "ATTDIA" 1)
(SETVAR "DIMFRAC" 0)
(SETVAR "DTEXTED" 1)
(SETVAR "FILEDIA" 1)
(SETVAR "HIGHLIGHT" 1)
(SETVAR "MBUTTONPAN" 0)
(SETVAR "REMEMBERFOLDERS" 0)
(SETVAR "SELECTIONAREA" 0)
(SETVAR "TRAYNOTIFY" 1)
;;(SETVAR "UCSDETECT" 0) <= I don't know about this one ?
(SETVAR "ZOOMFACTOR" 90)
(SETVAR "PICKADD" 1)
(SETVAR "LUNITS" 4)
(COMMAND "MTEXTED" "INTERNAL")
(PRINC)
)

csorensen
2008-11-26, 08:14 PM
I figured it out. It happened to be my macro that I had for that button on my toolbar.