Last active
October 26, 2021 08:53
-
-
Save slydlake/cb48278f71af47604543e2dd024d86fa to your computer and use it in GitHub Desktop.
[Folder Props to File Props] Save Dialog Inventor/Vault #VDS #powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#retrieve property value given by displayname from folder (ID) | |
function CDNGetFolderPropValue ([Int64] $mFldID, [STRING] $mDispName) | |
{ | |
$PropDefs = $vault.PropertyService.GetPropertyDefinitionsByEntityClassId("FLDR") | |
$propDefIds = @() | |
$PropDefs | ForEach-Object { | |
$propDefIds += $_.Id | |
} | |
$mPropDef = $propDefs | Where-Object { $_.DispName -eq $mDispName} | |
$mEntIDs = @() | |
$mEntIDs += $mFldID | |
$mPropDefIDs = @() | |
$mPropDefIDs += $mPropDef.Id | |
$mProp = $vault.PropertyService.GetProperties("FLDR",$mEntIDs, $mPropDefIDs) | |
$mProp | Where-Object { $mPropVal = $_.Val } | |
Return $mPropVal | |
} | |
# AutoCAD/Vault "Erstellt durch" und "Erstellt am" | |
function AddHandlerCreateMode | |
{ | |
try | |
{ | |
#Erstanlage setzen | |
$_myServer = $vaultConnection.Server | |
$_myVault = $vaultConnection.Vault | |
$_myId = $vaultConnection.UserID | |
$_myTicket = $vaultConnection.Ticket | |
$_myIdKey = $vaultConnection.IdentityKey | |
$_user = $vault.AdminService.GetUserByUserId($_myId) | |
$_name = $_user.Name | |
if($dsWindow.Name -eq "FileWindow"){ | |
$Prop["Erstanlage durch"].Value = $_name | |
$Prop["Erstanlage am"].Value = ([datetime]::now).ToString("dd.MM.yyyy") | |
} | |
if($dsWindow.Name -eq "InventorWindow"){ | |
#$Prop["CDN_Erstelltvon"].Value = $_name | |
#$Prop["CDN_Erstelltam"].Value = ([datetime]::now).ToString("dd.MM.yyyy") | |
} | |
if($dsWindow.Name -eq "AutoCADWindow"){ | |
$Prop["ERSTELLT"].Value = $_name | |
$Prop["DATUM_ERSTELLT"].Value = ([datetime]::now).ToString("dd.MM.yyyy") | |
} | |
} | |
catch | |
{ | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#function InitializeWindow | |
#.... | |
#switch($mWindowName) | |
# { | |
# "FileWindow" | |
# { | |
#... | |
#TNFT 14.09.2020 | |
#CIDEON: write document propertie from Vault folder propertie | |
$SelFldr = $vault.DocumentService.GetFolderByPath($Prop["_FilePath"].Value) | |
$SelFldrID = $SelFldr.Id | |
$Prop["Projektname"].Value = CDNGetFolderPropValue $SelFldrID "Projektname" | |
$Prop["Projektnummer"].Value = CDNGetFolderPropValue $SelFldrID "Projektnummer" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment