Issue
Associations of a file in Vault have been altered with the cmdlet Update-VaultFile. The file and it's dependencies are copied via "Copy-Design" in Vault, but when the copy gets checked out in Inventor, it still references it's original dependency instead of the copied one.
Cause
The file in Vault is missing some important CAD-information about file associations after the file is updated with Update-VaultFile. When using powerVault 17.0.18 or lower, the Update-VaultFile cmdlet removes some CAD related information on the existing file associations. Those are "Source" and "RefIf". Additionally the ExpectedVaultPath is not set correctly because it only contains the Vault folder path instead of the full path with filename.
This happens only when using the commandlet with one of the following arguments:
- Attachments
- RemoveAttachments
- AddAttachments
- Childs
- RemoveChilds
- AddChilds
Solution
To resolve this issue follow these steps:
- Identify the exact commit where Update-VaultFile was used with one of the affected parameters in the file history of Vault (the comment will help)
- Retrieve the file associations before this commit was made. They will contain the correct CAD information.
- Update the latest file version with the original Source and RefId data for the associations and extend the ExpectedVaultPath with the filename of the associated document.
The default comment from powerVault when updatng associations (Attachments or Children) is "powerVault: child references Updated"
powerShell Module
We provide a powerShell Module which restores the deleted CAD information and fixes the ExpectedVaultPath.
How to use:
- Download the powerShell Module in the attachments
- Unblock the downloaded zip file
- Extract the zip
- Open a powerVault ISE
- Call Open-VaultConnection
- Import the powerShell Module RestoreCADInformation.psm1 in yor runspace
- Call Restore-CADInformation or Restore-CADInformationByExtensions (You can find information about the functions below)
Requirements:
- Autodesk Vault Professional / Workgroup 2016 / 2017
Example:
Import-Module "C:\Users\$($env:USERNAME)\Desktop\RestoreCadInformation.psm1"
Open-VaultConnection
Restore-CadInformationByExtensions -FileExtensions @("iam")
Use these functions at your own risk!
Restore-CadInformation
Restores the right CAD information for corrupted file associations. This cmdlet will check if the passed files have corrupted CAD information, if so it will try to find the missing information in previous file versions. When it succeeded to find them it will checkout and check in with the right CAD information. When one of following criteria fulfills it will not check in the file:
- The file is already checked out
- Not all missing information was found in previous versions
Restore-CadInformation [[-Files] <Object>] [[-FixComment] <Object>]
Type | Name | Description | Mandatory | Default value |
[Autodesk.Connectivity.WebServices.File[]] | Files | Restores files in the connected vault. | true | |
String | FixComment | When files are checked in this comment will be used. | false | Restored CAD Information by Repair script |
Example:
Open-VaultConnection
$file = Get-VaultFile -File "$/Designs/Assembly3.iam"
$vaultFile = $vault.DocumentService.GetFilesByIds(@($file.Id))
Restore-CadInformation -Files @($vaultFile) -FixComment "fixed missing CAD information"
Restores the missing CAD information for passed file extension in Vault. All files ending in the passed extension are searched from root recursively. As default all files with the extension "DWG" are searched. Then the function Restore-CadInformation will be called with the found files and a progress bar will be shown in a powerShell environment.
Parameters
Type | Name | Description | Mandatory | default value |
String[] | FileExtensions | Restores files with the passed extension found recursive in the connected vault. | true | dwg |
Example:
Open-VaultConnection
Write-Log "Start restoring CAD information $(Get-Date)"
Restore-CadInformationByExtensions -FileExtensions @("iam")
Write-Log "Finished restoring CAD information $(Get-Date)"