Visual LISP, AutoLISP and General Customization
cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 

AutoCAD: Batch plotting to PNG

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
1458 Views, 3 Replies

AutoCAD: Batch plotting to PNG

We have had a PDF based archive for quite a while but a new resource tool ( "ThinkWise" ... ) cannot work with PDF, or DWF or whatever the rest of the world uses and needs PNG. ( yes, it's really worth it's price šŸ˜‰ )

 

The batch plot utility of AutoCAD 2015 will only use the plotter named in page setup or PDF or DWF(x)

 

This means that we need to change the default printer in the page setups of all drawings in the archive to "PublishToWeb PNG.pc3".

 

Now, if I manually change the "DWG to PDF" plotter for the PNG one... the paper size is retained and a scale factor of 11.81 to 1 is automatically introduced.

 

If I use any form of batch script/lisp/vla to change multiple files... the scale factor does not come across... and all pictures become really small.

 

I need help to get the scale factor to be set as well... - if only because I will need to set it back to PDF automatically as well (including 1:1 scale) , because that is what the people expect it to print like...

 

( currently I'm using the JTB World "PlotDevicesFunctions.lsp" (renamed to B_Sub_Plotters) a lot... but that doesn't have any scale)

 

( defun c:test (/)
( load "B_Sub_Plotters" )
( foreach B_ITEM ( layoutlist )
	( setvar "ctab" B_ITEM )
	( vla-putplotter "PublishToWeb PNG.pc3" )
	;( vla-put-StandardScale ( list B_ITEM ( vla-get-PlotConfigurations ( vla-get-ActiveDocument (vlax-get-acad-object))  ) ) acScaleToFit )
	;11.81:1
)
)

 

3 REPLIES 3
Message 2 of 4
hmsilva
in reply to: Anonymous

Without seeing the vla-putplotter function, to set the scale 11.81:1 to the ActiveLayout try

 

(setq aclyt (vla-get-ActiveLayout (vla-get-activedocument (vlax-get-acad-object ))))
(vla-SetCustomScale aclyt 11.81 1 )

 

 

Henrique

EESignature

Message 3 of 4
Anonymous
in reply to: hmsilva

Thanks, although in the end it's been a hell:

 

the papersize ACAD fills out automatically when you switch from PDF A4 paper to PNG pixels is a custom one as well... Which means that the canonical medianame will not work unless you add it as a custom to the printer, which means you need to save the customized printer .pc3 somewhere...

 

AutoCAD can deal with that constriuction very badly and as a result I've seen too many fatal errors to recall over the past 2 days.... having to rebuild the path or the pc3 file (and PMP etc) every time.

 

For those that may want to get into this mess as well, here's the finalized code.... just take it from me that you'll prefer to stick to PDF or at least a standard paper size.

 

( defun c:PDF2PNG ( / B_ITEM B_CTAB )
	( foreach B_ITEM ( layoutlist )
		( setvar "ctab" B_ITEM )
		( setq B_CTAB ( vla-get-activelayout ( vla-get-activedocument ( vlax-get-acad-object ) ) ) )
		( vla-put-configname B_CTAB "PublishToWeb PNG.pc3" ) 
		( vla-setcustomscale B_CTAB 11.81 1 )
		( vla-put-canonicalmedianame B_CTAB "User-1" )
	)
	( setvar "ctab" "Model" )
( princ )
)

 

And Autodesk: fix that Publishtoweb printer (JPG and PNG) - it's a disgrace. (no antialiasing, transparancy, etc etc ?!)

Tags (1)
Message 4 of 4
hmsilva
in reply to: Anonymous


@Anonymous wrote:

Thanks, although in the end it's been a hell:

 


I perfectly understand what you mean...

 

I did some testing, trying to reproduce that behavior, and oddly the media name returned from the vla-get-CanonicalMediaName  "UserDefinedRaster (1362.00 x 962.00Pixels)" was not the returned from the vla-getLocaleMediaName "User 1 (2480.31 x 3507.87 Pixels)" and this media name is the displayed when plotting, and the media name I saved at the .pc3...
If I use the "UserDefinedR..." in the vla-put-canonicalmedianame, the correct media is displayed and everything works as expected...
Weird...

 

 

Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

ā€Boost