几何尺寸与公差论坛

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

【转帖】solidworks api help - saving a par

[复制链接]
发表于 2009-4-13 14:29:06 | 显示全部楼层 |阅读模式
solidworks api help - saving a part
hey guys,
can anyone tell me why this code is not saving my part?
pdirectory = "m:\solidworks\tooling\inspect\" & tooltbx.text & "\" & tooltbx.text & ".sldprt"
if msgbox("save as " & pdirectory & "?", vbokcancel, "confirm save") = vbok then
    part.extension.saveas pdirectory, 0, 2, nothing, longstatus, longwarnings
    if msgbox("make a drawing?", vbokcancel, "create drawing?") = vbcancel then
        end
    end if
else
    exit sub
end if
find a job or post a job opening
hey, guy!
can you tell us what sort of thing actually does happen?   
-handleman, cswp (the new, easy test)
i figured it out. as is, the code does absolutely nothing. i changed the save command and added some code that created the appropriate folder if it does not exist and that solved my problems. here is that code if you were wondering.
folder = "m:\solidworks\tooling\inspect\" & tooltbx.text
set fso = createobject("scripting.filesystemobject")
if not fso.folderexists(folder) then
    fso.createfolder (folder)
end if
pdirectory = "m:\solidworks\tooling\inspect\" & tooltbx.text & "\" & tooltbx.text & ".sldprt"
if msgbox("save as " & pdirectory & "?", vbokcancel, "confirm save") = vbok then
    part.saveas2 pdirectory, 0, false, false
    if msgbox("make a drawing?", vbokcancel, "create drawing?") = vbcancel then
        end
    end if
else
    exit sub
end if
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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