;Plot in batch using a script file. (commented to aid customization) ; The user specifies the DWG filename search string (wildcards OK). ; ; AUTHOR: Henry C. Francis ; 425 N. ASHE ST. ; Southern Pines, NC 28387 ; All rights reserved without prejudice. ; ; Copyright: 7-20-94 ; Edited: 11-12-95 ; ; ;There is a string in this program that, when properly laid in (lines 263-265) ;,will configure this program for your plotter. Also, be sure the proper LPT ;port is referenced. Unless you use Norton Editor you'll need to substitute ;the call for it with your editor (line 159). Set a 3 character system variable ;called LGN to the users initials. I do this in our novell login script. ;Once these things are done this routine will plot from a single plot to.... ;I have done over 80 before, unattended. I'm sure it will do many more. ;Be sure to cut files into their separate filenames before using. ; (defun C:do_plots ( / fp1 fp2 fp3 fp4 item item1 str01 str1 str2 str3 dfltr fltrl pltfs fstr dostr goplt svqt qtdn whplt plen dwgstr tpltd tmplt) (setvar "cmdecho" 0) (setvar "expert" 1) (setvar "filedia" 0) (setq dwgp (getvar"dwgprefix")) (setq plen (1+ (strlen dwgp))) (setq cdwg (getvar"dwgname")) (setq cdwgl (strlen cdwg)) (setq pfac (ukword 1 "Full Half 5/6" "Full, Half or 5/6 scale (F=FULL, H=HALF, 5/6)" "Full")) (if (getenv "LGN") (setq lognm (getenv "LGN")) (setq lognm "NN") );if (cond ((eq(substr cdwg 2 1)":") (setq slen (+(strlen dwgp)1)) ) ((eq cdwgl 1) (setq slen 1) ) ((eq(substr cdwg(- cdwgl 1)1)"\\") (setq slen cdwgl) ) ((eq cdwgl 2) (setq slen 1) ) ((eq(substr cdwg(- cdwgl 2)1)"\\") (setq slen (- cdwgl 1)) ) ((eq cdwgl 3) (setq slen 1) ) ((eq(substr cdwg(- cdwgl 3)1)"\\") (setq slen (- cdwgl 2)) ) ((eq cdwgl 4) (setq slen 1) ) ((eq(substr cdwg(- cdwgl 4)1)"\\") (setq slen (- cdwgl 3)) ) ((eq cdwgl 5) (setq slen 1) ) ((eq(substr cdwg(- cdwgl 5)1)"\\") (setq slen (- cdwgl 4)) ) ((eq cdwgl 6) (setq slen 1) ) ((eq(substr cdwg(- cdwgl 6)1)"\\") (setq slen (- cdwgl 5)) ) ((eq cdwgl 7) (setq slen 1) ) ((eq(substr cdwg(- cdwgl 7)1)"\\") (setq slen (- cdwgl 6)) ) ((eq cdwgl 8) (setq slen 1) ) ((eq(substr cdwg(- cdwgl 8)1)"\\") (setq slen (- cdwgl 7)) ) ((eq(substr cdwg(- cdwgl 9)1)"\\") (setq slen (- cdwgl 8)) ) ((eq(substr cdwg(- cdwgl 10)1)"\\") (setq slen (- cdwgl 9)) ) ((eq(substr cdwg(- cdwgl 11)1)"\\") (setq slen (- cdwgl 10)) ) ((eq slen nil) (setq slen 1) ) );cond (setq cdwg (strcat (getvar"dwgprefix")(substr cdwg slen))) (setq dfltr (ustr 1 "File Selection String (*,? wildcards OK, no extension) " cdwg nil)) (setq whplt (ukword 1 "Extents Limits Mirrored" "Plot Extents, Limits or Mirrored limits? " "Limits")) (setq fltrl (strlen dfltr)) (cond ((> fltrl 3) (if (eq (substr dfltr (- fltrl 3) 1) ".") (setq dfltr (substr dfltr 1 (- fltrl 4))) );if ) ((> fltrl 2) (if (eq (substr dfltr (- fltrl 2) 1) ".") (setq dfltr (substr dfltr 1 (- fltrl 3))) );if ) ((> fltrl 1) (if (eq (substr dfltr (- fltrl 1) 1) ".") (setq dfltr (substr dfltr 1 (- fltrl 2))) );if ) );cond (if (eq ":" (substr dfltr 2 1)) nil (setq dfltr (strcat (getvar"dwgprefix")dfltr)) );if (setq fstr (strcat dfltr ".DWG")) (if (= cdwg dfltr) (progn (setq tpltd (strcat lognm "JDWG.LST")) (setq tmplt (open tpltd "w")) (setq dwgstr (strcat cdwg ".DWG")) (write-line dwgstr tmplt) (close tmplt) (prompt dwgstr) (setq goplt (ukword 1 "Yes No Edit" "Plot this file or Edit list to plot? (Yes, No or Edit)" "Yes")) );progn (progn ; (cond ;these sort the list by a pos 24 or 16 ; ((> 10 (strlen dwgp)) ; (setq dostr (strcat "dir /b /o /s " fstr " |sort /+24 >" dwgp lognm "jdwg.lst")) ; ) ; ((<= 10 (strlen dwgp)) (setq dostr (strcat "dir /b /o /s " fstr " |sort /+16 >" lognm "jdwg.lst")) ;sorts the list before editing ; ) ; );cond (textscr) (command ".sh" dostr) (command ".sh" (strcat "type " lognm "jdwg.lst|more")) (setq goplt (ukword 1 "Yes No Edit" "Plot these files or Edit list to plot? (Yes, No or Edit)" "Yes")) );progn );if (if (eq (substr goplt 1 1) "E") (progn (setq goplt "Y") (command ".sh" (strcat "ne " lognm "jdwg.lst")) ;replace "ne " with your text editor call or "edit " );progn );if (if (eq (substr goplt 1 1) "Y") (progn (setq svqt (ukword 1 "Yes No" "Do you want to save changes to this drawing? (Yes or No)" "No")) (setq qtdn (ukword 1 "Yes No" "Quit when done plotting? (Yes or No)" "No")) (if (eq (substr svqt 1 1) "Y") (command (c:save)) );if (setq fp1 (open (strcat lognm "JDWG.LST") "r")) (setq fp2 (open (strcat lognm "PLOTJ.SCR") "w")) (setq fp4 (open (strcat lognm "PLOTJ.BAT") "w")) (write-line "@echo off" fp4) (while (setq item (read-line fp1)) (setq iteml (-(strlen item)4)) (setq item1 (substr item 1 (- (strlen item)4))) (setq str0 "OPEN") (setq str01 "Y") (cond ((eq "L" (substr whplt 1 1)) (setq str1 "PLOT W") (setq str2 "(getvar\"limmin\")") (setq str3 "(getvar\"limmax\")")) ((eq "M" (substr whplt 1 1)) (setq str1 "(if c:mirplt c:mirplt(load\"mirplt\"))(c:mirplt) PLOT W") (setq str2 "(getvar\"limmin\")") (setq str3 "(getvar\"limmax\")")) ((eq "E" (substr whplt 1 1)) (setq str1 "ZOOM E") (setq str2 "PLOT") (setq str3 "E")) );cond (if goplt (if (eq item1 cdwg) nil (progn ; (if (or ; (= lognm "HCF") ; (= lognm "DAF") ; (= lognm "JWP") ; (= lognm "JVM") ; (= lognm "PD") ; ) ; (write-line "(xunload\"amo\")" fp2) ;unload third party apps that will interrupt batch ; nil ; );if (write-line str0 fp2) (if (eq (getvar"dbmod") 0) nil (write-line str01 fp2) );if (write-line item1 fp2) );progn );if (progn ; (if (or ; (= lognm "HCF") ; (= lognm "DAF") ; (= lognm "JWP") ; (= lognm "JVM") ; (= lognm "PD") ; ) ; (write-line "(xunload\"amo\")" fp2) ;unload third party apps that will interrupt batch ; nil ; );if (write-line str0 fp2) (write-line str01 fp2) (write-line item1 fp2) );progn );if (write-line str1 fp2) (write-line str2 fp2) (write-line str3 fp2) (if goplt (progn (write-line "Y" fp2) (write-line "Y 2" fp2) (cond ((eq (substr whplt 1 1) "L") (write-line "W" fp2) (write-line str2 fp2) (write-line str3 fp2)) ((eq (substr whplt 1 1) "M") (write-line "W" fp2) (write-line str2 fp2) (write-line str3 fp2)) ((eq (substr whplt 1 1) "E") (write-line "E" fp2) (write-line "Y" fp2)) );cond );progn );if (write-line "Y" fp2) ;The section below must conform to your plotters requirements ;the best way to determine what those are is to issue the plot command via ;AutoLISP at the command prompt, like this; (command ".plot" "extents") ;Then, write down every response you must make to complete the plot. ;Edit the strings below between the double quotes to have only what you just ;wrote down as responses to the plot command. ;!!!!!! LEAVE THE (/ 1(/(getvar\"dimscale\").....)) " IN THE PLACE WHERE ;SCALE IS REQUIRED, NOTICE THE SPACE BEFORE THE CLOSING QUOTE!!!!!! (cond ((= (substr pfac 1 1) "F")(write-line "N N N I MAX 0 N N (/ 1(/(getvar\"dimscale\")1)) " fp2)) ;string for full size ((= (substr pfac 1 1) "H")(write-line "N N N I MAX 0 N N (/ 1(/(getvar\"dimscale\")0.5)) " fp2)) ;string for half size ((= (substr pfac 1 1) "5")(write-line "N N N I MAX 0 N N (/ 1(/(getvar\"dimscale\")0.833334)) " fp2));string for 5/6 size (so 30x42 50scale can plot on 24x36 @ 60scale) );cond (setq goplt nil) (setq ilast item1) );while (if (eq (substr qtdn 1 1) "Y") (write-line "QUIT Y" fp2) (if (eq ilast cdwg) (progn (write-line "(graphscr)" fp2) ; (if (or ; (= lognm "HCF") ; (= lognm "DAF") ; (= lognm "JWP") ; (= lognm "JVM") ; (= lognm "PD") ; ) ; (write-line "(xload\"z:/public/am/amo11/amo\")" fp2) ;reload third party apps that will interrupt batch ; nil ; );if );progn (progn (write-line (strcat "OPEN Y " cdwg) fp2) ; (if (or ; (= lognm "HCF") ; (= lognm "DAF") ; (= lognm "JWP") ; (= lognm "JVM") ; ) ; (write-line "(xload\"z:/public/am/amo11/amo\")" fp2) ;reload third party apps that will interrupt batch ; nil ; );if );progn );if );if );progn (graphscr) );if (if fp1 (close fp1)) (if fp2 (close fp2)) (if fp3 (close fp3)) (if fp4 (close fp4)) (if (not goplt) (command ".script" (strcat lognm "plotj")) ;execute this user's script for the batch plot );if (setvar "expert" 0) (setvar "filedia" 1) (graphscr) );defun ;*======================CUT HERE, NAME MIRPLT.LSP======================== (defun c:mirplt (/) (setq mirtxt (getvar"mirrtext")) (setq limin (getvar"limmin")) (setq limax (getvar"limmax")) (setq newx (+(nth 0 limin)(/(-(nth 0 limax)(nth 0 limin))2))) (setq tmpt (list newx (nth 1 limax))) (setq bmpt (list newx (nth 1 limin))) (setvar "mirrtext" 1) (command ".mirror" "all" "" tmpt bmpt "y") (setvar "mirrtext" mirtxt) );defun