Vault Customization

Reply
Mentor
Lance_White
Posts: 154
Registered: ‎06-13-2011
Message 1 of 6 (270 Views)

Run VBA routine on state change

270 Views, 5 Replies
12-27-2013 07:13 AM

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
Board Manager
Daniel.Du
Posts: 182
Registered: ‎12-23-2008
Message 2 of 6 (260 Views)

Re: Run VBA routine on state change

12-29-2013 11:29 PM in reply to: Lance_White

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

Member
bystry16
Posts: 4
Registered: ‎10-10-2013
Message 3 of 6 (229 Views)

Re: Run VBA routine on state change

01-14-2014 06:50 AM in reply to: Lance_White

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

Mentor
Lance_White
Posts: 154
Registered: ‎06-13-2011
Message 4 of 6 (226 Views)

Re: Run VBA routine on state change

01-14-2014 07:00 AM in reply to: bystry16
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
Board Manager
Daniel.Du
Posts: 182
Registered: ‎12-23-2008
Message 5 of 6 (223 Views)

Re: Run VBA routine on state change

01-14-2014 05:06 PM in reply to: Lance_White

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

Member
bystry16
Posts: 4
Registered: ‎10-10-2013
Message 6 of 6 (185 Views)

Re: Run VBA routine on state change

01-27-2014 03:49 AM in reply to: Lance_White
#=============================================================================#
# 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:smileytongue:OWERJOBS_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")
}
}

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community