Cat 发表于 2022-7-7 00:18:09

Macro, Script or Lisp?

What would be the best way to have the following occur automatically when you open a drawing?
Grid on, set to .125
Snap on, set to .0625
Ortho and Osnap off
 
I'm familiar with "old fashioned" line by line scripts, but that's about it........sad I know.

ReMark 发表于 2022-7-7 00:25:27

One could ask why aren't these set as a part of your template?
Would you ever be toggling all these on/off enmasse during a drawing session?

Cat 发表于 2022-7-7 00:35:48

 
Actually Remark, these are the "personal" working preferences of my supervisor and I'm trying to eliminate some of the stress in her life. It drives her crazy when she works behind someone who uses other preferences.

ReMark 发表于 2022-7-7 00:38:41

For your boss I'd recommend a macro assigned to a button.It will give her an alternate button to push instead of yours.

SLW210 发表于 2022-7-7 00:47:02

You could set that up in the ACADDOC.LSP
 
Search around on CADTutor for tips on modifying the ACADDOC.LSP and creating custom macro for a button.

Cat 发表于 2022-7-7 00:53:30

Thanks for the input. I searched the net a bit yesterday and I think modifying the acaddoc.lsp is probably the way to go. I could write a script for her to run across the project before she started working on the drawings, but she would prefer not to have to do anything other than open the drawing.

SLW210 发表于 2022-7-7 00:57:13

 
There are plenty of examples on CADTutor for modifying the ACADDOC.LSP, just remember to save your original with another name, I usually go with acaddocoriginal.lsp.

alanjt 发表于 2022-7-7 01:03:24

One could do things a lot simpler, but this is what I run at startup...
 

(defun AlanIfCheck (/) (if (eq (strcase (getvar "loginname")) "ATHOMPSON")   (progn   (foreach var            '(("fullplotpath" 0)                ("dtexted" 0)                ("inputhistorymode" 0)                ("vtenable" 0)                ("insunits" 0)                ("osnaphatch" 0)                ("traynotify" 0)                ("mtextfixed" 0)                ("cursorsize" 100)                ("cecolor" "bylayer")                ("celtscale" 1)                ("celtype" "bylayer")                ("gripsize" 6)                ("pickbox" 5)                ("aperture" 20)                ("peditaccept" 1)                ("BLIPMODE" 0)                ("CMDECHO" 0)                ("FILEDIA" 1)                ("MIRRTEXT" 0)                ("PLINEGEN" 1)                ("UCSICON" 1)                ("mtextfixed" 0)                ("mtexted" "internal")                ("mtjigstring" "ajt :-)")                ("attreq" 1)                ("dynmode" -2)                ("lockui" 3)                ("shortcutmenu" 18)                ("osnapz" 1)                ("xreftype" 1)                ("layernotify" 4)                ;; ("savetime" 15)                ("selectionarea" 0)                ("autosnap" 63) ; 55)                ("snapmode" 0)                ("gridmode" 0)                ("expert" 0)                ("dimassoc" 2)                ("edgemode" 1)                ("SELECTIONANNODISPLAY" 0)                ("MTEXTTOOLBAR" 1)                ("modemacro"               "$(getvar,clayer)($(edtime, $(getvar,date),H:MMam/pm) - $(edtime,$(getvar,date),M.DD.YY))Textsize: $(getvar,textsize) $(if, $(!=, $(getvar,viewtwist), 0), Viewtwist: $(angtos, $(getvar,viewtwist) [, 0, 2]) , ) AnnoScale: $(getvar,cannoscale)Dimscale: $(getvar,dimscale) $(if, $(!=, $(getvar,filletrad), 0), FilletRad: $(getvar,filletrad), ) $(if, $(=, $(getvar,worlducs), 1),*WCS* ,*NON-WCS*) "                )               )       (vl-catch-all-apply (function setvar) var)   )   (command "_.wipeout" "_f" "_off")   (command "_.sheetsethide")   (princ (strcat "\nHey " (getvar "loginname") " you are all setup!"))   )   (alert "Who the hell are you?") ) (princ))

Cat 发表于 2022-7-7 01:06:52

:lol::lol::lol::lol:
I'm a not lisp guru, but even I've read enough to know what
 
does.
 
You just made my day.

ReMark 发表于 2022-7-7 01:13:54

Who are you, who, who, who, who.
 
Now that the song is stuck in my head I'll just have to load up my Who - Live at Leeds CD and blast away!
页: [1] 2
查看完整版本: Macro, Script or Lisp?