几何尺寸与公差论坛

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

【转帖】pdmworkgroups api - pdmwproperties.update

[复制链接]
发表于 2009-4-12 22:01:51 | 显示全部楼层 |阅读模式
pdmworkgroups api - pdmwproperties.update
hi,
i am trying to update a custom property field for all pdm workgroup records. my (pseudo)-code goes something like this:
for each document in alldocs
for each prop in document.properties
if prop.name = "targetprop" then
prop.value = ..... ' code to create value (possibly different for many records)
prop.update
endif
next
next
obviously, i am treading carefully when playing with changing values in the vault. and i have set the "allow change document properties" in the vault admin, but i have two questions - 1) will my updates bump the document revision (i am hoping not). 2) concerned about how slowly the alldocs was retrieved, i'm also concerned that the property update may be similarly slow - is there a mass update i can use or should i not be concerned?
thanks for your help
you are right; the help in solidworks is not helpful. i have "automatomating solidworks 2006 using macros" by mike spens. he covers the vault much better than sw help.
when i have written programs for pdm it does take a while for the alldocs to get the document information out of the vault. after alldocs gathers the information it is fast.
i believe that in mike's book he says you need to check the file in to bump up a revision, but i haven't changed properties in the vault. i have only taken files out.
dan miel
2008 sp5
thanks dan,
i have been after a good api book - i may get that one. meanwhile i have convinced myself to bite the bullet and try a mass update. the property i am altering is largely un-used, at the moment and so all should be quite safe!
i get the impression that the alldocs call just makes a copy of the vault data in the ram and further manipulations are done there, in/by the object model. this is what makes me think there might be (or should be) a group update - to put all the changes back into the vault, on mass.
anyway, i'll write the code, triple check it, run it and let you know how it goes (speed wise).
i have now ordered the book dan mentions from amazon but it's unlikely to turn up for some time, so i'm still muddling on with the solidworks help. the more i look at it the more i am thinking; i must be missing something, surely the useful stuff is burried in a link here somewhere? - but no, i can't find it! can anyone tell me; didn't the api help used to be better? didn't it used to explain all the parameters for methods and give fairly decent explanation of the usage? what is going on? why has it gone so terse on useful detail?
as for the main topic, i have written the software but have discovered for a mass update like this, you need to own every document for which you want to change its custom properties. the update speed doesn't seem too bad - nothing like as painful as the getdocs property assignment!
simon
if you are updating the custom properties in the part file it may be faster to check the part out change the property then check the file back in at the same revision level by using "read from file".
when you take a file out of the vault you do not need to go through alldocs.
set doc = conn.getspecificdocument(filename)
doc.save (filepath)
dan miel
thanks dan,
now i have had the software running, i have found that it is only the alldocs assignment that is slow. once the program gets going (updating properties) it is actually quite fast.
i am still quite miffed about what solidworks have done to the api help though! are they trying to stop us using it or something? if it's simply a ploy to get us all to go on the api training, it's still poorly thought out - we would still need the help when we get back from the courses.
best regards.
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-23 14:54 , Processed in 0.034350 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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