TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: bmossman on January 15, 2007, 01:25:17 PM

Title: Script Layout Reactor Upon Open
Post by: bmossman on January 15, 2007, 01:25:17 PM
Is there a way to have a reactor that will identify the current layout tab upon opening & automatically run a corresponding script file who's name matches the layout name?
Title: Re: Script Layout Reactor Upon Open
Post by: T.Willey on January 15, 2007, 01:37:50 PM
Don't think so since you can't use command calls in reactors, and I don't know of any way to use a script without a call to the 'script' command.  If you can figure out a way to issue the script without the command, then yes.

With that said, you might not need a reactor.  You maybe just want to use the 's:startup'.  You will want to use this as it fires after Acad loads all it's stuff, that way you can use a command in the call backs.  All you need to do is test the variable 'ctab' and then issue the right script call.  I don't use the 's:startup' so I'm not sure how one would go about using it, but I have seen this stated as a way to do stuff like this.
Title: Re: Script Layout Reactor Upon Open
Post by: CAB on January 15, 2007, 01:50:09 PM
Reading material.
http://www.theswamp.org/index.php?topic=5282.0
Title: Re: Script Layout Reactor Upon Open
Post by: Keith™ on January 15, 2007, 01:53:29 PM
Sure .. but it doesn't really need to be a reactor ...

Write a lisp that executes the script as needed when you run it. Make it fully functional.
Load it in every drawing when the drawing opens by placing it in the acad.lsp or acaddoc.lsp and call it there
Title: Re: Script Layout Reactor Upon Open
Post by: bmossman on January 15, 2007, 08:57:48 PM
Sure .. but it doesn't really need to be a reactor ...

Write a lisp that executes the script as needed when you run it. Make it fully functional.
Load it in every drawing when the drawing opens by placing it in the acad.lsp or acaddoc.lsp and call it there

Thanks for the tip!
Title: Re: Script Layout Reactor Upon Open
Post by: HofCAD on January 16, 2007, 09:11:32 AM
Write a lisp that executes the script as needed when you run it. Make it fully functional.
Then You can load AutoLISP files into a CUI file using the Customize tab of the Customize
User Interface editor.
It is loaded it in every drawing when the drawing opens.

HofCAD CSI
Title: Re: Script Layout Reactor Upon Open
Post by: GDF on April 21, 2018, 10:54:43 AM
This what I got to work:
 (strcat (getvar "dwgprefix") (getvar "ctab"))

Code: [Select]
(defun C:PMPDF  ()
  (command
    ".-plot"
    "Y"
    (getvar "ctab")
    "DWG To PDF.pc3"
    "Arch full bleed D (36.00 x 24.00 Inches)"
    "Inches"
    "Landscape"
    "N"
    "layout"
    "1:1"
    ""
    "Y"
    "PM (FULL SIZE).CTB"
    "Y"
    "Y"
    "N"
    "N"
    (strcat (getvar "dwgprefix") (getvar "ctab"))
    "N"
    "Y")
  (princ))