Author Topic: Keeping Track of Plotting Paper  (Read 8404 times)

0 Members and 1 Guest are viewing this topic.

dubb

  • Swamp Rat
  • Posts: 1105
Keeping Track of Plotting Paper
« Reply #45 on: February 08, 2005, 03:15:12 PM »
what content does the "newdate2.dwg" file contain?

rtext? attribute?

when i plot, does another dialogue pop up as well as the normal autocad dialogue.?

in cad 2004 there isnt an hp config, is there a replace for that?

Craig

  • Guest
Keeping Track of Plotting Paper
« Reply #46 on: February 17, 2005, 10:45:35 PM »
File contains attributes

Yes, the plotlog.dcl file will pop-up if you tell it to, but thats the whole point of the tracking.

Like I stated before, under your Print button, place this code:
^C^Cplotlog;_plot

Craig

  • Guest
Keeping Track of Plotting Paper
« Reply #47 on: February 17, 2005, 10:50:17 PM »
I was wondering why you brought up HPCONFIG but we don't use it. This plot routine was for R14 but I changed it some for R2002.

In the LSP file you might want to remove these lines:
 
Code: [Select]
(action_tile "no" "(progn(setq dm $key)(activate))")
  (action_tile "yes" "(progn(setq dm $key)(go_hpconfig)(activate))")


and remove the function go_hpconfig:
Code: [Select]
(defun go_hpconfig ()
  (c:hpconfig)
  );;end defun go_hpconfig


Also, in the DCL file remove:
Code: [Select]
: boxed_row {
        label = "Check your HPCONFIG";
        : button {
            label = "No";
            mnemonic = "N";
            key = "no";
        }
        : button {
            label = "Yes";
            mnemonic = "Y";
            key = "yes";
        }
    }


It should not effect your program but I will investigate here in a few to make sure all goes well

Craig

  • Guest
Keeping Track of Plotting Paper
« Reply #48 on: February 17, 2005, 11:03:11 PM »
Even better, here is our latest code you can replace the older one with. This one has also been re-written to ignore the program altogether if the NEWDATE stamp is missing. Basically, the box won't pop-up when we try to plot drawings we get from architects.

Plotlog.lsp
Code: [Select]
;;; plotlog.lsp
;;; Usage: This routine was designed to keep a log of all plots by writing the
;;; selections to a text file at H:\plotlog.txt. It inserts the following into
;;; the plot log:
;;; Job Number - Paper Used - Sheet Size - Square Feet - Month - Day - Year - Task Number
;;;
;;; Written By: Craig Boggan
;;; Created: February 12, 2003
;;;
;;; Updated: April 30, 2003
;;;          Added task number to job number
;;; Updated: September 1, 2004
;;;          Added the lines of code to ignore entire program if the newdate block is not on the drawing
;;;          This keeps from having to select an extra box when plotting architects drawings just for viewing
;;;
;;; CAD Program(s) Tested: AutoCAD 14+
;;;
(defun c:plotlog (/ cmd paper billable cm dm task oPlot number_plots)
 
  (setq ndate (ssget "x" '((0 . "INSERT") (2 . "NEWDATE2"))))
  (if (= ndate nil)
    (no_date1)
    (plog)
    );;end if
  (princ)
  );;end plotlog

(defun no_date1 ()
  (princ "Drawing not setup to use Plotlog ")
  );;end defun no_date

(defun plog ()
  (VL-LOAD-COM)
  (OR KBSG:ACADAPP (SETQ KBSG:ACADAPP (VLAX-GET-ACAD-OBJECT)))
  (OR KBSG:ACTIVEDOC (SETQ KBSG:ACTIVEDOC (VLA-GET-ACTIVEDOCUMENT KBSG:ACADAPP)))
  (setq oPlot (vla-get-plot KBSG:ACTIVEDOC ))
  (vlax-dump-object oPlot T)
  (setq number_plots (vla-get-NumberofCopies oPlot))
  (setq cmd (getvar "cmdecho"))
  (setvar "cmdecho" 0)
;;;;;;Begin dialog box
  (setq dcl_id (load_dialog "plotlog.dcl"))
  (if (not (new_dialog "plotlog" dcl_id))
    (exit);;if dialog not found..exit
  );;end if
  (action_tile "bond" "(setq paper $key)")
  (action_tile "vellum" "(setq paper $key)")
  (action_tile "mylar" "(setq paper $key)")
  (action_tile "0" "(setq task $key)")
  (action_tile "1" "(setq task $key)")
  (action_tile "2" "(setq task $key)")
  (action_tile "3" "(setq task $key)")
  (action_tile "4" "(setq task $key)")
  (action_tile "5" "(setq task $key)")
  (action_tile "other" "(progn(setq insert_other $key)(activate_other))")
  (action_tile "insert" "(setq task $value)")
  (action_tile "cancel" "(progn(setq cm $key)(done_dialog))")
  (action_tile "ok" "(progn(setq cm $key)(done_dialog))")
  (start_dialog)
  (unload_dialog dcl_id)
;;;;;;End dialog box
  (if (= cm "cancel")
    (princ "\nPlotlog aborted by user ")
    );;end if
  (if (= cm "ok")
    (check_newdate2);;if OK is selected on dialog box go to sub-routine check_newdate2
    );;end if
  (setvar "cmdecho" cmd)
  (princ)
  );;end defun plotlog
 

;;-------------------------------------------------------------
;; This checks to make sure the newdate stamp is on the drawing
;; before going any further. If it's not found, the program will
;; end with no errors showing across the command line
;;--------------------------------------------------------------
(defun check_newdate2 (/ find_block)
  (setq find_block (ssget "x" '((0 . "INSERT") (2 . "NEWDATE2"))))
  (if (= find_block nil)
    (alert "\nNewdate block not found...Exiting ")
    );;end if
  (if (/= find_block nil)
    (check_box)
    );;end if
  );;end defun check_newdate2

(defun go_hpconfig ()
  (c:hpconfig)
  );;end defun go_hpconfig

;;-------------------------------------------------------------
;; This checks to see which radio buttons were selected on the

;; dialog box and sets the appropriate values
;;--------------------------------------------------------------
(defun check_box ()
  (if (= paper "bond")
    (progn
      (setq paper "Bond")
      (start_plotlog)
      );;end progn
    );;end if
  (if (= paper "vellum")
    (progn
      (setq paper "Vellum")
      (start_plotlog)
      );;end progn
    );;end if

  (if (= paper "mylar")
    (progn
      (setq paper "Mylar")
      (start_plotlog)
      );;end progn
    );;end if
  );;end defun check_box


;;---------------------------------------------------------
;; This is section is where the program gathers most of its
;; data and writes it to a plotlog text file
;;---------------------------------------------------------
(defun start_plotlog (/ dwg_name   check_date job_number index
fb1   fb2      sheet_size count
sheet_length      sheet1 sheet2
square_feet      plotlog_line
fil   f      date1 year
month   day      date2 time
time1   time2      time3
      )
  (repeat number_plots
  (setq dwg_name (getvar "dwgname"))
  (setq check_date (substr dwg_name 1 1));;this finds out if it was in 1999 or 2000+
  (if (= check_date "9")
    (setq job_number (strcat "9" (substr dwg_name 2 4)));;this creates the job number
    );;end if
  (if (= check_date "0")
    (setq job_number (strcat "2" (substr dwg_name 2 4)));;this creates the job number
    );;end if
  (setq index 0)
  (setq fb1 (entget (ssname find_block index)));;gets first list from block
  (setq fb2 (entget(entnext(entnext(entnext(cdr(assoc -1 fb1)))))));;gets sub-list from same block to find sheet size
  (setq sheet_size (cdr(assoc 1 fb2)))
  ;;---------------------------------------------------------
  ;; This section find the "," between the sheet size numbers
  ;;---------------------------------------------------------
  (setq sf sheet_size
     count 1
);end setq
(while
 (not
   (wcmatch (substr sf count 2) "*`,")
 );end not

  (setq count (1+ count))
);end while
  ;;-------------------------
  ;; End of searching for ","
  ;;-------------------------
  (setq sheet_length (strlen sheet_size));;total length of sheet size extracted
  (setq sheet1 (*(atof(substr sheet_size 1 count))));;extracts out first number
  (setq sheet2 (atof(substr sheet_size (+ count 2) sheet_length)));;extracts out second number
  (setq square_inch (/(* sheet1 sheet2)12));;multiplies two sheet numbers then divides by 12 to get square inch
  (if (= paper "Bond")
    (setq price (strcat "$"(rtos(* square_inch 0.047)2 2)))
    );;end if
  (if (= paper "Vellum")
    (setq price (strcat "$"(rtos(* square_inch 0.11)2 2)))
    );;end if
  (if (= paper "Mylar")
    (setq price "Unknown")
    );;end if
  (setq square_feet (rtos(/(* sheet1 sheet2)12)))
  (setq sheet_size (strcat (rtos sheet1 2 0)"x"(rtos sheet2 2 0)))
  (setq date1 (rtos(getvar "cdate")2 0))
  (setq year (substr date1 1 4));; Extracts out the year from the CDATE variable
  (setq date1 (substr date1 5 8))
  (setq month (substr date1 1 2));; Extracts out the month by number from the CDATE variable
  ;; Check what month is active at the time of extraction
  (if (= month "01")
    (setq month "January")
  )
  (if (= month "02")
    (setq month "February")
  )
  (if (= month "03")
    (setq month "March")
  )
  (if (= month "04")
    (setq month "April")
  )
  (if (= month "05")
    (setq month "May")
  )
  (if (= month "06")
    (setq month "June")
  )
  (if (= month "07")
    (setq month "July")
  )
  (if (= month "08")
    (setq month "August")
  )
  (if (= month "09")
    (setq month "September")
  )
  (if (= month "10")
    (setq month "October")
  )
  (if (= month "11")
    (setq month "November")
  )
  (if (= month "12")
    (setq month "December")
  )
  (setq day (substr date1 3 4));; Extracts out the day from the CDATE variable
  (setq time1 (rtos(getvar "cdate")2 4))
  (setq time2 (strlen time1))
  (setq time3 (substr time1 (- time2 3) time2))
  (setq time (strcat(substr time3 1 2)":"(substr time3 3 4)))
  (setq job_task_number (strcat job_number "." task))
  (setq plotlog_line (strcat job_task_number "," paper "," sheet_size "," square_feet "," month " " day " " year "," time "," price))
 
  (setq fil1 (open "h:/plotlog.txt" "a"))
  ;(setq fil (getfiled "Select Plot Log file :" "h:\plotlog" "txt" 8))
  (if (= fil1 nil)
    (progn
      (princ "\nPlotlog.txt is missing from H:\ drive ")
      (exit)
      );;end progn
    );;end if
  ;(setq f (open fil "a"))
  (write-line plotlog_line fil1)
  (close fil1)
    );;end repeat
  );;end defun start_plotlog

(defun activate ()
 (if (/= dm nil);if selected
   (progn
     (mode_tile "bond" 0);enable
     (mode_tile "vellum" 0);enable
     (mode_tile "mylar" 0);enable
     (mode_tile "0" 0);enable
     (mode_tile "1" 0);enable
     (mode_tile "2" 0);enable
     (mode_tile "3" 0);enable
     (mode_tile "4" 0);enable
     (mode_tile "5" 0);enable
     (mode_tile "other" 0);enable
     );;end progn
   );;end if
);end activate

(defun activate_other ()
  (if (/= insert_other nil);if selected
    (progn
      (mode_tile "insert" 0);enable
      )
    (progn
      (mode_tile "insert" 1);disable
      )
   );;end if
);end activate_other

(defun deactivate ()
  (mode_tile "insert" 1)
  );;end defun deactivate


Plotlog.dcl
Code: [Select]
dcl_settings : default_dcl_settings { audit_level = 3; }

plotlog : dialog {
    label = "Plot Log";
    : boxed_radio_row {
        label = "Select Paper Grade";
        mnemonic = "S";
        : radio_button {
            label = "Bond";
            mnemonic = "B";
            key = "bond";
        }
        : radio_button {
            label = "Vellum";
            mnemonic = "V";
            key = "vellum";
        }
        : radio_button {
            label = "Mylar";
            mnemonic = "M";
            key = "mylar";
        }
    }
    : boxed_row {
        label = "Select Task Number";
        mnemonic = "T";
        : radio_row {
            value = "Tsk";
            : radio_button {
                label = ".0";
                key = "0";
            }
            : radio_button {
                label = ".1";
                key = "1";
            }
            : radio_button {
                label = ".2";
                key = "2";
            }
            : radio_button {
                label = ".3";
                key = "3";
            }
            : radio_button {
                label = ".4";
                key = "4";
            }
            : radio_button {
                label = ".5";
                key = "5";
            }
            : radio_button {
                label = "Other";
                mnemonic = "O";
                key = "other";
            }
        }
    }
    : boxed_row {
        alignment = right;
        fixed_width = true;
        width = 10;
        : edit_box {
            label = "Task Number";
            mnemonic = "I";
            key = "insert";
            alignment = centered;
            fixed_width = true;
            width = 10;
            is_enabled = false;
        }
    }
    : row {
        key = "YN";
        alignment = centered;
        fixed_width = true;
        width = 27;
        : button {
            label = "Add to Plotlog";
            mnemonic = "A";
            key = "ok";
            fixed_width = true;
            width = 10;
        }
        : button {
            label = "Skip Plotlog";
            mnemonic = "S";
            key = "cancel";
            fixed_width = true;
            is_cancel = true;
            width = 5;
            is_default = true;
        }
    }
}


dubb

  • Swamp Rat
  • Posts: 1105
Keeping Track of Plotting Paper
« Reply #49 on: February 18, 2005, 12:52:57 PM »
O THANKS,

Code: [Select]
Command: PLOTLOG ; IAcadPlot: The set of methods and properties used for
plotting layouts
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00af9594>
;   BatchPlotProgress = 0
;   NumberOfCopies = 1
;   QuietErrorMode = 0
; Methods supported:
;   DisplayPlotPreview (1)
;   PlotToDevice (1)
;   PlotToFile (2)
;   SetLayoutsToPlot (1)
;   StartBatchMode (1)
; error: bad argument type: lentityp nil


I GET THIS ERROR MESSAGE WHEN I RUN THE ROUTINE... WHAT INFORMAITON IS IN THE NEWDATE2 STAMP. DOES THE ROUTINE CALLED FOR ANYTHING FROM THE NEWDATE2 STAMP?

WILL THIS WORK ON 2004
Quote
(defun go_hpconfig ()
  (c:hpconfig)
  );;end defun go_hpconfig

sinc

  • Guest
Keeping Track of Plotting Paper
« Reply #50 on: February 18, 2005, 02:13:49 PM »
Quote from: danny
I've been looking around for such a program that will track plots also.  All I was looking for is who plotted it, what kind & size of paper, when/time, and of course job #.  

Trying to wade through this mess of posts, I didn't see anyone mention Autocad's built-in plot log, which does exactly this.

In the Plot dialog box on the Plot Device pane, click on "Plot Stamp Settings", then "Advanced", then check "Create a log file".  It creates a file like this:

Code: [Select]
S:\EJSI-Projects\Current\0316 05-07 Ridgeview CC4 CC5 BP1\dwg\031607_ALTA_LOT4.dwg,ALTA,2/17/2005 3:33:52 PM,Richard Sincovec,\\EJSI-SERVER\HP DesignJet 800 42,Arch D - 24 x 36 in. (landscape),1:1,
S:\EJSI-Projects\Current\0316 05-07 Ridgeview CC4 CC5 BP1\dwg\031607_ALTA_LOT3.dwg,ALTA,2/17/2005 4:06:30 PM,Richard Sincovec,\\EJSI-SERVER\HP DesignJet 800 42,Arch D - 24 x 36 in. (landscape),1:1,
S:\EJSI-Projects\Current\0479 Creekside Office Park\dwg\0479_PLAT.dwg,(1),2/17/2005 4:42:13 PM,Richard Sincovec,\\EJSI-SERVER\HP DesignJet 800 42,Arch D - 24 x 36 in. (landscape),1:1,
S:\EJSI-Projects\Current\0479 Creekside Office Park\dwg\0479_PLAT.dwg,(2),2/17/2005 4:47:06 PM,Richard Sincovec,\\EJSI-SERVER\HP DesignJet 800 42,Arch D - 24 x 36 in. (landscape),1:1,

It might be a little hard to read in the code window here in the Swamp (it's much easier in Notepad), but the fields in each line are Drawing Name, Layout Tab Name, Date/Time, User, Plotter (or PC3), Paper size, and Plot Scale.

ELOQUINTET

  • Guest
Keeping Track of Plotting Paper
« Reply #51 on: February 18, 2005, 03:17:36 PM »
craig need a little help here. i was trying to get this to work and not sure what's wrong. i got the lsp and dcl and changed the path to my destination which is in my search path. i downloaded the newdate2.dwg. i am trying to print from this drawing and it says "Drawing not setup to use Plotlog". what do you think i am doing wrong?

ELOQUINTET

  • Guest
Keeping Track of Plotting Paper
« Reply #52 on: February 18, 2005, 03:18:56 PM »
o yeah i setup my plot button like you said too.

Craig

  • Guest
Keeping Track of Plotting Paper
« Reply #53 on: February 18, 2005, 03:45:55 PM »
One thing is the NEWDATE.DWG file HAS to be on the drawing for this to work. Here is a screenshot of what ours looks like on the drawing.

Craig

  • Guest
Keeping Track of Plotting Paper
« Reply #54 on: February 18, 2005, 03:48:20 PM »
As you can see the \04013S01.DWG is our drawing number and the first 5 numbers is also the project number. Thats what it extracts out for the Job Number within the text file. Let me look and see if I can come up with a bit more that can help you out.

Understand, this is really for a starting place and you "MIGHT" have to adjust the code to fit your own needs since your drawings maynot be setup the same.

Be back

dubb

  • Swamp Rat
  • Posts: 1105
Keeping Track of Plotting Paper
« Reply #55 on: February 18, 2005, 03:53:37 PM »
Quote from: Craig
As you can see the \04013S01.DWG is our drawing number and the first 5 numbers is also the project number. Thats what it extracts out for the Job Number within the text file. Let me look and see if I can come up with a bit more that can help you out.

Understand, this is really for a starting place and you "MIGHT" have to adjust the code to fit your own needs since your drawings maynot be setup the same.

Be back

o i c i just read that the stamp is an attribute. as for customizing have similar file naming structure as you. except my drawings are like "05-555S20 (FOR A FOUNDATION PLAN)"  and so forth. and as for modifying the code...i would probably have to change the attribute tags and the directory "H:/" to read "S:/"

the plot dialogue appears but the plotlog.txt doesnt have anything written in it. thank you for this code. btw..how did you get this one, did u make it yourself?

Craig

  • Guest
Keeping Track of Plotting Paper
« Reply #56 on: February 18, 2005, 04:03:32 PM »
My suggestion as I look more and more at this, there are too many factors on our system that I could post all the different code and it work exactly like you need it to. We have a program that places the NEWDATE.DWG on the drawing but it's running through another program that has to do with the setup of the drawing. All this was implemented before I ever came here and I just adjusted everything to what was already in place. Overall there are about 4 different programs that revolve around this NEWDATE thing. My suggestion is to write you a small program that will place the block on your drawing where you want it with informtaion like I supplied in the screenshot. I thougt I could be more help but every time I opened one file, two more were required and I could never explain it all.

Below is another program that can store our drawings for us in the correct folder using the project number and update the NEWDATE.DWG stamp to the current date when you do the save. Maybe you can find a wayt o get it to work how you want it...wish I could do more.

Code: [Select]
;;; filestore.lsp
;;; Usage: This routine was designed to save open drawing file to local computer then copy
;;; the same drawing file to the server in the correct location. This was created to replace
;;; the existing STORE command which would not run under AutoCAD 2000+
;;;
;;; Written By: Craig Boggan
;;; Created: November 17, 2003
;;;
;;;
;;; CAD Program(s): AutoCAD 2002+
;;;
;;; Creating toolbar button command should be as follows: ^C^Cqsave;_filestore;
;;;
(defun c:filestore (/     doc      fn       dn nn
   date1    year     month    time1 time2
   time3    n_date   ndate1   ndate2 ndate_date
   getatt   addatt   insrtatt check message
  )
  (vl-load-com)
  (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
  (setq
    fn (vlax-get-property doc 'FullName)
    dn (vlax-get-property doc 'Name)
    nn (strcase
(strcat "h:\\" (substr dn 1 2) "\\" (substr dn 1 5) "\\" dn)
       )
  )
  (setq ndate_title (strcat "\\" dn))
  (setq date1 (rtos (getvar "cdate") 2 0)
year  (substr date1 3 2);; Extracts out the year from the CDATE variable
date1 (substr date1 5 8)
month (substr date1 1 2);; Extracts out the month by number from the CDATE variable
day   (substr date1 3 4);; Extracts out the day from the CDATE variable
;;; This potion will extract out the time
time1 (rtos (getvar "cdate") 2 4)
time2 (strlen time1)
time3 (substr time1 (- time2 3) time2)
time  (strcat (substr time3 1 2) ":" (substr time3 3 4))
;;;End of time extraction
  )
  (setq n_date (strcase (strcat ndate_title
","
month
"-"
day
"-"
year
" AT "
(substr time3 1 2)
":"
(substr time3 3 4)
" - CRAIG"
)
      )
  );;This creates a string of all variables together to place on the Newdate stamp
  (setq ndate (ssget "x" '((0 . "INSERT") (2 . "NEWDATE2"))));;This finds the newdate stamp and places it as a variable
  (setq index 0)
  (setq ndate1 (entget (ssname ndate index)));;Extracting out the list of the Newdate stamp
  (setq ndate2 (ssname ndate index));;Gets ssname of stamp for later use so it can be updated by entupd
  (setq ndate_date (entget (entnext (cdr (assoc -1 ndate1)))));;This extracts the list for the first attribute
  (setq getatt (assoc 1 ndate_date));;Extracts out the first line in the Newdate stamp
  (setq addatt (cons 1 n_date));;Setting up to replace the first line in the Newdate stamp
  (setq insrtatt (subst addatt getatt ndate_date));;Substituting variables to show new date, time, etc...
  (entmod insrtatt);;Modify attribute in Newdate stamp
  (entupd ndate2);;Update Newdate stamp
  (setq check (findfile nn))
  (if (= check nil)
    (progn
      (alert "File not found on server. Start copy process ")
      (vl-file-copy fn nn)
      );;progn
    );;end if
  (if (/= check nil)
    (progn
      (princ "\nRemoving previous file ")
      (vl-file-delete nn);;Deletes original file on server so new one can be copied over
      (princ "\nStoring new file ")
      (vl-file-copy fn nn);;Copy drawing file to server
      );;progn
    );;end if
  ;;Copies new updated file on local computer to server
   (setq message (strcat "\nFile Stored...H:\\" (substr dn 1 2) "\\" (substr dn 1 5) "\\" dn))
  ;;(prompt "File Stored... ")
   (princ message)
  (princ)
);;end defun filestore.lsp

Craig

  • Guest
Keeping Track of Plotting Paper
« Reply #57 on: February 18, 2005, 04:07:48 PM »
Quote from: dubb
o i c i just read that the stamp is an attribute. as for customizing have similar file naming structure as you. except my drawings are like "05-555S20 (FOR A FOUNDATION PLAN)"  and so forth. and as for modifying the code...i would probably have to change the attribute tags and the directory "H:/" to read "S:/"

the plot dialogue appears but the plotlog.txt doesnt have anything written in it. thank you for this code. btw..how did you get this one, did u make it yourself?


Yes, I wrote this about 2 years ago to keep from having to keep up with plots by having to write them down by hand (which I've done before and it's no fun).

For the text file, make sure the path statment in the LSP is pointing to the correct location, being ours is on H:\

dubb

  • Swamp Rat
  • Posts: 1105
Keeping Track of Plotting Paper
« Reply #58 on: July 11, 2005, 01:58:55 PM »
im back on this topic again...since i had made the plot tracking lisp routine....somehow people bypass it making this a routine that is not effective...i would like to make this routine so that you cannot cancel it..or maybe you can cancel it but it will silently get as much data as it can and print out that this person didnt log the plot log the correct way...can anyone help me? ill post the code in my the pond...btw anyone can download this routine..ill include the .dcl file. thanks