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

pdf export page select
hi,
do you know how to call the pop-pu box when you save your pdf (without macro) that allow you to select the pages that need to be save.
thanks,
steph
using acrobat pro, and using the pdf print driver, not the save as pdf.
the pdf sheet selection box should be there after you click the save button if you chose to save as pdf anyway, if its not and your in sw2008 click the options button before clicking save and check if there are any options for this (i cannot check at the mo just upgrading my sw08)
luke do you know if there is a bay to call the pdf sheet selection box with a macro ?
steph
stehane-
i don't think there's a way to do this--you'll have to create your own selection box. are you trying to give the operator the option to pick a specific sheet or sheets, or do you know in advance which sheets to output (ie the visible one)?
-jason s.
thanks for the answer jason,
i have done a list box (if more then 1 sheet is present) where i list the sheets available and the user can select the sheets he needs to export and it works fine.
steph
hi stephane,
i have been looking for a macro that exports a specific sheet from a multi sheet drawing but have been unsuccessful in finding one. all the ones i have found export all in one shot.
would you be able to share this macro by any chance.
thanks.
hi stephane,
i've also been looking for a macro that exports a single sheet in pdf format.
i also don't understand why the views within the sheet are placed in the pdf file when normally created.
i would be greatly appreciative of any help or if you could possibly share your macro.
thanks,
jim anglin
lube-power, inc.
janglin@lubepower.com
jim anglin
design engineer, emsug
lube-power, inc.
sw 2009 sp2.1
dell 390 2.6 ghz core 2 duo
4gb ram, xp32 pro sp3
ati firegl v7200
'you will need to create a form with :
'1 listbox : listbox1
'1 button : select
option explicit
dim swapp as sldworks.sldworks
dim swdoc as sldworks.modeldoc2
dim swmodeldocext as sldworks.modeldocextension
dim swexportpdfdata as sldworks.exportpdfdata
dim swdrawing as sldworks.drawingdoc
dim boolstatus as boolean
dim filename as string
dim lerrors as long
dim lwarnings as long
dim varsheetname as variant
dim path as string
dim fso as new filesystemobject
dim spathname as string
dim nerrors as long
dim nwarnings as long
dim nretval as long
dim bshowmap as boolean
dim bret as boolean
private sub cmdselect_click()
set swapp = application.sldworks
set swdoc = swapp.activedoc
set swdrawing = swdoc
set swexportpdfdata = swapp.getexportfiledata(1)
set swmodeldocext = swdoc.extension
dim lnglistitem as long
dim strsheetname(30) as string
for lnglistitem = 0 to listbox1.listcount - 1
if listbox1.selected(lnglistitem) then
strsheetname(lnglistitem) = listbox1.list(lnglistitem)
end if
next lnglistitem
varsheetname = strsheetname
path = swdoc.gettitle
filename = "c:\pdf\"
filename = filename + left(path, 4) + "\"
set fso = createobject("scripting.filesystemobject")
if fso.folderexists(filename) then
else
fso.createfolder (filename)
end if
filename = filename + left$(path, len(path) - 9) + ".pdf"
if swexportpdfdata is nothing then msgbox "nothing"
boolstatus = swexportpdfdata.setsheets(swexportdata_exportspecifiedsheets, varsheetname)
boolstatus = swmodeldocext.saveas(filename, 0, 0, swexportpdfdata, lerrors, lwarnings)
if left(path, 2) = "t-" then
bshowmap = swapp.getuserpreferencetoggle(swdxfdontshowmap)
swapp.setuserpreferencetoggle swdxfdontshowmap, false
filename = "c:\dxf\"
filename = filename + left$(path, len(path) - 9) + ".dxf"
bret = swdoc.saveas4(filename, swsaveascurrentversion, swsaveasoptions_silent, nerrors, nwarnings)
if bret = false then
nretval = swapp.sendmsgtouser2("problems saving file.", swmbwarning, swmbok)
end if
' restore old setting
swapp.setuserpreferencetoggle swdxfdontshowmap, bshowmap
else
bshowmap = swapp.getuserpreferencetoggle(swdxfdontshowmap)
swapp.setuserpreferencetoggle swdxfdontshowmap, false
'filename = swdoc.getpathname
'filename = left$(filename, len(filename) - 7) + ".dxf"
filename = "c:\dxf\"
filename = filename + left(path, 4) + "\"
set fso = createobject("scripting.filesystemobject")
if fso.folderexists(filename) then
else
fso.createfolder (filename)
end if
filename = filename + left$(path, len(path) - 9) + ".dxf"
bret = swdoc.saveas4(filename, swsaveascurrentversion, swsaveasoptions_silent, nerrors, nwarnings)
if bret = false then
nretval = swapp.sendmsgtouser2("problems saving file.", swmbwarning, swmbok)
end if
' restore old setting
swapp.setuserpreferencetoggle swdxfdontshowmap, bshowmap
end if
exportpdf.hide
end sub
private sub userform_activate()
set swapp = application.sldworks
set swdoc = swapp.activedoc
set swdrawing = swdoc
set swexportpdfdata = swapp.getexportfiledata(1)
set swmodeldocext = swdoc.extension
listbox1.clear
call vue
if listbox1.listcount = 1 then
cmdselect_click
end if
end sub
private sub vue()
dim swview as sldworks.view
dim arr_sheetnames() as string
dim strstartupsheetname as string
dim strsheet as string
dim strtablename as string
dim lngsheet as long
dim lnglistitem as long
dim bolresult as boolean
strstartupsheetname = swdrawing.getcurrentsheet.getname
arr_sheetnames = swdrawing.getsheetnames
for lngsheet = 0 to ubound(arr_sheetnames)
listbox1.additem (arr_sheetnames(lngsheet))
if lngsheet = ubound(arr_sheetnames) + 1 then
strsheet = strstartupsheetname
else
if arr_sheetnames(lngsheet) = strstartupsheetname then
goto next_sheet
end if
strsheet = arr_sheetnames(lngsheet)
end if
bolresult = swdrawing.activatesheet(strsheet)
next_sheet:
next lngsheet
end sub
steph
edited: 05/22/2008 at 03:27 pm by stephane demers
thanks steph.
i will give it a try. i am not very well versed in creating macros or forms but i will see what i can do. i will let you know if it turns out.
thanks again.
quick
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】custom export options yang686526 SolidWorks二次开发 0 2009-04-13 10:07 AM
【转帖】stl export of multibody par yang686526 SolidWorks二次开发 0 2009-04-12 10:54 PM
【转帖】propertymanager page problem yang686526 SolidWorks二次开发 0 2009-04-12 10:08 PM
【转帖】propertymanager page problem yang686526 SolidWorks二次开发 0 2009-04-12 07:20 PM


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


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