几何尺寸与公差论坛

 找回密码
 注册
查看: 827|回复: 0

【转帖】problem with plotting

[复制链接]
发表于 2009-4-12 22:06:28 | 显示全部楼层 |阅读模式
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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-23 14:18 , Processed in 0.035792 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表