;;; ;;; This routine will automatically place several informational ;;; items as a string in an attribute called FILSPEC in a block ;;; named pltstamp. The attribute is positioned and rotated to ;;; fit just inside the binding edge of any standard sheet size. ;;; Currently all sheet sizes except 8.5" x 11" will be stamped ;;; along the short side of the sheet in all cases. The 8.5" x 11" ;;; sheet will be stamped along the long side of the sheet. ;;; ;;; The items are, in order, ;;; Filespec: (path\filename) (dwgprefix + dwgname + .DWG) ;;; Date: mm/dd/yy (extracted from cdate) ;;; Time: hh:mm (extracted from cdate) ;;; Scale: nn"=1'-0" or 1"=nn' (calculated from dimscale) ;;; ;;;> Author: Henry C. Francis ;;;> 425 N. Ashe St. ;;;> Southern Pines, NC 28387 ;;;> http://paracadd.com ;;;> All rights reserved. ;;; ;;;> COPYRIGHT: 5-31-94 ;;;> EDITED: 06-23-2006 ;;; (defun C:PLBL (/ rang linp locn found attdia flatland dsdir slen dscl datm dwgp dwnm dwgn dstp adjm tscf maxx maxy minx miny xrlst tblk tbln xrnm pt fs_fil fs_str frst_rdline ) (setq cmde (getvar "cmdecho")) (setq atrreq (getvar "attreq")) (setvar "ATTREQ" 0) (if dimscl nil (load "dimscl" "\nFile DIMSCL.LSP not found! ") ) ;_ end of if (dimscl) (if dos_help nil (arxload "doslib14") ) ;_ end of if (setq cur_vp (getvar "cvport")) (if (and (eq (getvar "tilemode") 0) (/= cur_vp 1)) (command "_.pspace") ) ;_ end of if (prompt "\nSearching for filespec/date stamp.") (setvar "cmdecho" 0) (if (getvar "flatland") (progn (setq flatland (getvar "flatland")) (setvar "flatland" 0) ) ;_ end of progn nil ) ;_ end of if (if (setq found (ssget "x" (LIST(CONS 410 (GETVAR "CTAB"))(CONS 2 "pltstamp")))) (command ".erase" (eval found) "") ) ;_ end of if (setq maxx (car (getvar "limmax")) minx (car (getvar "limmin")) maxy (cadr (getvar "limmax")) miny (cadr (getvar "limmin")) ) ;_ end of setq ;;; (if (equal minx 0.0 0.001) ;;; (setq minx 0.0) ;;; ) ;;; (if (equal miny 0.0 0.001) ;;; (setq miny 0.0) ;;; ) (cond ((< (abs (- (/ (- maxx minx) (- maxy miny)) 1.5455)) 0.01) ;;; B size landscape (if (or (equal (- maxx minx) 34 0.01) (equal (- maxx minx) 36 0.01) ) ;_ end of or (setq locn "LEFT" rang 0 pprsiz "D" ) ;_ end of setq (setq locn "LEFT" rang 0 pprsiz "B" ) ;_ end of setq ) ;_ end of if ) ((< (abs (- (/ (- maxx minx) (- maxy miny)) 1.5)) 0.01) ;;; D size landscape (setq locn "LEFT" rang 0 pprsiz "D" ) ;_ end of setq ) ((< (abs (- (/ (- maxx minx) (- maxy miny)) 1.4)) 0.01) ;;; E size landscape (setq locn "LEFT" rang 0 pprsiz "E" ) ;_ end of setq ) ((< (abs (- (/ (- maxx minx) (- maxy miny)) 1.2941)) 0.01) ;;; A or C size landscape (if (< (abs (- (/ (- maxx minx) dimsc) 11.0)) 0.01) (setq locn "" rang 270 pprsiz "A" ) ;_ end of setq (setq locn "LEFT" rang 0 pprsiz "C" ) ;_ end of setq ) ;_ end of if ) ((< (abs (- (/ (- maxx minx) (- maxy miny)) 0.7727)) 0.01) ;;; A or C size portrait (if (< (abs (- (/ (- maxx minx) dimsc) 8.5)) 0.01) (setq locn "LEFT" rang 0 pprsiz "A" ) ;_ end of setq (setq locn "BOTM" rang 90 pprsiz "C" ) ;_ end of setq ) ;_ end of if ) ((>= (/ (- maxx minx) (- maxy miny)) 1.0) (setq locn "LEFT" rang 0 pprsiz "UNK" ) ;_ end of setq ) ((< (/ (- maxx minx) (- maxy miny)) 1.0) (setq locn "" rang 270 pprsiz "UNK" ) ;_ end of setq ) ) ;_ end of cond (if found (prompt "\nUpdating filespec/date stamp.") (prompt "\nInserting filespec/date stamp.") ) ;_ end of if (SETQ *ERROR* NIL) (setq dsdir "pltstamp=DWGSTAMP") (setq attdia (getvar "attdia")) (setvar "attdia" 0) (cond ((= ftscl "Fullscale") (cond ((or (eq (getvar "lunits") 1) (eq (getvar "lunits") 5)) (setq sclcalc (atof (rtos dimsc 2 4))) (setq dscl (strcat "SCALE: 1:" (rtos dimsc 2 (setsclfac)))) ) ((eq (getvar "lunits") 2) (setq sclcalc (atof (rtos dimsc 2 4))) (setq dscl (strcat "SCALE: 1\"=" (rtos dimsc 2 (setsclfac)) "' (1:" (rtos dimsc 2 (setsclfac)) ")" ) ;_ end of strcat ) ;_ end of setq ) ((eq (getvar "lunits") 3) (setq sclcalc (atof (rtos (/ dimsc 12) 2 4))) (setq dscl (strcat "SCALE: 1\"=" (rtos (/ dimsc 12) 2 (setsclfac)) "' (1:" (rtos dimsc 2 (setsclfac)) ")" ) ;_ end of strcat ) ;_ end of setq ) ((eq (getvar "lunits") 4) (setq sclcalc (atof (rtos (/ 12.0000 dimsc) 2 4))) (setq dscl (strcat "SCALE: " (rtos (/ 12.0000 dimsc) 5 (setsclfac)) "\"=1'-0\" (1:" (rtos dimsc 2 (setsclfac)) ")" ) ;_ end of strcat ) ;_ end of setq ) ) ;_ end of cond ) ((= ftscl "Halfscale") (cond ((or (eq (getvar "lunits") 1) (eq (getvar "lunits") 5)) (setq sclcalc (atof (rtos (* dimsc 2) 2 4))) (setq dscl (strcat "SCALE: 1:" (rtos (* dimsc 2) 2 (setsclfac))) ) ;_ end of setq ) ((eq (getvar "lunits") 2) (setq sclcalc (atof (rtos (* dimsc 2) 2 4))) (setq dscl (strcat "SCALE: 1\"=" (rtos (* dimsc 2) 2 (setsclfac)) "' (1:" (rtos (* dimsc 2) 2 (setsclfac)) ")" ) ;_ end of strcat ) ;_ end of setq ) ((eq (getvar "lunits") 3) (setq sclcalc (atof (rtos (/ dimsc 6) 2 4))) (setq dscl (strcat "SCALE: 1\"=" (rtos (/ dimsc 6) 2 (setsclfac)) "' (1:" (rtos (* dimsc 2) 2 (setsclfac)) ")" ) ;_ end of strcat ) ;_ end of setq ) ((eq (getvar "lunits") 4) (setq sclcalc (atof (rtos (/ 6.0000 dimsc) 2 4))) (setq dscl (strcat "SCALE: " (rtos (/ 6.0000 dimsc) 5 (setsclfac)) "\"=1'-0\" (1:" (rtos (* dimsc 2) 2 (setsclfac)) ")" ) ;_ end of strcat ) ;_ end of setq ) ) ;_ end of cond ) ((= ftscl "Fit") (setq dscl "DO NOT SCALE, plotted to FIT") ) ((or (/= ftscl "Fit") (/= ftscl "Halfscale") (/= ftscl "Fullscale") ) ;_ end of or (cond ((or (eq (getvar "lunits") 1) (eq (getvar "lunits") 5)) (setq sclcalc (atof (rtos dimsc 2 4))) (setq dscl (strcat "SCALE: 1:" (rtos dimsc 2 (setsclfac)))) ) ((eq (getvar "lunits") 2) (setq sclcalc (atof (rtos dimsc 2 4))) (setq dscl (strcat "SCALE: 1\"=" (rtos dimsc 2 (setsclfac)) "' (1:" (rtos dimsc 2 (setsclfac)) ")" ) ;_ end of strcat ) ;_ end of setq ) ((eq (getvar "lunits") 3) (setq sclcalc (atof (rtos (/ dimsc 12) 2 4))) (setq dscl (strcat "SCALE: 1\"=" (rtos (/ dimsc 12) 2 (setsclfac)) "' (1:" (rtos dimsc 2 (setsclfac)) ")" ) ;_ end of strcat ) ;_ end of setq ) ((eq (getvar "lunits") 4) (setq sclcalc (atof (rtos (/ 12.0000 dimsc) 2 4))) (setq dscl (strcat "SCALE: " (rtos (/ 12.0000 dimsc) 5 (setsclfac)) "\"=1'-0\" (1:" (rtos dimsc 2 (setsclfac)) ")" ) ;_ end of strcat ) ;_ end of setq ) ) ;_ end of cond ) ) ;_ end of cond (setq datm (rtos (getvar "cdate") 2 6)) (setq dwgp (getvar "dwgprefix")) (if dwnm (setq dwgn dwnm) (setq dwgn (getvar "dwgname")) ) ;_ end of if (if (= (substr dwgp 1 3) (substr dwgn 1 3)) (setq slen (+ (- (strlen dwgn) (- (strlen dwgn) (strlen dwgp))) 1)) (setq slen 1) ) ;_ end of if (setq tblk (tblnext "block" t)) (while (setq tbln (tblnext "block")) (if (setq xrnm (cdr (assoc 1 tbln))) (progn (if (wcmatch (strcase xrnm) "*.DWG") (setq xrnm (substr xrnm 1 (- (strlen xrnm) 4))) ) ;_ end of if (if xrlst (setq xrlst (append xrlst (list xrnm))) (setq xrlst (list xrnm)) ) ;_ end of if ) ;_ end of progn ) ;_ end of if ) ;_ end of while (if (setq xrnm (cdr (assoc 1 tblk))) (progn (if (wcmatch (strcase xrnm) "*.DWG") (setq xrnm (substr xrnm 1 (- (strlen xrnm) 4))) ) ;_ end of if (if xrlst (setq xrlst (append xrlst (list xrnm))) (setq xrlst (list xrnm)) ) ;_ end of if ) ;_ end of progn ) ;_ end of if (if xrlst (progn (setq xrlst (acad_strlsort xrlst)) (foreach n xrlst (if xrstr (setq xrstr (strcat xrstr ", " n)) (setq xrstr (strcat "XREF's: " n)) ) ;_ end of if ) ;_ end of foreach (setq xrlst nil) ) ;_ end of progn (setq xrstr "") ;_ end of setq ) ;_ end of if (if c:mklayr nil (load "mklayr") ) ;_ end of if (c:svlayr) (if dos_help nil (arxload "doslib14") ) ;_ end of if (if (and dos_username (dos_username)) (setq mach (dos_username)) (setq mach "Unknown") ) ;_ end of if (if (or (eq (substr (getvar "dwgprefix") 1 2) "A:") (eq (substr (getvar "dwgprefix") 1 2) "B:") (eq (substr (getvar "dwgprefix") 1 2) "C:") (eq (substr (getvar "dwgprefix") 1 2) "D:") (eq (substr (getvar "dwgprefix") 1 2) "E:") ;;; (eq (substr (getvar "dwgprefix") 1 2) "L:") ) ;_ end of or (setq fs_str (strcat " " (getenv "computername") " LOCAL DRIVE")) (IF dos_uncpath (progn (SETQ curuncpath (dos_uncpath (getvar "dwgprefix"))) (IF curuncpath (PROGN (SETQ unccnt 1) (WHILE (NOT (WCMATCH (SUBSTR curuncpath unccnt 3) "@\\@")) (SETQ unccnt (1+ unccnt)) ) ;_ end of WHILE (SETQ fs_str (STRCASE (SUBSTR curuncpath 1 unccnt))) ) ;_ end of PROGN ) ;_ end of IF ) ;_ end of progn (IF fs_str NIL (progn (command ".sh" (strcat "NET USE " (substr (getvar "dwgprefix") 1 2) " > c:\\fserv.dat" ) ;_ end of strcat ) ;_ end of command (while (not frst_rdline) (setq fs_fil (open "c:/fserv.dat" "r")) (if fs_fil (if (setq sd_rline (read-line fs_fil)) (setq frst_rdline T) ) ;_ end of if ) ;_ end of if (if frst_rdline nil (if (and fs_fil (eq (type fs_fil) 'FILE)) (close fs_fil) ) ;_ end of if ) ;_ end of if ) ;_ end of while (while (setq sd_rline (read-line fs_fil)) (if (wcmatch sd_rline "Remote name *") (progn (setq fs_str (substr sd_rline 12)) (while (eq (substr fs_str 1 1) " ") (setq fs_str (substr fs_str 2)) ) ;_ end of while ;;; (setq done_fs T) ) ;_ end of progn ) ;_ end of if ) ;_ end of while (close fs_fil) ;;; (setq done_fs nil) (IF fs_str NIL (setq fs_str (strcat " " (getenv "computername") " LOCAL DRIVE" ) ;_ end of strcat ) ;_ end of setq ) ;_ end of IF ) ;_ end of progn ) ;_ end of IF ) ;_ end of IF ) ;_ end of if (setq dstp (strcase (strcat (substr fs_str 3) " " dwgp (substr dwgn slen) (if (wcmatch (strcase dwgn) "*.DWG") "" (if (not (wcmatch dwgn "*.*")) ".DWG" "" ) ;_ end of if ) ;_ end of if ", LAYOUT: " (GETVAR "CTAB") ", PLOTTED: " (substr datm 5 2) "/" (substr datm 7 2) "/" (substr datm 3 2) " " (substr datm 10 2) ":" (substr datm 12 2) " " dscl (if (eq hdln "Yes") " HIDE" "" ) ;_ end of if ) ;_ end of strcat ) ;_ end of strcase mjrg "G" llt "-" prod "SHBD" colr "1" modf "IDEN" ) ;_ end of setq (if (eq (getvar "dwgprefix") "H:\\CD9601\\") nil (progn (c:mklayr) (graphscr) (command ".insert" "pltstamp=dwgstamp" (LIST minx miny) "" "" (if rang rang 90 ) ;_ end of if ) ;_ end of command (setvar "attdia" attdia) (setvar "cmdecho" 1) (setq ent (ssget "X" (LIST(CONS 410 (GETVAR "CTAB"))(CONS 2 "pltstamp")))) (setq tscf (* dimsc 0.065)) (if (and (eq ftscl "Halfscale") (eq (substr (getvar "plotid") 1 5) "HP 4V") ) ;_ end of and (setq adjm (* tscf -4.25)) (setq adjm (* tscf -2.75)) ) ;_ end of if (setq bent (entnext (ssname ent 0))) (if pltoutfn (setq pltoutfn (strcase (strcat (substr fs_str 3) " " pltoutfn " PLOTTED: " (substr datm 5 2) "/" (substr datm 7 2) "/" (substr datm 3 2) " " (substr datm 10 2) ":" (substr datm 12 2) " " dscl (if (eq hdln "Yes") " HIDE" "" ) ;_ end of if ) ;_ end of strcat ) ;_ end of strcase ) ;_ end of setq ) ;_ end of if (entmod (subst (cons 1 (if pltoutfn pltoutfn dstp ) ;_ end of if ) ;_ end of cons (assoc 1 (entget bent)) (entget bent) ) ;_ end of subst ) ;_ end of entmod (setq pltoutfn NIL) (if (or (= pprsiz "A") (= pprsiz "B")) (setq tscf (/ tscf 2)) ) ;_ end of if (entmod (subst (cons 40 tscf) (assoc 40 (entget bent)) (entget bent) ) ;_ end of subst ) ;_ end of entmod (if (eq locn "LEFT") (if (and (/= pprsiz "A") (/= pprsiz "B")) (entmod (subst (cons 10 (list (+ minx adjm tscf (* dimsc 0.9)) (+ miny (* 1.25 dimsc)) (cadddr (assoc 10 (entget bent))) ) ;_ end of list ) ;_ end of cons (assoc 10 (entget bent)) (entget bent) ) ;_ end of subst ) ;_ end of entmod (entmod (subst (cons 10 (list (+ (car (getvar "limmin")) (* adjm 4) (* tscf 8.5) (* dimsc 0.9) ) ;_ end of + (+ miny (* 1.25 dimsc)) (cadddr (assoc 10 (entget bent))) ) ;_ end of list ) ;_ end of cons (assoc 10 (entget bent)) (entget bent) ) ;_ end of subst ) ;_ end of entmod ) ;_ end of if (if (eq locn "") (if (and (/= pprsiz "A") (/= pprsiz "B")) (entmod (subst (cons 10 (list (- minx (+ adjm (* 2 tscf))) (+ miny (* 0.21 (+ adjm tscf)) ) ;_ end of + (cadddr (assoc 10 (entget bent))) ) ;_ end of list ) ;_ end of cons (assoc 10 (entget bent)) (entget bent) ) ;_ end of subst ) ;_ end of entmod (entmod (subst (cons 10 (list (- minx (+ adjm (* -9 tscf))) (+ miny (+ (* adjm 1.375) tscf) ) ;_ end of + (cadddr (assoc 10 (entget bent))) ) ;_ end of list ) ;_ end of cons (assoc 10 (entget bent)) (entget bent) ) ;_ end of subst ) ;_ end of entmod ) ;_ end of if (if (and (/= pprsiz "A") (/= pprsiz "B")) (entmod (subst (cons 10 (list minx (+ miny adjm tscf (* dimsc 0.9) ) ;_ end of + (cadddr (assoc 10 (entget bent))) ) ;_ end of list ) ;_ end of cons (assoc 10 (entget bent)) (entget bent) ) ;_ end of subst ) ;_ end of entmod (entmod (subst (cons 10 (list minx (+ miny (* adjm 12) tscf (* dimsc 0.9) ) ;_ end of + (cadddr (assoc 10 (entget bent))) ) ;_ end of list ) ;_ end of cons (assoc 10 (entget bent)) (entget bent) ) ;_ end of subst ) ;_ end of entmod ) ;_ end of if ) ;_ end of if ) ;_ end of if (if (and (eq ftscl "Halfscale") (eq (substr (getvar "plotid") 1 5) "HP 4V") ) ;_ end of and (progn (entmod (subst (cons 50 0) (assoc 50 (entget bent)) (entget bent) ) ;_ end of subst ) ;_ end of entmod (entmod (subst (cons 10 (polar (cdr (assoc 10 (entget bent))) (/ pi 2) tscf) ) ;_ end of cons (assoc 10 (entget bent)) (entget bent) ) ;_ end of subst ) ;_ end of entmod ) ;_ end of progn ) ;_ end of if (entupd bent) (if flatland (setvar "flatland" flatland) nil ) ;_ end of if (prompt "\nFilespec/date stamped on binding edge. ") (c:rslayr) (setvar "cmdecho" cmde) (command) (if ftscl (progn (if (or (eq (getvar "dwgprefix") "H:\\BN9503\\") (eq (getvar "dwgprefix") "H:\\BN9414\\") ) ;_ end of or (command ".layer" "c" "1" "*iden" "") ) ;_ end of if (command "resume") ) ;_ end of progn ) ;_ end of if (setvar "ATTREQ" atrreq) ) ;_ end of progn ) ;_ end of if (pdate) (dos_delete "c:/fserv.dat") (princ) ) ;_ end of defun (defun pdate () (if (setq pldate (ssget "x" (LIST(CONS 410 (GETVAR "CTAB"))(CONS 2 "PLOTDATE")))) (progn (setq pldat (entget (entnext (ssname pldate 0))) pldndx 0 cdprfx (getvar "dwgprefix") pfxlen (strlen cdprfx) ) ;_ end of setq (if (eq (substr (getvar "dwgname") 2 1) ":") (setq cdname (getvar "dwgname")) (setq cdname (strcat cdprfx (getvar "dwgname"))) ) ;_ end of if (if (eq (substr (getvar "acadver") 1 2) "14") nil (setq cdname (strcat cdname ".DWG")) ) ;_ end of if (while (/= (cdr (assoc 0 pldat)) "SEQEND") (set (read (strcat "PLDAT" (itoa pldndx))) pldat) (setq pldat (entget (entnext (cdar pldat))) pldndx (1+ pldndx) ) ;_ end of setq ) ;_ end of while (if (and pldat0 pldat1 pldat2) (progn (setq cpdate (strcat (substr datm 5 2) "/" (substr datm 7 2) "/" (substr datm 3 2) ) ;_ end of strcat cptime (strcat (substr datm 10 2) ":" (substr datm 12 2) ) ;_ end of strcat ) ;_ end of setq (setq pldat0 (subst (cons 1 cdname) (assoc 1 pldat0) pldat0 ) ;_ end of subst ) ;_ end of setq (setq pldat1 (subst (cons 1 cpdate) (assoc 1 pldat1) pldat1 ) ;_ end of subst ) ;_ end of setq (setq pldat2 (subst (cons 1 cptime) (assoc 1 pldat2) pldat2 ) ;_ end of subst ) ;_ end of setq (entmod pldat0) (entmod pldat1) (entmod pldat2) (entupd (ssname pldate 0)) ) ;_ end of progn ) ;_ end of if ) ;_ end of progn ) ;_ end of if (princ) ) ;_ end of defun (defun setsclfac () (if (equal (rem sclcalc (if (>= sclfac 1) (fix sclcalc) sclcalc ) ;_ end of if ) ;_ end of rem 0 0.0001 ) ;_ end of equal (setq sclfac 0) (setq sclfac 4) ) ;_ end of if ) ;_ end of defun ;|«Visual LISP© Format Options» (72 2 40 2 T "end of " 60 9 0 0 0 T T nil T) ***Don't add text below the comment!***|;