几何尺寸与公差论坛

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

【转帖】pdmwe api question

[复制链接]
发表于 2009-4-13 13:21:56 | 显示全部楼层 |阅读模式
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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-23 04:49 , Processed in 0.037699 second(s), 20 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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