The only part I don’t like about a new release is updating my sample apps.  Just like with last year, I don’t have time to update all my apps.  I’m just going to focus on the ones that are important to me. 

vLogic looks like a good place to start, even though I just built the 2012 version a couple months ago.  It’s one of those apps that I immediately wanted to add features to right after I posted it. 


New for Vault 2013: 

Event support – vLogic scripts now come in two flavors.  Command scripts are invoked by the user when they click on the menu command.  Event scripts are invoked automatically when actions take place.  These scripts hook right into the web service command events, so you can run scripts during a checkout, add folder, delete item, and so on.  I also put in hooks for the OnLogOn and OnLogOut event in Vault Explorer.

There is a naming convention to determine which .ps1 files hook to which events.  See readme for more details.  Note, the example event scripts are inactive after installation.  You need to remove the ‘_’ prefix and restart Vault Explorer for those scripts to run.

Easier navigation – Hold down the SHIFT key when running the “Create New Command” menu item and an explorer window will open to the vLogic folder.


vLogic Features:

  • No Visual Studio required to write custom commands and event handlers.
  • No compile step.
  • No deploy step.
  • Commands can be updated without having to exit Vault Explorer.
  • Easy to share scripts or modify scripts from others.

Requirements:

  • Vault Workgroup/Collaboration/Professional 2013
  • Windows PowerShell (should already be part of your OS)

Click here to download the application
Click here to download the source code


Upgrading from vLogic 2012:

Your old scripts need to move to the “%ProgramData%\Autodesk\Vault 2013\Extensions\vLogic\command scripts” folder.  Some API functions have changed in 2013.  See the Vault 2013 SDK documentation for a list of all changed functions.  If the parameters are wrong on an API function, it will result in a runtime error.


To use:

Run the install and start Vault Explorer.

Under the Tools menu is the vLogic menu.  This is where you can run existing scripts or create new scripts.
To create a new command script, select Create New Command from the vLogic menu.  After giving your script a name, you will have to re-start Vault Explorer.  When the program re-starts, your command should show up in the vLogic menu.

To edit a script, hold the shift key and click on the command.  The PowerShell ISE should pop up, allowing you to edit the script while Vault Explorer is running.  When you are done with your changes, save the file in the editor.

To run a script, run the command from the vLogic menu.

To delete a script, go to %ProgramData%\Autodesk\Vault 2013\Extensions\vLogic[script folder] and remove the .ps1 file.  You can also add commands by putting .ps1 files into the appropriate folder.

As with all the samples on this site, the legal disclaimer applies.


Comments

8 responses to “vLogic 2013”

  1. Hi Doug,
    I’ve honestly tried. Almost a week without any visible progress :(
    IMHO to give some boost to the topic several “snippets” for admin-daily-tasks need to be shared.
    Could you provide at least 3 for:
    – Searching objects (files, items etc) by criteries.
    – Editing Items (change ItemNumber, fill UDP etc).
    – Editing ECOs (ex. change routing).
    Thank in advance.

  2. Sure, I can provide some vLogic examples. What things are giving you difficulty? Is it PowerShell? The Vault API? Both?

  3. In the section “To use:” where the post says “you will have to re-start Vault Explorer” means you need to restart Vault and log out of Inventor (and presumably any other logged in client). I was confused that I could not see the newly created Command until I logged out of Vault from Inventor and restarted Vault Client.

  4. No. “Vault Explorer” is the name of the Vault client application. vLogic only runs in Vault Explorer, so that’s the only thing to restart.
    You do not need to restart Inventor.

  5. Have you tried reseting ribbon? Without reseting I also can’t see new scripts.

  6. Finally my interest have returned to the topic. I’ve just tried first sample and got incomplete results. My guessing – It only shows first 100 matches. What are possible options of workaround this?

  7. I wonder why nothing retuns if i try to find Items with title contains “a”?

    $propertyDefinitions = $serviceManager.PropertyService.GetPropertyDefinitionsByEntityClassId(“ITEM”)

    The search condition: State is “Released”

    $ItemTitle = new-object Autodesk.Connectivity.WebServices.SrchCond
    $ItemTitle.PropTyp = [Autodesk.Connectivity.WebServices.PropertySearchType]::SingleProperty
    $ItemTitle.SrchRule = [Autodesk.Connectivity.WebServices.SearchRuleType]::Must
    $ItemTitle.PropDefId = $propertyDefinitions | Where-Object {$_.SysName -eq “Title(Item,CO)”} | Select-Object -ExpandProperty Id
    $ItemTitle.SrchOper = 3
    $ItemTitle.SrchTxt = “a”
    $bookmark = [System.String]::Empty
    $searchStatus = $NULL
    $searchResults = $serviceManager.ItemService.FindItemRevisionsBySearchConditions(
    @($ItemTitle), $NULL, $True, [ref]$bookmark, [ref]$searchStatus)
    $searchResults | Select-Object -ExpandProperty ItemNum

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading