高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】solidworks api help - saving a par
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
|