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

pdmwe api question
during migration from workgroup to enterprise, some of our large vaults (200+ gb) had to be "partitioned" to facilitate successful completion. unfortunately, we didn't have an option clicked in the migration tool which ensured that file references within assemblies would be resolved to the new vault directory structure. this resulted in a large number of "orphaned" parts in some of our largest assemblies. try to open, and "boom" the assembly blows up.
since we can't reasonably expect our engineers to find a ton of parts to fix the assemblies, and we can't re-migrate, i have created an application that "fixes" the references. in short, it populates the pathupdates and path tables of the vault database with the old and new paths. when the assembly is checked out, pdmwe checks these tables and resolves the references on the fly. the problem is that if the assembly is not checked out, the references are not resolved.
so here is where i am at...
i need to programmatically check out each affected assembly, make some innocuous change, and then check it back in. upon check out/opening of the file, the references will be "fixed", and then saved to a new version (with correct references) upon check in. this process works exactly as described when practiced through solidworks.
however, i am stumped - here is my commented code including my question:
**********************************************************************************
private sub pushver()
'log into vault
dim vault as edmvault5 = new edmvault5
vault.loginauto(scurrvault, 0)
'get list of assemblies
dim drassemblies as sqlclient.sqldatareader
dim squery as string
squery = "select distinct pathupdates.documentid, documentsinprojects.projectid, projects.path, documents.filename, revisions.root from projects inner join documentsinprojects on projects.projectid = documentsinprojects.projectid inner join pathupdates on documentsinprojects.documentid = pathupdates.documentid inner join documents on documentsinprojects.documentid = documents.documentid inner join revisions on documents.documentid = revisions.documentid"
drassemblies = sqlhelper.executereader(scvconn, commandtype.text, squery)
'iterate through assemblies
if drassemblies.hasrows then
while drassemblies.read
'get the interface of the file (and its parent folder)
dim file as iedmfile5
dim folder as iedmfolder5
folder = vault.getfolderfrompath(drassemblies.item("root") & drassemblies.item("path"))
file = folder.getfile(drassemblies.item("filename"))
'lock the file
file.lockfile(folder.id, 0)
'here is where i am stumped... what can i do to "change" the file enough to trigger a version increment???
'unlock the file
file.unlockfile(folder.id, 0)
file = nothing
end while
end if
end sub
**********************************************************************************
any help from y'all will be greatly appreciated!!!
eric
traditional flint ridge greeting:
it's not much of a house, but we've got one heckuva basement!
---* bump *---
traditional flint ridge greeting:
it's not much of a house, but we've got one heckuva basement!
eric,
the only way i am aware of is to change a variable value in the card. use getvar and setvar. temporarily store the variable value and delete it using setvar, save (not check in), then change it back to its original value and save. this is enough to triger a new version to be created on check in.
mike spens
"automating solidworks using macros"
leap frog leap pad x64
quick
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】api question yang686526 SolidWorks二次开发 0 2009-04-13 08:59 AM
【转帖】pdmwe api question get configuration from iedmreference5 yang686526 SolidWorks二次开发 0 2009-04-12 10:01 PM
【转帖】newbee question on adding components w sw api yang686526 SolidWorks二次开发 0 2009-04-12 09:54 PM
【转帖】外挂开发中的封包技术 huangyhg vc编程 0 2007-12-03 04:41 PM
【转帖】对于hook函数的一点认识 huangyhg vc编程 0 2007-03-27 11:53 AM


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


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