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

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   SolidWorks二次开发 (http://www.dimcax.com/hust/forumdisplay.php?f=111)
-   -   【转帖】how to save a proe file from solidworks (http://www.dimcax.com/hust/showthread.php?t=4498)

yang686526 2009-04-12 06:38 PM

【转帖】how to save a proe file from solidworks
 
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)


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