Before I start developing...
Does anyone else have a problem of users using files in their local workspace instead of getting the latest files from Vault? If so, how did you address this problem? Is there an existing addin that might help me enforce this problem?
This is an Inventor question because my next step will be to develop an Inventor addin which deletes files from a user's local workspace when they check the files in. I'm wondering if this approach is extreme, and if there's a better way. I'd appreciate any advice.
Constant battle this one. IMO proper procedures and adherance to them can help you withthis.
There is an option in the Inventor Vault Options to 'Delete working copy' on check in, but I don't know of anyway to lock this against change.
Remember of course that forcing a user to always get from vault is going to increase the time to work on files. One of the main purposes of Vault is to have files locally and to be working on them there. This greatly cuts down network traffic and server loads.
Well, it's sounding as if I'll be developing it regardless of my opinion on it. That said, here's what I plan to do. Any advice or changes you recommend?
Any suggestion for how to determine if the user has any files checked out? I'm not sure how to do this programmatically.
I'm not much of a programmer so I can't offer any insight for that. Have you had a look at the Inventor and Vault Exchnage store for an app that does what you want? It might already be there and save you some time. http://apps.exchange.autodesk.com/
For checking the file state you'll need to use the Vault API, rather than the Inventor API.
Just hoping to clarify a few things.
This blog post seems to suggest I can access the Vault API form an Inventor addin: http://adndevblog.typepad.com/manufacturing/2012/06/using-vault-apis-to-check-inout-files-from-an-in...
If I remember right, I can tell if a file is checked out by its file properties. I haven't tested it yet, but if I have a large number of files in my workspace, I can imagine checking each one individually might be slow. Is there a way to check an entire folder for checked out files? I only need to know if it contains any checked out files, not which ones they are. I'll let the user do that manually.
Another stumbling block. All documents/parts/assemblies/etc are closed. Inventor still has a "lock" on files in the workspace. I'd like to delete the workspace files, but it won't let me. Is there some way to convince Inventor those files aren't being used anymore?
You *could* delete the lockfile and empty the workspace, but I *do not* suggest you do this 😉
In my experience it's best to establish good practices with your users like:
*Make sure all files are checked in everyday before you leave.
*Empty your workspace every few days.
*Only work on files that are checked out
If you automaticly empty the workspace you are going to eventually remove something you don't want to.
If you insist on this method, I'd recommend Powershell (.ps1) which is already apart of Windows - short and sweet
# Clean.ps1 JDK 5-3-13 [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null # Prompt to Vault or Save files [System.Windows.Forms.MessageBox]::Show("Clean Workspace?" , "Clean" , 4) | Out-Null # Gracefully close Inventor if open (asks to save files) Get-Process Inventor | % { $_.CloseMainWindow() | Out-Null } # Clean up workspace. Leave folders except OldVersions. get-childitem "C:\Vault Local Files" -include *.lck, *.ipt, *.idw, *.iam, *OldVersions -recurse | foreach ($_) {remove-item $_.fullname -Force | Out-Null } # Prompt user to open [System.Windows.Forms.MessageBox]::Show("Start Inventor?" , "Start" , 4) | Out-Null # Start Inventor back. start-process Inventor.exe | Out-Null
This is how I was starting external exe:
Process p = new Process();
p.StartInfo.FileName = Properties.Settings.Default.exePath;
p.start();
Starting an exe this way will cause the exe to use your local workspace as the working directory. In my case, it caused an error when I tried to delete the files since the exe was in use.
The solution is to set the working directory of the exe like this:
p.StartInfo.WorkingDirectory = "C:\SomePath\";