Description

If there is the need to download the active Inventor project file you can use following function:


function Save-ProjectFile($downloadDirectory) {
    $ipjVaultPath = $vault.DocumentService.GetInventorProjectFileLocation()
    $ipjFile = Save-VaultFile -File $ipjVaultPath -DownloadDirectory $downloadDirectory
    if (-not $ipjFile) { 
        return 
    }
    else {
        return $ipjFile
    }
}


This function requires a download directory as parameter and gets the Inventor project file using the Vault API, downloads the project file in the specified download directory with the powerVault cmdlet Save-VaultFile and returns the project file Object on success and $null if the project file could not be downloaded.


How to use

Copy this function in your job. If the function is needed in multiple jobs you can save it in a module (*.psm1) file in the directory "C:\ProgramData\coolOrange\powerJobs\Modules" . All functions in this path will be automatically loaded when starting a job, so you can use it right away in your jobs. To call the function you can use this sample code:

$ipjFile = Save-ProjectFile -DownloadDirectory <downloadPath>


Once you have downloaded the Inventor project file in a local directory you can use the new property "LocalPath" in your job, passing it as parameter in the Open-Document cmdlet.

$openResult = Open-Document -LocalFile $file.LocalPath -Options @{ FastOpen = $fastOpen; Project = $ipjFile.LocalPath }


See Also

Save-VaultFile (coolOrange Wiki)

$vault object (coolOrange Wiki)

Open-Document (coolOrange Wiki)