几何尺寸与公差论坛

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

【转帖】api - iedmfolder5.addfile

[复制链接]
发表于 2009-4-13 08:54:43 | 显示全部楼层 |阅读模式
api - iedmfolder5.addfile
i wrote a migration program to move all our drawings from a file management system we wrote a long time ago. i'm moving all the history (previous revisions) into the vault, but i'm running into this problem when i try to add files.
the api function i'm using is iedmfolder5.addfile. this function works great, except when i try to add a file with the same name.
here are the steps.
1.) copy the file into the engineering drawings folder in the vault.
2.) check to see if the required data card variable have been populated.
2a.) if data card variables are missing, query our internal database using the document number to get the required data, then set the value to the data card variable.
3.) check-in (unlock) the file.
4.) move the file through the workflow until it's in "released" status. revision letter assigned.
5.) change the state of the file to "revise".
6.) check-out (lock) the file.
7.) overwrite the checked-out file with the next revision from our old system.
-- this is were the iedmfolder5.addfile function fails
i have not been able to find a way to tell this function that it's okay to overwrite the existing file --
8.) goto step 2.
(this process repeats until all the revision for that document number are in the vault)
anyone have any experience using the iedmfolder5.addfile function? have you ever tried to overwrite a locked file in the vault using this command? any luck?
- kris
edited: 06/16/2008 at 11:42 am by kris jankiewicz
iedmfolder5.addfile is not a solidworks api function nor a pdm function, what api is this from exactly?
pdmwe.
answer just wanted to let everyone know that the .net {fileinfo}.copy() worked.
thanks lee young.
cheers,
kris
question: we are taking the first baby steps at looking at migration to pdmwe, do you know where we can get some sample code to do relatively simple migration?
tom
tmchugh@telsmith.com
tom,
what specifically are you trying to do? there is a migration tool included with pdmwe for moving from pdmworkgroup. you shouldn't have to do any programming for your migration. (me thinks.)
lee,
thanks for the "migration tool" pointer. we somehow missed that one.
(been reading & thinking a bit) but the tool doesn't seem to be exactly what we thing we need. close, but...
that's why kris's original post on this thread prompted my question.
we'd still be interested in looking at some sample code along the lines of a migration. just trying not to have to re-invent another wheel (with little or disjointed docs)...
tom
what kind of migration are you guys looking into doing tom?
we had files from autocad, inventor and mechanical desktop that needed to be moved into our pdmwe vault.
-kris
solidworks, autocad & the various doc, xls, pdf (legacy), etc. types of files.
file types though don't seem to be the initial problem. which is: finding some sample code that does a migration (the to part in migrate to is the first key). something. anything!
it seems to me that this is another case of the 80/20 rule: sample code will get us 80% of the way there, but it'll be the other 20% that will take us another six months. i'm just trying to find that first 80%, is all.
being a control freak can be frustrating at times.
tom
the sample code is there in the help. use kris' methods as an algorithm. here are the primary methods you need for each piece. there is sample code along with each one in the help.
iedmfolder6::addfiles
iedmfile5::lockfile
iedmfile5::unlockfile
iedmfile5::changestate
iedmfile5::incrementrevision
iedmrevisionmgr
iedmbatchupdate
the one place that isn't very clear is the revisionmgr interface. here is a sample usage. i took this out of some other code i had, so it may not be bulletproof (missing declarations?). it is in vb.net.
dim revmgr as iedmrevisionmgr2
revmgr = vault.createutility(edmutility.edmutil_revisionmgr)
dim revcounters() as edmrevcounter
dim revc as edmrevcounter
revc.mbscomponentname = "letters" 'this must be a revision component name
revc.mlcounter = asc(newrev_text.text) - 64
revcounters = system.array.createinstance(gettype(edmrevcounter), 1)
revcounters(0) = revc
revmgr.setrevisioncounters(file.id, revcounters)
'stop
revmgr.incrementrevision(file.id)
dim res as system.array
revmgr.commit("auto rev update on commit", res)
'res is the error output
i hope that helps!
mike spens
mike spens
"automating solidworks using macros"
leap frog leap pad x64
mike, thanks for the post. looks like a great starting point. (now if there was only a little more time to actually start...)
tom
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-24 00:14 , Processed in 0.038978 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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