几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » SolidWorks二次开发
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


 
 
主题工具 搜索本主题 显示模式
旧 2009-04-12, 10:06 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】problem with plotting

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
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭



所有的时间均为北京时间。 现在的时间是 01:46 PM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多