几何尺寸与公差论坛------致力于产品几何量公差标准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-12, 10:01 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】pdmworkgroups api - pdmwproperties.update

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


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】doc manager api requires presence of solidworks explorer yang686526 SolidWorks二次开发 0 2009-04-12 08:41 PM
【转帖】solidworks 2008 api book - released yang686526 SolidWorks二次开发 0 2009-04-12 07:38 PM
【转帖】doc manager api requires presence of solidworks explorer yang686526 SolidWorks二次开发 0 2009-04-12 06:00 PM
【转帖】外挂开发中的封包技术 huangyhg vc编程 0 2007-12-03 04:41 PM
【转帖】对于hook函数的一点认识 huangyhg vc编程 0 2007-03-27 11:53 AM


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


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