|
problem with plotting
the following code is not setting custom paper sizes? i can't determine why? when i put watches on the "ps.printerpaperlength" and "ps.printerpaperwidth" values, they are changing from the default size. these are not carrying changing the size that is actually ploted. the value for ps.printerpapersize is set to a "custom" size for my plotter. by default this value is set to 1 until i change it to 257. i have tried leaving this out and still not positive results. any suggestions?
sub main()
dim printer as string
dim pagearray(0) as long
pagearray(0) = 0
set swapp = application.sldworks
set model = swapp.activedoc
set swdraw = model
set swsheet = swdraw.getcurrentsheet
set ps = model.pagesetup
if width = 41.5 and height = 24 then
model.printer = "engineering plotter"
printer = "engineering plotter"
ps.orientation = 2 ' 1=portrait '2 = landscape
ps.printerpapersize = 257
ps.printerpaperlength = 42 * 254 ' 42 inches
ps.printerpaperwidth = 24 * 254 ' 24 inches
ps.scaletofit = false
ps.scale2 = 100
ps.drawingcolor = 2
model.printpreview
end if
end sub
jj,
for the plotter i use, the paper sizes are predefined within the plotter driver. so the printerpapersize defines the paper size. i know that's not an exact answer to your problem, but might be a possible work around. below is a portion of code i use for plotting. for any particular paper size solidworks is using, i have it select a different paper size for the plotter.
select case sheetproperties(0)
case swdwgpaperbsize
pagesize = 266 'tabloid
case swdwgpapercsize
pagesize = 265
case swdwgpaperdsize
pagesize = 264
case swdwgpaperesize
pagesize = 263
case swdwgpapersuserdefined
if sheetproperties(5) < 0.432 then 'b size
pagesize = 266 'b size
elseif sheetproperties(5) < 0.8637 then '<+d size
pagesize = 264 'b size
elseif sheetproperties(5) < 1.12 then '<=e size
pagesize = 263 'b size
elseif sheetproperties(5) < 1.8289 then '36x72
pagesize = 289
elseif sheetproperties(5) < 2.439 then '36 x 96
pagesize = 290
else
pagesize = 266
pagesetup.scaletofit = true
end if
end select
papersource = 256 'auto
pagesetup.printerpapersize = pagesize
pagesetup.printerpapersource = papersource
thanks for the reply, i used to do this also, but when i installed sw2009 this stopped working. infact all of my predefined sheet sizes changed numbers. the other thing with this is that each machine has to be set up exactly the same, so i have to do extra work at all of the work stations to get this set up the same. if there is a way to pass these values into the custom format size, i think that would be the easiest way to handle workstation differences.
quick |
|