几何尺寸与公差论坛

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

【转帖】how to save a proe file from solidworks

[复制链接]
发表于 2009-4-12 18:38:27 | 显示全部楼层 |阅读模式
how to save a proe file from solidworks
anybody know the right api for saving (save as) a proe file (.prt) from a solidworks partfile (.sldprt).
the api saveas2 (as recorded) does not work.
thanks
raghawendra
eaton technologies
pune, india.
saveas works fine, how are you using it?
i was using saveas2 (as recorded through a macro) ... if saveas works fine, then gr8, let me use it.
thanks for quick reply.
thanks
raghawendra
try the following codes.
' ************************************************
' save as proe part file. work only on part file.
' saves the proe file with the same name and same location.
' please make sure the sw file is saved.
' ************************************************
dim swapp as sldworks.sldworks
dim modeldoc as sldworks.modeldoc2
sub main()
set swapp = application.sldworks
set modeldoc = swapp.activedoc
if not modeldoc is nothing then
filetyp = modeldoc.gettype
if filetyp = swdocpart then
dim filepath as string
dim pathsize as long
dim pathnoextension as string
dim newfilepath as string
filepath = modeldoc.getpathname
pathsize = strings.len(filepath)
pathnoextension = strings.left(filepath, pathsize - 6)
newfilepath = pathnoextension & "prt"
modeldoc.saveas2 newfilepath, 0, true, false
msgbox "good, you done it"
else
msgbox "current document is not a part."
end if
else
msgbox "no active part found in solidworks."
end if
end sub
deepak gupta
sw2007 sp5.0
sw2009 sp2.1
swmodel.extension.saveas("test.prt", 0, 0, nothing, lerrors, lwarnings)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-22 18:00 , Processed in 0.034273 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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