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


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » SolidWorks二次开发
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


 
 
主题工具 搜索本主题 显示模式
旧 2009-04-13, 08:54 AM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】api - iedmfolder5.addfile

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
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭



所有的时间均为北京时间。 现在的时间是 12:07 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多