Hello,
Is there a way in Inventor which restricts the user from loading a file having same name.
Scenario:
I have one file in a location D:\Autodesk\Location1\Part1.ipt and second file in D:\Autodesk\Location2\Part1.ipt. (The Geometry and properties might be same or might not be same).
I open the first file Part1 from D:\Autodesk\Location1\Part1.ipt. Now this first file is loaded in Inventor session.
Now if i try to open second file Part1 from D:\Autodesk\Location2\Part1.ipt inventor should not allow me to open. (By Default Inventor allows, as the Location is different)
This is the case i want Inventor to handle...
How can i acheive this.?
You will need to have an addin running that monitors the application events.
Brian Ekins post on his blog have a great example on how to use events
Below is a rough example of what you need to do (please note I just threw this together and could have problems, it's just a guide)
Private Sub m_ApplicationEvents_OnOpenDocument( DocumentObject As Document, FullDocumentName As String, BeforeOrAfter As EventTimingEnum, Context As NameValueMap, HandlingCode As HandlingCodeEnum ) If BeforeOrAfter = EventTimingEnum.kBefore Then Try Dim strNewDoc As String = System.IO.Path.GetFileNameWithoutExtension(FullDocumentName) Dim oDoc As Document For Each oDoc In ThisApplication.Documents If System.IO.Path.GetFileNameWithoutExtension(oDoc.FullFileName) = strNewDoc Then ' Close the document DocumentObject.Close ' Havn't checked if .close is the correct call Exit Sub End If Next Catch Ex As Exception messagebox.show(ex.message) End Try End If