几何尺寸与公差论坛------致力于产品几何量公差标准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-13, 02:03 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】save as pdf [resolved]

save as pdf [resolved]
i'm having trouble getting sw to save specified sheets only in a .pdf
boolstatus = swexportpdfdata.setsheets(swexportdata_exportspecifiedsheets, drawingsheets)
boolstatus = swmodeldocext.saveas(dexppath, 0, 0, swexportpdfdata, lerrors, lwarnings)
that is the code i have... and the variant drawingsheets only contains one sheet name, yet when the macro exports the .pdf there are 2 sheets saved.
ideas? if you want the rest of the code let me know and i will post it.
edited: 09/04/2008 at 08:53 am by blake dahle
blake,
can you do something with this?
filename = strings.left(filename, len(filename) - 6) & "pdf"
boolstatus = swexportdata.setsheets(swexportdata_exportallsheets, 1)
boolstatus = swmodeldocext.saveas(filename, 0, 0, swexportdata, lerrors, lwarnings)
if boolstatus then
all sheets are saved in 1 pdf, with the sheetnames in the overview.
peka
i'm trying to save the sheets seperately, but even though i specify the sheets it is including all sheets in the current document. i'm confused as to why... -.-
just a reminder, 2009 will have this functionality built in for pdf and dxf, if i remember right.
matt lorono
solidworks 2007 sp3.1
cad engineer/ecn analyst
originally posted by: matthew lorono
just a reminder, 2009 will have this functionality built in for pdf and dxf, if i remember right.
what will '09 have or do differently than what is available now?
drc inc.
minneapolis, mn
.designreadycontrols.com
sw2007 sp5.0
core2 quad
3gb ram
xp pro sp2
ati firegl v3600
blake,
i don't know what the rest of your code looks like, so i can't fully debug it. however, i was able to get the code below to work just fine exporting only sheets 2 & 3 (of 3). i did notice two things, though.
1) your variable storing what sheets to print should be a string, not a variant. i don't know why it matters, but when i use a variant it does the same thing as your macro and outputs all sheets instead of the sheets specified.
2) your swexportpdfdata object has the same name as the variable defining what type of export data to get in the swapp.getexportfiledata command. this gave me an error when trying to run the macro.
dim swapp as sldworks.sldworks
dim swpdfdata as exportpdfdata
dim swdoc as modeldoc2
dim swdocext as modeldocextension
dim strsheets(1) as string
dim boolstatus as boolean
dim lerrors as long
dim lwarnings as long
dim strpath as string
sub main()
set swapp = application.sldworks
set swdoc = swapp.activedoc
set swdocext = swdoc.extension
set swpdfdata = swapp.getexportfiledata(swexportpdfdata)
strpath = "c:\test.pdf"
strsheets(0) = "sheet2"
strsheets(1) = "sheet3"
boolstatus = swpdfdata.setsheets(swexportdata_exportspecifiedsheets, strsheets)
boolstatus = swdocext.saveas(strpath, 0, 0, swpdfdata, lerrors, lwarnings)
end sub
mahir abrahim, cswp/core. cswp/smtl
mechanical design engineer
sw 2009 sp2.1
proe wf3/4
thanks mahir.
it does indeed need to be a string array in order to execute properly. this contradicts what the sw api help file says, but thats not that big of a surprise.
appreciate the help.
also, you are right that if declared as such it would error out:
set swexportpdfdata = swapp.getexportfiledata(swexportpdfdata)
however if you look at the example in the help, it can also be declared as:
set swexportpdfdata = swapp.getexportfiledata(1)
but again thanks for the help, and i do have my export working properly now.
-blake d.
quick
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】pdmworks ent block and attribute names for pdf yang686526 SolidWorks二次开发 0 2009-04-13 01:23 PM
【转帖】help with a downloaded pdf macro yang686526 SolidWorks二次开发 0 2009-04-13 11:44 AM
【转帖】how to silent printing pdf from sw macro yang686526 SolidWorks二次开发 0 2009-04-12 09:24 PM
【转帖】how to silent printing pdf from sw macro yang686526 SolidWorks二次开发 0 2009-04-12 06:39 PM
下载好多软件 ping CAD资料交换区 6 2007-03-03 09:13 PM


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


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