Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Run VBA routine on state change

5 REPLIES 5
Reply
Message 1 of 6
Lance127
957 Views, 5 Replies

Run VBA routine on state change

We are having problems making sure our sheet metal burn files get created when we complete a design in Inventor. We have a VBA routine that exports the flat pattern to a dwg/dxf for our plasma cutter but we have to remember to run it. What I'd like to do is to export the flat pattern when the lifecycle state is changed to "Released" with either our current routine or some other method. Is this even possiable and if it is can anybody point me in the direction to start.

 

I'm open to any other ideas as well.

 

We are currently using Vault 2013 pro.

 

 


Lance W.
Inventor Pro 2013 (PDS Ultimate)
Vault Pro 2013
Windows 7 64
Xeon 2.4 Ghz 12GB
Tags (2)
5 REPLIES 5
Message 2 of 6
Daniel.Du
in reply to: Lance127

Hi,

 

It is possible to hook up the life cycle event with customized business logic. Please refer to Doug's video: 

Part 5 - Business Logic Customization Through Events

http://justonesandzeros.typepad.com/blog/2012/02/6-hours-of-video-on-the-vault-api.html

 

 

For your case, you can conver your VBA routine to .net and execute it in lifecycle event.

 



Daniel Du
Developer Technical Services
Autodesk Developer Network

Message 3 of 6
marcin_otręba
in reply to: Lance127

Hi This is posible but not on lifecycle change but on checking in files from inventor to vault, i belive it give the same effect... if you are interessed please write me an email so i coud  provide you some code

 

best regards

marcin.j.otreba@gmail.com

Message 4 of 6
Lance127
in reply to: marcin_otręba

Thanks but I can run it automatically already. What I'm looking for is to run it when the file is released. We might not want it run just when a file is checked in. I'm watching the videos and trying to work on that.

Lance W.
Inventor Pro 2013 (PDS Ultimate)
Vault Pro 2013
Windows 7 64
Xeon 2.4 Ghz 12GB
Message 5 of 6
Daniel.Du
in reply to: Lance127

Yes, it is possbile to hook up an event handler when lifecycle state changes with help of LifecycleEventEditor. You must have known that if you went through doug's video. This tool is in Vault SDK:

 

C:\Program Files (x86)\Autodesk\Autodesk Vault 2014 SDK\util\LifecycleEventEditor



Daniel Du
Developer Technical Services
Autodesk Developer Network

Message 6 of 6
marcin_otręba
in reply to: Lance127

#=============================================================================#
# PowerShell script sample for coolOrange powerJobs #
# Create a local DWF file #
# #
# Copyright (c) coolOrange s.r.l. - All rights reserved. #
# #
# THIS SCRIPT/CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER #
# EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES #
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. #
#=============================================================================#

Import-Module "$env:POWERJOBS_MODULESDIR\coolOrange.PowerJobs.VaultHelper.psm1"

# creating the $vault,$vaultConnection,$powerJobs and $file object for the Debugger and for the PowerJobs environment
$file = PrepareEnvironmentForFile "Mounting Bracket.ipt" $true

$powerJobs.Log.Info("Starting job 'Save local as SheetMetal dxf' ...")

# limit publishing to 2d inventor files
$ext = [System.IO.Path]::GetExtension($file.EntityName).ToLower()
if($ext.Equals(".ipt"))
{

$publisher=$powerJobs.GetPublisher("SHEETDXF")
$publisher.Options="FLAT PATTERN DXF?AcadVersion=2000&BendLayer=0&OuterProfileLayer=0&InvisibleLayers=IV_TANGENT;IV_BEND;IV_ARC_CENTERS;IV_BEND_DOWN;IV_INTERIOR_PROFILES"
$publisher.add_OnBeginPublish(
{
param($publisher, $document)
$compDef = $document.Document.ComponentDefinition
if($compDef.HasFlatPattern -eq $false)
{
$compDef.Unfold()
$document.Document.Save()


}
})
$folder=$vaultConnection.EntityOperations.GetParent($file)
New-Item -Path "C:\TEMP\" -name $folder.EntityName -ItemType "directory"

$localDestFile = "C:\TEMP\" + "\" + $folder.EntityName + "\" +$file.entityName + ".dxf"
$publisher.OutputFile=$localDestFile

$powerJobs.Log.Info("Creating DXF file ...");
if ($publisher.Publish($file.EntityIterationId) -eq $false)
{
throw ("Publishing failed")
}
}

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

Post to forums  

Autodesk Design & Make Report