Author Topic: Get Previous PLOT printer name  (Read 3159 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
Get Previous PLOT printer name
« on: March 11, 2009, 02:31:02 PM »
Hi all,..

anyone know how to get the Printer name of the previous PLOT ?

I've made this code below....but not seem to work.

Code: [Select]
(defun gen_get_lastprinter (/ regkey)
  (setq regkey (strcat "HKEY_CURRENT_USER\\"
                       (vlax-product-key)
                       "\\Profiles\\"
                       (getvar "CPROFILE")
                       "\\Previous plot settings"
               )
  )
  (if (eq (getvar "tilemode") 1)
    (setq lastprinter (vl-registry-read (strcat regkey "\\Model") "Cfg Name"))
    (setq lastprinter (vl-registry-read (strcat regkey "\\Layout") "Cfg Name"))
  )
  lastprinter
)
Keep smile...

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Get Previous PLOT printer name
« Reply #1 on: March 11, 2009, 02:59:18 PM »
Works for me.

Command: (gen_get_lastprinter)
"z-PdfWriter.pc3"
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Get Previous PLOT printer name
« Reply #2 on: March 11, 2009, 03:28:41 PM »
Works for me.

Command: (gen_get_lastprinter)
"z-PdfWriter.pc3"

Sorry,..

I mean...the code work. but the result is false.
Keep smile...

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: Get Previous PLOT printer name
« Reply #3 on: March 11, 2009, 04:09:34 PM »
Andrea, the most recent settings in the Registry are from the last time Acad closed. Any plot done in the current session will not be included in that info until Acad closes. I don't know of any way to get this data at this time.

You could write your own reactor that saves the data for your use whenever the Plot command is fired......

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Get Previous PLOT printer name
« Reply #4 on: March 11, 2009, 09:53:06 PM »
thanks Jeff,

The way I think is to read the CSV log file .
Code: [Select]
(defun gen_get_lastprinter (/ logfilename plotlogname ofile rl)
  (if (vl-string-search "FR" (strcase (ver)))
    (setq logfilename "Journal de tracé et de publication.CSV")
    (setq logfilename "PlotAndPublishLOG.csv")
  )
  (setq plotlogname (strcat (getvar "LOGFILEPATH") logfilename))
  (if (and plotlogname (findfile plotlogname))
    (progn
      (setq ofile (open (findfile plotlogname) "r"))
      (setq rl (read-line ofile))
           (while rl
             (if (eq (vl-princ-to-string (read rl)) "SH")
               (setq lastrl rl)
             )
             (setq rl (read-line ofile))
           )
           (close ofile)
    )
  )
(nth 14 (CSVparseLisst lastrl))
)

(defun CSVparseLisst (h / symb1 it)
(setq h (vl-string-right-trim "\"" (vl-string-left-trim "\"" h)))
(while (setq symb1 (vl-string-search "," h))
  (setq it (append it (list (substr h 1 (1- symb1)))))
  (setq h (substr h (+ symb1 3)))
)
  it
)


and assure that the options is activated.

Code: [Select]
(vl-load-com)
(setq AcadOutputPref (vla-get-Output (vla-get-Preferences (vlax-get-acad-object))))
(vla-put-ContinuousPlotLog AcadOutputPref :vlax-true)
(vla-put-AutomaticPlotLog AcadOutputPref :vlax-true)

can't find another way.. :?
« Last Edit: March 12, 2009, 03:51:50 PM by Andrea »
Keep smile...