Author Topic: configuring ezscript  (Read 4453 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
configuring ezscript
« on: November 02, 2004, 12:04:00 PM »
i started a topic trying to figure out how to batch plot. well i figured out that i could use go plot but the only drawback was that i had to create plot files of all the layouts in all drawings i wanted to batch plot first. well what i wound up doing was modifying cab's plottabs routine just for creating plt files of all layouts. now i am trying to run this lisp on 2l drawings the progress dialogue comes up and nothing seems to be happening. so i'm wondering how to configure this thing so it works?

ELOQUINTET

  • Guest
configuring ezscript
« Reply #1 on: November 02, 2004, 12:09:57 PM »
cab as mentioned above i modified your routine to plot to file. i just tried it and although the plot to file box is checked on the dialogue it still printed. can you skim through this and tell me what i missed thanks


Code: [Select]
;;;
;;;            Plt.lsp
;;;      Created by C. Alan Butler
;;;        Version 1  12/04/2003
;;;        Version 1.01 12/17/2003 Bug repairs
;;;  Requires PlotTabs.dcl file to run
;;;  Routine to plot paperspace tabs
;;;  Pick Page Set Up to use
;;;  Sort by Alpha, Numeric, or Tab order
;;;  Reverse sort order
;;;  Ignore Tabs with flag character
;;;  Enter quantity of copies
;;;  Option to collate
;;;  Enter PLotTabs to run from the command line
;;;
;;;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
;;;   WARRANTY.  ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
;;;   PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
;;;
;;; ---------------------------------------------------------------------------
(defun c:plt (/    plo_list      plo_layout
         config-list    Plot-config   Plot-order
         Plot-qty    order-list    order#
         config#    RevOrder
        )

  ;; ---------------------------------------------------------------------------
  ;; Function: init_vars
  ;; Purpose : Sets up variables prior to invoking dialogue box.
  ;; ---------------------------------------------------------------------------

  (defun init_vars ()
    (if   (not Plot-Config)
      (setq Plot-Config "Current")
    )
    (if   (not Plot-QTY)
      (setq Plot-QTY 1)
    )
    (if   (not Plot-order)
      (setq Plot-order "Tab")
    )

    (setq config-list (Plot_config_list) ;get list of page setups
     RevOrder    nil ; Reverse the order
     Quantity    Plot-QTY ; number of sets
     SaveLayout  T
     CollateSets T
     ExcludeTab  T ; Flag to exclude tabs
     ExcludeChr  "~" ; Character marker for exclude tabs
     PlotToFile  F
    ) ;_ end of setq
    (if   (and Plot-config (member Plot-config PlotConfigs))
      (setq config#
        (-   (length config-list)
      (length (member Plot-Config config-list))
        ) ;_ end of -
      ) ;_ end of setq
      (setq config# 0)
    ) ;_ end of if
  ) ; end defun init_vars

  ;; ---------------------------------------------------------------------------
  ;; Function: init_tiles
  ;; Purpose : Sets up dialogue box tiles prior to invoking dialogue box.
  ;; ---------------------------------------------------------------------------

  (defun init_tiles ()
    (setq yes "1")
    (action_tile "accept" "(call_ok)")
    (start_list "PlotConfigs")
    (foreach one config-list
      (add_list one)
    ) ;_ end of foreach
    (end_list)
    (set_tile "PlotConfigs" (itoa config#))
    (action_tile "SaveLayout" "(setq SaveLayout (= $value \"1\"))")
    (action_tile "rb1" "(setq Plot-order \"Alpha\")")
    (action_tile "rb2" "(setq Plot-order \"Numeric\")")
    (action_tile "rb3" "(setq Plot-order \"Tab\")")
    (action_tile "reverse" "(setq RevOrder (= $value \"1\"))")
    (action_tile "quantity" "(QuanCtrl)")
    (action_tile "CollateSets" "(setq CollateSets (= $value \"1\"))")
    (action_tile "ExcludeTab"  "(ExTab)")
    (set_tile "ExcludeChr" ExcludeChr)
    (action_tile "ExcludeChr" "(setq ExcludeChr $value)")
    (action_tile "PlotToFile" "(setq PlotToFile (= $value \"1\"))")
  ) ; End init_tiles

  (defun ExTab() ; enable/disable flag character input
    (setq ExcludeTab (if(= (get_tile "ExcludeTab")"0")T nil)); get current value
    (if ExcludeTab
      (mode_tile "ExcludeChr" 1);enabled
      (mode_tile "ExcludeChr" 0);disabled
    )
  ) ; end defun ExTab
  (defun QuanCtrl()
    (if   (> (setq quantity (atoi (get_tile "quantity"))) 1)
      (mode_tile "CollateSets" 0);enabled
      (mode_tile "CollateSets" 1);disabled
     )
  )

  ;; ---------------------------------------------------------------------------
  ;; Function: call_ok
  ;; Purpose : Callback function for OK button. Ensures a quantity greater than
  ;;           0 and a device other than "None".
  ;; ---------------------------------------------------------------------------

  (defun call_ok ()
    (if   (> (setq quantity (atoi (get_tile "quantity"))) 0)
      (progn
   (setq
     config#     (atoi (get_tile "PlotConfigs"))
     Plot-cfg    (nth config# config-list)
     Plot-QTY    quantity
   ) ;_ end of setq
   (done_dialog 1)
      ) ;_ end of progn
      (set_tile "error" "Quantity must be 1 or more")
    ) ;_ end of if
  ) ; End call_ok



  ;; ---------------------------------------------------------------------------
  ;; Function: Plot_Config_list
  ;; Purpose : Returns list of strings of all user page set ups.
  ;; Local   : curdwg:   current drawing object
  ;;           pslayout: paper space layout object
  ;; ---------------------------------------------------------------------------

  (defun Plot_config_list (/ curdwg pslayout names x)
    (vl-load-com)
    (setq
      curdwg   (vla-get-ActiveDocument (vlax-get-Acad-Object))
      DwgName  (vl-string-right-trim ".dwg" (vla-get-fullname curdwg))
      pslayout (vla-get-Layout (vla-get-PaperSpace curdwg))
    ) ;_ end of setq
     ; Call RefreshPlotDeviceInfo before GetPlotDeviceNames
    (vla-RefreshPlotDeviceInfo pslayout)
    (cons '"Current" ; add Current as a choice
     (reverse
       (vlax-for x   (vla-get-Plotconfigurations curdwg)
         (setq names (cons (vla-get-name x) names))
       ) ;_ end of vlax-for
     ) ;_ end of reverse
    ) ;_ end of cons
  ) ; End Plot_config_list


  ;; ---------------------------------------------------------------------------
  ;; Function: plot_tab
  ;; Purpose : plot one lauout tab
  ;; Params  : tab:    name of the layout tab to plot
  ;; Local   :
  ;; Returns : nil
  ;; ---------------------------------------------------------------------------

  (defun Plot_Tab (TabToPLot)
    (cond
      ((= TabToPLot "Model")
       nil ; skip Model Space
      ) ; end cond 1
      ((and ExcludeTab (vl-string-search ExcludeChr TabToPLot))
       nil ; skip if ~ in tab name
      ) ; end cond 2
      (T
       (cond
    (PlotToFile
           (command "-Plot"
      "n"
      TabToPLot ; tab name
      (if (= Plot-cfg "Current") "" Plot-cfg); page setup name
      "" ; output device name <current>
      "Y" ; plot to file
      (strcat Dwgname "-" TabToPLot) ;; not used if no plot to file
      (if SaveLayout "Y" "N") ; save page setup to layout
      "Y" ; yes do the plot
           ) ;_ end of command
         ) ; end cond 1
    (T
           (command "-Plot"
      "n"
      TabToPLot ; tab name
      (if (= Plot-cfg "Current") "" Plot-cfg); page setup name
      "" ; output device name <current>
      "N" ; plot to file   <----------------------------------------<<<  Here Dan
      ; File Name not used if no plot to file
      (if SaveLayout "Y" "N") ; save page setup to layout
      "Y" ; yes do the plot
           ) ;_ end of command
     ) ;end cond T
       ) ; end cond    
      ) ; end cond 3
    ) ; end cond
  ) ; end defun


  ;; ---------------------------------------------------------------------------
  ;; Function: num_sort
  ;; Purpose : sort list of strings by the first numbers found in them
  ;; Params  : lst:    list of strings to sort
  ;; Local   :
  ;; Returns : sorted list
  ;; ---------------------------------------------------------------------------

  (defun Num_Sort
    (lst / begin elist end estr n ndx newstring rval strlist)
    (setq numlst (list)) ; empty list
    (foreach one lst
      (setq ndx       1
       rval    nil
       strlist (list)
      ) ;_ end of setq
      (if (/= one nil)
   (repeat   (strlen one)
     (setq strlist (append strlist (list (substr one ndx 1))))
     (setq ndx (1+ ndx))
   ) ;_ end of repeat
      ) ;_ end of if

      (setq begin nil
       end   nil
       ndx   1
      ) ;_ end of setq
      (foreach n strlist
   (cond
     ((and (not begin) (not end))
      (if (/= nil (distof n))
        (setq begin ndx
         rval   n
        ) ;_ end of setq
      ) ;_ end of if
     )
     ((and begin (not end))
      (if (= nil (distof n))
        (setq end ndx)
        (setq rval (strcat rval n))
      ) ;_ end of if
     )
   ) ;_ end of cond
   (setq ndx (1+ ndx))
      ) ;_ end of foreach
      (if (not rval)
   (setq rval "0")
      ) ;_ end of if
      (setq numlst (cons (cons rval one) numlst))
    ) ; end foreach
    (setq lst (vl-sort numlst '(lambda (E1 E2) (< (car E1) (car E2)))))
    (setq lst (mapcar 'cdr lst)) ;remove the numbers
    lst
  ) ; end defun

 
;;; Start C:Plt -----------------------------------------------------------

  (cond
    ((not (findfile (setq dclfile "Plt.dcl")))
     (alert "Cannot find Plt.dcl")
    )
    ((< (setq dcl# (load_dialog dclfile)) 0) ; Error
     (prompt (strcat "\nCannot load " dclfile "."))
    )
    ((not (new_dialog "Plt" dcl#)) ; Error
     (prompt (strcat "\nProblem with " dclfile "."))
    )
    (T ; No DCL problems: fire it up
     (init_vars)
     (init_tiles)
     (setq action (start_dialog))
     (unload_dialog dcl#)
     (if (= action 1) ; Ok to Plot
       (progn
    (setq plo_layouts
      (vla-get-layouts
        (vla-get-activedocument (vlax-get-acad-object))
      ) ;_ end of vla-get-layouts
    ) ;_ end of setq
    (vlax-for plo_layout plo_layouts ; get list of layout tabs
      (if (= Plot-Order "Tab") ; create with TabOrder numbers
        (setq plo_list (cons (cons   (vla-get-TabOrder plo_layout)
               (vla-get-name plo_layout)
              ) ;_ end of cons
              plo_list
             ) ;_ end of cons
        ) ;_ end of setq
        (setq plo_list (cons (vla-get-name plo_layout) plo_list))
      ) ;_ end of if
    ) ;_ end of vlax-for

    (cond
      ((= Plot-Order "Alpha")
       (setq plo_list (vl-sort plo_list '<))
      ) ; end cond 1
      ((= Plot-Order "Numeric")
       (setq plo_list (Num_Sort plo_list))
      ) ; end cond 2
      ((= Plot-Order "Tab")
       (setq plo_list
         (vl-sort plo_list
             '(lambda (E1 E2) (< (car E1) (car E2)))
         ) ;_ end of vl-sort
       ) ;_ end of setq
       (setq plo_list (mapcar 'cdr plo_list)) ;remove the taborder numbers
      ) ; end cond 3
    ) ; end cond

    (if Plot-REV (Reverse plo_list)) ;_ end of if

    (if CollateSets
      (repeat Plot-QTY
        (foreach tab plo_list ; plot one complete set at a time
          (Plot_Tab tab)
        ) ;_ end of foreach
      ) ;_ end of repeat
      (foreach tab   plo_list
        (repeat Plot-QTY ; plot the quantity of each sheet
          (Plot_Tab tab)
        ) ;_ end of repeat
      ) ;_ end of foreach
    ) ; endif
   
    (prompt "\nPlot Sets Complete")
   
       ) ; end progn
       
       ;; ELSE
       (alert "   Plot aborted.")
     ) ;_ end of if
     
    ) ; end cond T
  ) ; end cond
  (princ)
) ; End defun C:plt
(princ)
(prompt "Plt is loaded, Enter PLT to run.")
;;; End C:Plt -----------------------------------------------------------





Code: [Select]
//// -------------------------------------------------------------------------
//// File     : Plt.dcl
//// Author   : Charles Butler
//// Purpose  : Dialogue box definition for Plt command.
//// -------------------------------------------------------------------------


/// --------------------------------------------------------------------------
/// Turn off error checking
/// --------------------------------------------------------------------------

dcl_settings : default_dcl_settings { audit_level = 0; }


/// --------------------------------------------------------------------------
/// This is the main Plt dialogue box.
/// --------------------------------------------------------------------------

Plt : dialog {
  label = "Plt.lsp";
  : text {label = "Plots layouts in current drawing";}
  : text {label = "Page Set Ups  ";}
  : popup_list {
    key = "PlotConfigs";
    edit_width = 35;
    fixed_width = true;
  }
  spacer;
  : row {
  : toggle {
      key = "SaveLayout";
      label = "Save Page Setup to Layout ";
      value = "1";
    }
    }

 : boxed_radio_column { //define boxed radio column
     label = "Order to plot tabs";
   : radio_button { //define radio button
      label = "Alpha"; //give it a label
       key = "rb1"; //give it a name
   }
   : radio_button {
      label = "Numeric";
      key = "rb2";
   }
   : radio_button {
      label = "Tab";
     key = "rb3";
     value = "1"; //make it default  
   }
  }
    : toggle {
      key = "reverse";
      label = "Reverse the order";
    }
  spacer;
  : row{
  : edit_box {
    key = "quantity";
    edit_width=2; edit_limit=2;
      value = "1";
  }
  : text {label = "Quantity of sets";}
  }
    spacer;
  : toggle {
      key = "CollateSets";
      label = "Collate Sets  ";
      value = "1";
      is_enabled = false;
    }
    spacer;
  : toggle {
      key = "ExcludeTab";
      label = "Exclude Tabs with Flag Character";
      value = "1";
    }
   : row {
    : edit_box {
      key = "ExcludeChr";alignment=left;
      edit_width=1; edit_limit=1;}
    : text {label = "Character to Flag Tab";key = "t1";}
   }
  : toggle {
      key = "PlotToFile";
      label = "Plot To File  ";
      value = "1";
   }
  spacer;
  ok_cancel;
  errtile;
}

/// --------------------------------------------------------------------------
/// End Plt.dcl
/// --------------------------------------------------------------------------

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
configuring ezscript
« Reply #2 on: November 02, 2004, 12:28:20 PM »
dan
looks like you still have it set to No Plot To File
Look for the  <----<<  Here Dan
in the code above..

It looks like you are using an old version as well!!
Or did you just clip some of the header?


-Edit-
No you are using an old version.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

hudster

  • Gator
  • Posts: 2848
configuring ezscript
« Reply #3 on: November 02, 2004, 12:37:42 PM »
Open ezscript, and click on the edit menu and select configure.
Set the paths to your AutoCAD exe and Notepad exe files.
Now close the EZscript program completely.
Restart it and it should be ready to go.

Now add the drawings you wish to progress, and the script file you wish to use.
Now click on the file menu  and select save project.
save the file as whatever you want.
now click create EZscript, then click run EZscript.

A progress bar will appear, and EZscript will start AutoCAD.  It will then go through the script routine on each drawing before closing AutoCAD down.

Note that sometimes the progress bar doesn't move or close, but this is a minor bug, everything else should run through as planned.  When the script has finished just click cancel and it will go away.

I hope this helps
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

ELOQUINTET

  • Guest
configuring ezscript
« Reply #4 on: November 02, 2004, 12:54:30 PM »
cab i edited the line as you said

Code: [Select]
     TabToPLot ; tab name
      (if (= Plot-cfg "Current") "" Plot-cfg); page setup name
      "" ; output device name <current>
      "Y" ; plot to file
      (strcat Dwgname "-" TabToPLot) ;; not used if no plot to file
      (if SaveLayout "Y" "N") ; save page setup to layout
      "Y" ; yes do the plot


but it doesn't change anything. i have a question when you say plot to file do you mean for it to create plt files or just a plot.log file. i noticed it used to create a log file . i want to create plt files and run this lisp through ezscript then load the plt files into goplot batch plot utility. can this be acheived with this routine?

ELOQUINTET

  • Guest
configuring ezscript
« Reply #5 on: November 02, 2004, 12:58:19 PM »
hudster what if the files are in 2 different folders what should the path be set to, the main directory? our folder structure is like so:

projects
2002 many job folders with shop drawing folder among others inside each
2003 many job folders with shop drawing folder among others inside each
2004 many job folders with shop drawing folder among others inside each

that's where i'm lost

i'll try it out once i get what i'm lookin for

hudster

  • Gator
  • Posts: 2848
configuring ezscript
« Reply #6 on: November 02, 2004, 02:06:13 PM »
you can add as many folders as you need, just add the files, browse to another folder and add them as well.

I tend to make copies in a temp folder though, but That's just paranoid old me.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

ELOQUINTET

  • Guest
configuring ezscript
« Reply #7 on: November 02, 2004, 02:17:42 PM »
ok i believe i've got ezscript working fixed my cad path. i do have one more question for cab though. cab how would i alter the routine so it essentially clicks ok on the dialogue and just runs without hitting ok?

AVCAD

  • Guest
configuring ezscript
« Reply #8 on: November 05, 2004, 11:48:14 AM »
Code: [Select]

imageframe
off
ltscale
1
-plot
yes
Layout1
HP-750C.PC3
Custom 4: 36 x 48 in.
Inches
Landscape
no
extents
1:1
Center
yes
SMW.CTB
yes
no
no
no
yes

no
yes


Why dont you just use a Script File to do this. And run it through ScriptPRO (free download from Audodesk).

use these SCripts and they work great. I have run it on about 200+ drawings at once with out problems. Only thing is you are useless for the amount of time you PC takes to finish all the drawings.

IN the code you can change the LAYOUT1 option to what ever you name your layouts too. IF you want Multiple layouts printed try this...

Code: [Select]

imageframe
off
ltscale
1
-plot
yes
Layout1
HP-750C.PC3
Custom 4: 36 x 48 in.
Inches
Landscape
no
extents
1:1
Center
yes
SMW.CTB
yes
no
no
no
yes

no
yes

imageframe
off
ltscale
1
-plot
yes
Layout2
HP-750C.PC3
Custom 4: 36 x 48 in.
Inches
Landscape
no
extents
1:1
Center
yes
SMW.CTB
yes
no
no
no
yes

no
yes

imageframe
off
ltscale
1
-plot
yes
Layout3
HP-750C.PC3
Custom 4: 36 x 48 in.
Inches
Landscape
no
extents
1:1
Center
yes
SMW.CTB
yes
no
no
no
yes

no
yes


I havent tested the multiple layouts scripts but if anything you will probably just need to have a blank space after the last yes in each of ploting commands.

Oh, by the way these are for Plot files. The files will show up in what ever directory the drawings that are me ran are in.

IF you have problems with it let me know I will help you out.

ELOQUINTET

  • Guest
configuring ezscript
« Reply #9 on: November 05, 2004, 01:55:40 PM »
thanks avcad but that's not really how i'd like to do it with multiple scripts i mean. i would have to open the drawings to get the names of all the layouts then put that into the script. cab's routine which i modified to create plot files of all layouts is automated. I think I have it setup the way i would like but the problem is our plotter can't spool that much. I think i need to have a meeting with the ITguy and see if we can do some test tweaking so i won't get the error. I'm still working the bugs out. Thanks for your input though i appreciate it.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
configuring ezscript
« Reply #10 on: November 06, 2004, 04:13:53 PM »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

hudster

  • Gator
  • Posts: 2848
configuring ezscript
« Reply #11 on: November 08, 2004, 04:07:45 AM »
eloquintet do you know that EZscript will run lisps on files as well?
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

ELOQUINTET

  • Guest
configuring ezscript
« Reply #12 on: November 08, 2004, 10:49:22 AM »
yeah i know that hudster the plt routine is a lisp routine which plots multiple layouts to file. cab i will check that out later thanks