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

plot, print to pdf and open up a word document
hello,
i have made a macro.
it's printing my drawing and prints it to pdf, putting it in the same directory where the parts are located.
this works fine but,
is it possible that the macro also open up a ms word document?
thx.
sw 2008 sp 4.0
you may want to be a bit more specific. would you like your macro to literally just open a ms document and do nothing else, or print it, or something else..?
hello,
thx for the reply.
first of all i would like to open a ms word document, the macro that print and saves as pdf works already.
hope you get it
thx michel
sw 2008 sp 4.0
edited: 08/01/2008 at 03:17 am by michel opra
in that case you can just use the shell command to open the document by its default program (presumably ms word), for example:
shell "c:\myfile.doc", vbnormalfocus
ok thx, but i doesn't works, but this part (open a word documen) works already with a different command line
i have another question,
i would like to save the pdf as it's part name, let say 7021234.pdf but i would like to add the revision to it.
so it would be 7021234 revision a.pdf, and if you do a nother revision it turns to 7021234 revision b.pdf and so on.
hope you can help me with it.
sw 2008 sp 4.0
you need to read the custom property of the part using modeldoc2::extension::custompropertymanager, then using that custom property manager call
dim val1 as string
dim val2 as string
cpm.get2 "revision", val1, val2
and then val2 will have the revision value to use as you like
hello
thx, but i think that this part is to difficult for me.
maybe you can help me start. this is what i have for now.
where do i put the lines etc. ect.
thx
dim swapp as sldworks.sldworks
dim part as sldworks.modeldoc2
sub main()
set swapp = application.sldworks
set part = swapp.activedoc
dim filepath as string
dim pathsize as long
dim pathnoextension as string
dim newfilepath as string
filepath = part.getpathname
pathsize = strings.len(filepath)
pathnoextension = strings.left(filepath, pathsize - 6)
newfilepath = pathnoextension & "pdf"
modeldoc2:: extension:: custompropertymanager
part.saveas2 newfilepath, 0, true, false
set swapp = application.sldworks
set part = swapp.activedoc
set selmgr = part.selectionmanager
swapp.activedoc.activeview.framestate = 1
'part.printdirect
msgbox "saved as .pdf file and printed" & newpilepath
'open word drawing issue template
set appwd = createobject("word.application")
appwd.visible = true
appwd.documents.open filename:="r:\general office\templates\drawing-issue-note.docm"
end sub
sw 2008 sp 4.0
haven't testing anything but...
dim swapp as sldworks.sldworks
dim part as sldworks.modeldoc2
sub main()
set swapp = application.sldworks
set part = swapp.activedoc
dim filepath as string
dim pathsize as long
dim pathnoextension as string
dim newfilepath as string
dim valrev1 as string
dim valrev2 as string
filepath = part.getpathname
pathsize = strings.len(filepath)
pathnoextension = strings.left(filepath, pathsize - 7)
part.extension.custompropertymanager.get2 "revision", valrev1, valrev2
newfilepath = pathnoextension & "revision " & valrev2 & ".pdf"
part.saveas2 newfilepath, 0, true, false
set swapp = application.sldworks
set part = swapp.activedoc
set selmgr = part.selectionmanager
swapp.activedoc.activeview.framestate = 1
'part.printdirect
msgbox "saved as .pdf file and printed" & newpilepath
'open word drawing issue template
set appwd = createobject("word.application")
appwd.visible = true
appwd.documents.open filename:="r:\general office\templates\drawing-issue-note.docm"
end sub
msgbox "saved as .pdf file and printed" & newfilepath
be careful.
cad monkey
sw2k7 sp5.0
sw2k8 sp3.0
hello
thx dan hehehe wrong copy/past
at luke, thx for the quick reply's
but unfortunately,
sw 2008 sp 4.0
click for full image
sorry,
part.extension.custompropertymanager("").get2 "revision", valrev1, valrev2
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】part to pdf api yang686526 SolidWorks二次开发 0 2009-04-13 01:17 PM
【转帖】incorporating 3d pdf into existing file saving macro yang686526 SolidWorks二次开发 0 2009-04-13 12:14 PM
【转帖】cant figure out how get 3d pdf option enabled yang686526 SolidWorks二次开发 0 2009-04-13 09:33 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


所有的时间均为北京时间。 现在的时间是 05:47 AM.


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