Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Addin to delete local copy of files

9 REPLIES 9
Reply
Message 1 of 10
bsee1
762 Views, 9 Replies

Addin to delete local copy of files

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.

*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1
9 REPLIES 9
Message 2 of 10
BLHDrafting
in reply to: bsee1

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.

Brendan Henderson

Web www.blhdrafting.com.au
Twitter @BLHDrafting

Windows 7 x64 -64 GB Ram, Intel Xeon E5-1620 @ 3.6 GHz
ATI FirePro V7800 2 GB, 180 GB SSD & 1 TB HDD, Inv R2016 PDSU SP1 (Build 210), Vault 2016 Professional Update 1 (Build 21.1.4.0)
Message 3 of 10
bsee1
in reply to: BLHDrafting

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?

 

  • Determine if any files are checked out. If so, prompt user. Cancel delete process until user finishes.
  • Move all files except project file and templates to temp folder with date and time. Folders will be permanently deleted after 7 days.
  • Recreate library folders

Any suggestion for how to determine if the user has any files checked out?  I'm not sure how to do this programmatically.

*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1
Message 4 of 10
BLHDrafting
in reply to: bsee1

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/

Brendan Henderson

Web www.blhdrafting.com.au
Twitter @BLHDrafting

Windows 7 x64 -64 GB Ram, Intel Xeon E5-1620 @ 3.6 GHz
ATI FirePro V7800 2 GB, 180 GB SSD & 1 TB HDD, Inv R2016 PDSU SP1 (Build 210), Vault 2016 Professional Update 1 (Build 21.1.4.0)
Message 5 of 10
ekinsb
in reply to: bsee1

For checking the file state you'll need to use the Vault API, rather than the Inventor API.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 6 of 10
bsee1
in reply to: bsee1

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.

*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1
Message 7 of 10
bsee1
in reply to: bsee1

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?

*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1
Message 8 of 10
jdkriek
in reply to: bsee1

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.

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 9 of 10
jdkriek
in reply to: jdkriek

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
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 10 of 10
bsee1
in reply to: jdkriek

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\";
*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report