Hello,
I have made an addin that responds to userinputevent "VaultCheckin"
This works, whenever I press the button to check in, the script runs.
A collegue discovered that when you close a drawing, and you get the prompt to 'check in', my script does not respond.
So this method of checking in sometimes happens, but I want my script to run with every check in.
So the question is: How to make my script so that it always does something when user checks in, not just by the userinputevent "vaultCheckin"
Thanks Arnold
This is a list of events when you check in to vault as an action (left) or close a drawing and inventor asks to check in (right)
Generated with event watcher in the SDK
Vault Check In Action | Close drawing with check in |
ApplicationEvents.OnSaveDocument BeforeOrAfter: kBefore HandlingCode: kEventHandled ApplicationEvents.OnSaveDocument BeforeOrAfter: kAbort HandlingCode: kEventHandled FileAccessEvents.OnFileResolution BeforeOrAfter: kBefore HandlingCode: kEventNotHandled TransactionEvents.OnCommit BeforeOrAfter: kBefore HandlingCode: kEventHandled TransactionEvents.OnCommit BeforeOrAfter: kAfter HandlingCode: kEventHandled UserInputEvents.OnActivateCommand CommandName: "VaultCheckin" UserInputEvents.OnTerminateCommand CommandName: "VaultCheckin" | ApplicationEvents.OnCloseDocument HealthStatusEnum = kUpToDateHealth BeforeOrAfter: kBefore HandlingCode: kEventNotHandled ApplicationEvents.OnCloseView BeforeOrAfter: kBefore HandlingCode: kEventNotHandled ApplicationEvents.OnDeactivateDocument BeforeOrAfter: kBefore HandlingCode: kEventNotHandled ApplicationEvents.OnCloseDocument HealthStatusEnum = kInErrorHealth BeforeOrAfter: kAfter HandlingCode: kEventNotHandled ApplicationEvents.OnTerminateDocument BeforeOrAfter: kBefore HandlingCode: kEventNotHandled ApplicationEvents.OnTerminateDocument BeforeOrAfter: kBefore HandlingCode: kEventNotHandled ApplicationEvents.OnTerminateDocument BeforeOrAfter: kBefore HandlingCode: kEventNotHandled ApplicationEvents.OnTerminateDocument BeforeOrAfter: kAfter HandlingCode: kEventNotHandled ApplicationEvents.OnTerminateDocument BeforeOrAfter: kAfter HandlingCode: kEventNotHandled ApplicationEvents.OnTerminateDocument BeforeOrAfter: kAfter HandlingCode: kEventNotHandled |
Can someone from Autodesk reply?
I need an action on vault check in, regardless of closing the document or pressing the button check in.
It depends what you are trying to achieve. You can use vault check in events to get notification of the file being checked in, you can prevent it being checked in subject to some limitations, but you cannot alter it before being checked in.
An alternative is to use before save or before close inventor events.
If you provide a bit more detail of what you want to do, I can respond in a bit more detail
I have a script that does not alter the document, but it has to trigger each time a document is checked in to Vault
I thought I solved it by responding to the VaultCheckIn User Event.
But it turns out that when an engineer is closing the document and recieves the question "Do you want to check in?"
That is not triggering the event VaultCheckIn.
VaultCheckIn UserEvent is completely useless now. Havent found an alternative yet
As you can see in my 2nd post, there is no checkin event when closing.
I'm looking forward seeing code that handles this in Vault API.
OK,
Code is below.. A few notes..
1) For the below code, you will only get an event if the user selects to check data in, if they cancel the dialogue. No events.
2) For the below code you will get 1 event for each file checked in (including any local dwf's generated). The event carries the filename being checked in.
3) You can wrapper the code below, in between a document close (before) and document close(after) event, or a vault checkin command activate and vault checkin command deactivate events to filter out the many events you will get.
If you need any more advice on working with the vault objects just let me know, or Doug Redmonds Vault customisation blog is Ace, in particular his 5 webinanars on Vault API on you tube. Its where I learnt anything I know about vault API.
Hope this helps.
You will need references in your project to the vault dll's
For Vault 2016...
C:\Program Files\Autodesk\Vault Professional 2016\Explorer\Autodesk.Connectivity.Extensibility.Framework.dll
C:\Program Files\Autodesk\Vault Professional 2016\Explorer\Autodesk.Connectivity.WebServices.dll
Import the vault webservices namespace.
Imports acw = Autodesk.Connectivity.WebServices
Provide a sub to handle the events
Private Sub check_restrictions(sender As Object, e As acw.CheckinFileCommandEventArgs)
Dim file As acw.File = Nothing
file = GlobalVar.vault_conn.Connection.WebServiceManager.DocumentService.GetLatestFileByMasterId(e.FileMasterId)
'above lines get the file data from vault.
' do some stuff here
End Sub
and finally add a handler to capture the event
AddHandler Autodesk.Connectivity.WebServices.DocumentService.CheckinFileEvents.GetRestrictions, AddressOf check_restrictions
---------------------------------------------------------------------------------------------------------------
There are 3 events you can capture..
GetRestrictions - Fires before A check in event occurs, allows blocking of the check in event (in theory).
Pre - Fires after restrictions have occured
Post - Fires after a check in event has occurred, can be used to determine success or fails.
OK, apologies missed some vital code out if you require to get a handle to the connection back to vault to find out more details about the file. All the below represents my code GlobalVars.Connection in the code I previously posted.
Add a project references to
"C:\Program Files\Autodesk\Inventor 2016\Bin\Connectivity.InventorAddin.EdmAddin.dll" (Inventor-Vault Addin)
"C:\Program Files\Autodesk\Inventor 2016\Bin\Autodesk.DataManagement.Client.Framework.Vault.dll"
"C:\Program Files\Autodesk\Inventor 2016\Bin\Autodesk.DataManagement.Client.Framework.dll"
Some imports
Imports edm = Connectivity.InventorAddin.EdmAddin
Imports Autodesk.DataManagement.Client.Framework.Vault.Currency.Connections
Imports vdf = Autodesk.DataManagement.Client.Framework
Now to access the vault connection you can use.
Public WithEvents Connection As vdf.Vault.Currency.Connections.Connection
If edm.EdmSecurity.Instance.IsSignedIn Then
Connection = edm.EdmSecurity.Instance.VaultConnection
else
Connection = nothing
End If