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: 

VaultCheckIn command

9 REPLIES 9
Reply
Message 1 of 10
Cadkunde.nl
884 Views, 9 Replies

VaultCheckIn command

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

 

9 REPLIES 9
Message 2 of 10
Cadkunde.nl
in reply to: Cadkunde.nl

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

Message 3 of 10
Cadkunde.nl
in reply to: Cadkunde.nl

Can someone from Autodesk reply?

 

I need an action on vault check in, regardless of closing the document or pressing the button check in.

Message 4 of 10
woodstylee3
in reply to: Cadkunde.nl

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

Message 5 of 10
Cadkunde.nl
in reply to: woodstylee3

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

Message 6 of 10
woodstylee3
in reply to: Cadkunde.nl

I'll post some code later. Rather than using the inventor api, using the Vault api is the way to go.
Message 7 of 10
fulvio81
in reply to: Cadkunde.nl

What about application event before close document?
Message 8 of 10
Cadkunde.nl
in reply to: fulvio81

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.

Message 9 of 10
woodstylee3
in reply to: Cadkunde.nl

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.

 

 

 

Message 10 of 10
woodstylee3
in reply to: woodstylee3

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

 

 

 

 

 

 

 

 

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

Post to forums  

Autodesk Design & Make Report