Jump to content
WPerciful

List of media sizes per each plotter

Recommended Posts

WPerciful

Plotter media sizes

We have about 15 plotters at work. I can get a list of all of the printers but how do I get a list of media sizes for each of these printers?

 

An example of the output I'm seeking:

(list "\"Xerox Phaser1\"" "Letter (8.5 x 11\")" "Tabloid (11 x 17\")")

 

How I get the list of plotters:

(defun getprinters ( / temp printers )
;	returns a list of all of the plotters
(setq temp
	(vlax-safearray->list
		(vlax-variant-value
			(vla-getplotdevicenames
				(vla-item 
					(vla-get-layouts
						(vla-get-activedocument 
							(vlax-get-acad-object)
						)
					)
				"Model"
				)
			)
		)
	)
)
(setq printers (list ))
(foreach printer temp
	(if (/= printer "None")
		(setq printers
			(append printers
				(list printer)
			)
		)
	)
)
)

Edited by WPerciful

Share this post


Link to post
Share on other sites
welldriller

If you are running WINDOWS have you gone to the CONTROL PANEL -- click on PRINTERS -- right click (1 time ) on each printer -- click on OPTIONS. You can check each printer listed that way.

 

Hope this will give the information that you are looking for.

Share this post


Link to post
Share on other sites
WPerciful

No I need to do it by lisp for my batch print routine. The code below returns a list of the media sizes available for all of my plotters i have, but that does not work either. I need the list of media sizes by printer.

 

(progn
   (defun actlay () 
	(vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)))
)
(defun canonicalmedianameslist ()
	(vla-refreshplotdeviceinfo (actlay))
	(vl-sort
		(vlax-safearray->list (vlax-variant-value (vla-getcanonicalmedianames (actlay))))
		'(lambda (a b) (< a b))
	) 
)
(actlay)
(canonicalmedianameslist)
)

which returns:

 

("700mm_(700.00_x_1000.00_MM)" "ANSI_A_(11.00_x_8.50_Inches)"

"ANSI_A_(8.50_x_11.00_Inches)" "ANSI_B_(11.00_x_17.00_Inches)"

"ANSI_B_(17.00_x_11.00_Inches)" "ANSI_C_(17.00_x_22.00_Inches)"

"ANSI_C_(22.00_x_17.00_Inches)" "ANSI_D_(22.00_x_34.00_Inches)"

"ANSI_D_(34.00_x_22.00_Inches)" "ANSI_E_(34.00_x_44.00_Inches)"

"ANSI_E_(44.00_x_34.00_Inches)" "ARCH_C_(18.00_x_24.00_Inches)"

"ARCH_C_(24.00_x_18.00_Inches)" "ARCH_D_(24.00_x_36.00_Inches)"

"ARCH_D_(36.00_x_24.00_Inches)" "ARCH_E1_(30.00_x_42.00_Inches)"

"ARCH_E1_(42.00_x_30.00_Inches)" "ARCH_E_(36.00_x_48.00_Inches)"

"ARCH_E_(48.00_x_36.00_Inches)" "ISO_A0_(1189.00_x_841.00_MM)"

"ISO_A0_(841.00_x_1189.00_MM)" "ISO_A1_(594.00_x_841.00_MM)"

"ISO_A1_(841.00_x_594.00_MM)" "ISO_A2_(420.00_x_594.00_MM)"

"ISO_A2_(594.00_x_420.00_MM)" "ISO_A3_(297.00_x_420.00_MM)"

"ISO_A3_(420.00_x_297.00_MM)" "ISO_A4_(210.00_x_297.00_MM)"

"ISO_A4_(297.00_x_210.00_MM)" "ISO_B1_(1000.00_x_707.00_MM)"

"ISO_B1_(707.00_x_1000.00_MM)" "ISO_B2_(500.00_x_707.00_MM)"

"ISO_B2_(707.00_x_500.00_MM)" "ISO_B4_(250.00_x_354.00_MM)"

"ISO_B4_(354.00_x_250.00_MM)" "ISO_B5_(182.00_x_237.00_MM)"

"ISO_B5_(237.00_x_182.00_MM)" "ISO_C5_(229.00_x_162.00_MM)"

"Legal_(8.50_x_14.0_Inches)" "Letter_(8.50_x_11.00_Inches)"

"Sun_Hi-Res_(1280.00_x_1600.00_Pixels)"

"Sun_Standard_(900.00_x_1152.00_Pixels)" "Super_VGA_(600.00_x_800.00_Pixels)"

"VGA_(480.00_x_640.00_Pixels)" "XGA_(768.00_x_1024.00_Pixels)"

"XGA_Hi-Res_(1200.00_x_1600.00_Pixels)")

Edited by WPerciful

Share this post


Link to post
Share on other sites
Lee Mac

Perhaps try something along the following lines:

(defun _getpaperinfo ( / con lay rtn )
   (setq lay (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)))
         con (vla-get-configname lay)
   )
   (vla-refreshplotdeviceinfo lay)
   (foreach dev (vlax-invoke lay 'getplotdevicenames)
       (vla-put-configname lay dev)
       (vla-refreshplotdeviceinfo lay)
       (setq rtn (cons (list dev (vlax-invoke lay 'getcanonicalmedianames)) rtn))
   )
   (vla-put-configname lay con)
   (reverse rtn)
)
(vl-load-com) (princ)

Usage:

(_getpaperinfo)

However, it could be very slow... I would instead recommend retrieving the list of media names following selection of a plot device.

 

--

 

PS: Please edit your post and enclose your code with code tags:

 

[highlight][noparse]

[/noparse][/highlight] Your code here [highlight][noparse]

[/noparse][/highlight]

Share this post


Link to post
Share on other sites
WPerciful

That's what I would like to do. I'd like to have a function that returns the media sizes for the name of the plot device that I pass it.

Share this post


Link to post
Share on other sites
Lee Mac
That's what I would like to do. I'd like to have a function that returns the media sizes for the name of the plot device that I pass it.

Here is a quick modification of my earlier post:

(defun _getpaperinfo ( dev / con lay rtn )
   (setq lay (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)))
         con (vla-get-configname lay)
   )
   (vla-put-configname lay dev)
   (vla-refreshplotdeviceinfo lay)
   (setq rtn (vlax-invoke lay 'getcanonicalmedianames))
   (vla-put-configname lay con)
   rtn
)
(vl-load-com) (princ)

Usage:

(_getpaperinfo [color=green]<Plot-Device-Name>[/color])

For repeated calls I would recommend passing the document object as an argument since the process of retrieving the application object via (vlax-get-acad-object) is slow and it is not recommended to have repeated calls to this function.

 

Note that the above function does not test the validity of the device name, and it is the responsibility of the caller to ensure that the supplied device name is a member of the list returned by getplotdevicenames. I omitted this check since an additional call to refreshplotdeviceinfo would be required, which is also a slow process.

Share this post


Link to post
Share on other sites
WPerciful

Question Lee,

 

Why is that the routine returns this:

("User256" "User576" "User575" "User565" "User564" "User93" "User517" "Envelope

C5" "Envelope C6" "Envelope DL" "Envelope Monarch" "Envelope #10" "Folio"

"User513" "User514" "User88" "B5 (JIS)" "B4 (JIS)" "User70" "A5" "A4" "A3"

"Statement" "Executive" "Letter" "Legal" "11x17" "User512")

 

But that doesn't match the list provided in the -plot command?

"Custom Paper Size"

"11" x 15""

"10" x 14""

"8" x 10""

"8.25" x 14""

"16K (195 x 267 mm)"

"8K (267 x 390 mm)"

"C5 Env. (162 x 229 mm)"

"C6 Env. (114 x 162 mm)"

"DL Env. (110 x 220 mm)"

"Monarch Env. (3.875" x 7.5")"

"Com10 Env. (4.125" x 9.5")"

"8.5" x 13""

"8.25" x 13""

"8" x 13""

"B6 JIS (128 x 182 mm)"

"B5 JIS (182 x 257 mm)"

"B4 JIS (257 x 364 mm)"

"A6 (105 x 148 mm)"

"A5 (148 x 210 mm)"

"A4 (210 x 297 mm)"

"A3 (297 x 420 mm)"

"5.5" x 8.5""

"Executive (7.25" x 10.5")"

"Letter (8.5" x 11")"

"Legal (8.5" x 14")"

"11" x 17""

"12" x 18""

Share this post


Link to post
Share on other sites
Lee Mac

I'm unsure - since there are the same number of items in each list, perhaps the various 'User#' media names are mapped to the corresponding paper names when the plot command is invoked.

Share this post


Link to post
Share on other sites
WPerciful

As a possible word around I was thinking about creating a .pc3 for each of the printers that we use, so that I know & set the media sizes.

 

I could store the media sizes in a csv, which is what I have been doing.

Edited by WPerciful

Share this post


Link to post
Share on other sites
Steven P

This is a bit of an old one - sorry for digging it up. I was looking for the same.

 

Lee, your routine works well but didn't quite do it for me today, sorry, I was getting the same 'User' paper sizes, and the vla-put-config changes the plot settings. So I came up with this, which I think works for me. 

 

(defun PlottersPaperSizes ( MyPlotter / LayoutName adoc alob pc3f existingplotter existingpapersizes existingplotarea existingcenterplot existingpaperunits existinglineweights existingplotstyles existingplotscale existingstylesheet lmnm cmnm)

;;get layout and dwg details
  (setq LayoutName (getvar "ctab"))
  (setq adoc (vla-get-ActiveDocument (vlax-get-acad-object)))
  (vla-RefreshPlotDeviceInfo (setq alob (vla-item (vla-get-layouts adoc) LayoutName)))

;;now store page set up settings '_old'
  (setq existingplotter (vla-get-configname alob))
  (setq existingpapersize (vla-get-CanonicalMediaName alob))
  (setq existingplotarea (vla-get-PlotType alob))
;;  (setq existingcenterplot (vla-get-CenterPlot alob)) ;; error if the plot area is 'Layout' so ignore it.
  (setq existingpaperunits (vla-get-PaperUnits alob))
  (setq existinglineweights (vla-get-PlotWithLineweights alob))
  (setq existingplotstyles (vla-get-PlotWithPlotStyles alob))
  (setq existingscale (vla-get-StandardScale alob))
  (setq existingstylesheet (vla-get-stylesheet alob))

;;change plotter to required plotter in plot settings
  (vla-put-configname alob MyPlotter)

;;create list of paper sizes
  (setq lmnm (mapcar '(lambda (itm) (vla-GetLocaleMediaName alob itm)) ;;Local Media Name for Paper
  (setq cmnm (vlax-safearray->list (vlax-variant-value (vla-GetCanonicalMediaNames alob)))))) ;;Canonical Media Name for Paper

;;now return page settings to as they were before
  (vla-put-configname alob existingplotter)
  (vla-put-CanonicalMediaName alob existingpapersize)
  (vla-put-PlotType alob existingplotarea)
;;  (vla-put-CenterPlot alob existingcentreplot)
  (vla-put-PaperUnits alob existingpaperunits)
  (vla-put-PlotWithLineweights alob existinglineweights)
  (vla-put-PlotWithPlotStyles alob existingplotstyles)
  (vla-put-StandardScale alob existingscale)
  (vla-put-stylesheet alob existingstylesheet)

;;return paper list
  lmnm
)

 

Similar to the OP,  I wanted this to go into my plotting LISP routine. 

 

I was hoping that if I specify the required paper size and page orientation the output from this lisp (modified a bit) gives the paper size name to use. The only user specific customisation in the code would then be the plotter names that plot each paper size (only 1 thing to change when we change printer or plotter). It's not so simple - look at DWG to PDF for example, if I want A3, the options include "ISO Full Bleed A3", "ISO Expand A3" (landscape and portrait), and "ISO A3", a few options if I want an "A3" PDF - and I am not sure how to make my LISP determine the one to use (yet). Oh well, I'll just stick to my simple (setq A3PaperSize "ISO Expand A3") and remember to change these about when we change the potter or printer

 

Share this post


Link to post
Share on other sites
maratovich

I agree with Steven P
In Lisp, the name is fixed, you will have to change the Lisp each time.
Each plotter will have different sheet names.
Here you need to store the data of each plotter, but for this you need a more powerful solution.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...