Author Topic: Set lisp to run every time a DWG is opened  (Read 8271 times)

0 Members and 1 Guest are viewing this topic.

hyposmurf

  • Guest
Set lisp to run every time a DWG is opened
« on: August 01, 2006, 07:45:47 AM »
How do I set a lisp to run everytime I open a new drawing?I realise you can set one to run everytime AutoCAD opens, but I mean everytime a new drawing is opened.What Im intending to do is have my own default variables set every time a new drawing is opened, just fed up of the MIRRTEXT varaible etc not set to my requirements.
Do I have to redefine the open command? :-o

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Set lisp to run every time a DWG is opened
« Reply #1 on: August 01, 2006, 08:47:53 AM »
drag&drop your lisp file to the suitecase...
in the appload dialog box..

OR

load your program from your ACAD.lsp file..
but be sure that in your profile to load ACAD.lsp on each dwg.

;-)
Keep smile...

CADmium

  • Newt
  • Posts: 33
Re: Set lisp to run every time a DWG is opened
« Reply #2 on: August 01, 2006, 09:29:23 AM »
IMHO not in the acad.lsp !!!

for this use the load and run command in acaddoc.lsp -File. It will call with every new document. If you don't have a acaddoc.lsp , you can create on in a acad-support-directory
"Bei 99% aller Probleme ist die umfassende Beschreibung des Problems bereits mehr als die Hälfte der Lösung desselben."

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Set lisp to run every time a DWG is opened
« Reply #3 on: August 01, 2006, 09:55:54 AM »
Also, do a test on the drawing name.  If its Drawing?? then run your command,  if its already got a name, dont run it.  I have some example code if you need it
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

CADaver

  • Guest
Re: Set lisp to run every time a DWG is opened
« Reply #4 on: August 01, 2006, 10:01:57 AM »
IMHO not in the acad.lsp !!!
?  Oh? Why not?

CADaver

  • Guest
Re: Set lisp to run every time a DWG is opened
« Reply #5 on: August 01, 2006, 10:02:27 AM »
Also, do a test on the drawing name.  If its Drawing?? then run your command,  if its already got a name, dont run it.  I have some example code if you need it
cool, can you post it here??

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Set lisp to run every time a DWG is opened
« Reply #6 on: August 01, 2006, 10:11:36 AM »
Also, do a test on the drawing name.  If its Drawing?? then run your command,  if its already got a name, dont run it.  I have some example code if you need it
cool, can you post it here??

This is what I use:

Code: [Select]
(if (not (wcmatch (getvar 'DWGNAME) "Drawing*.dwg"))
  (progn
   
  )
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

LE

  • Guest
Re: Set lisp to run every time a DWG is opened
« Reply #7 on: August 01, 2006, 10:17:25 AM »
Why not DWGTITLED ?

nivuahc

  • Guest
Re: Set lisp to run every time a DWG is opened
« Reply #8 on: August 01, 2006, 10:24:26 AM »
Why not DWGTITLED ?

That's what I use. :)

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Set lisp to run every time a DWG is opened
« Reply #9 on: August 01, 2006, 10:35:12 AM »
Why not DWGTITLED ?


I'm not sure?  :-D

I like that much better...

Code: [Select]
(if (= (getvar 'dwgtitled) 1)
  (progn

  )
)
« Last Edit: August 01, 2006, 10:37:08 AM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CADaver

  • Guest
Re: Set lisp to run every time a DWG is opened
« Reply #10 on: August 01, 2006, 10:48:01 AM »
I use the same as ronjonp's (getvar 'DWGNAME) phrase, I never really looked at dwgtitled until today.  Cool.   I'm still wondering what CmdrDuh uses, though.  

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Set lisp to run every time a DWG is opened
« Reply #11 on: August 01, 2006, 12:56:39 PM »
I use this on from ACAD.LSP located on network drive

Code: [Select]
(setq cprofile (strcase (getvar "cprofile")))
..
..
..

(if (vl-string-search "Section of profile name" cprofile)
(do this....))

(if (vl-string-search "Section of another one" cprofile)
(do that....))


and some othe loading utilities..

why ??
because to many department here loading to many diffrent programs and utilities that why.   :wink:
« Last Edit: August 01, 2006, 12:58:12 PM by Andrea »
Keep smile...

CADmium

  • Newt
  • Posts: 33
Re: Set lisp to run every time a DWG is opened
« Reply #12 on: August 02, 2006, 02:30:51 AM »
acad.lsp ist the file for make something when acad starts
acaddoc.lsp ist the file for make something when new document starts

i think, both files are not only for fun
"Bei 99% aller Probleme ist die umfassende Beschreibung des Problems bereits mehr als die Hälfte der Lösung desselben."

vladimirzm

  • Guest
Re: Set lisp to run every time a DWG is opened
« Reply #13 on: August 02, 2006, 03:05:31 AM »
from CUI you can load any lisp when new drawig starts: right clic on LISP Archives node > Load Lisp.

Crank

  • Water Moccasin
  • Posts: 1503
Re: Set lisp to run every time a DWG is opened
« Reply #14 on: August 02, 2006, 03:11:35 AM »
I agree with CADnium.

Another option is the .mnl file: That's is also loaded in every drawing.
Vault Professional 2023     +     AEC Collection