Share

$Prop[] Variable in Data Standard

The $Prop[] variable provides access to Vault properties when used in Data Standard for Vault, or CAD properties when used in Data Standard for CAD. Specifying the property name in the square brackets [] returns an IProperty object which can be used for getting and setting property values.

**Type:**Common.Wpf.IndexerForwarder, IProperty

Special Properties

For regular properties, the name of the property has to be used.

But there are special read-only properties that allow to access additional information through the $Prop variable. These properties have an underscore prefix (-).

Note: The availability column indicates in which PowerShell files the objects can be used. For example, Vault file dialog means, the PowerShell code is used in the context of a create and edit file dialog.

Special Property

Availability

Description

-Category

Vault: File, Folder, Custom Object

AutoCAD, Inventor

Type of value: string

Is set to the assigned category for an existing Vault object.

-CreateMode

Vault: File, Folder, Custom Object

AutoCAD, Inventor

Type of Value: bool

Can be used in PowerShell functions to determine if the Data Standard window is in create mode. This is the case when a file gets saved for the first time.

-CopyMode

Inventor, AutoCAD

Type of value: bool

Can be used in PowerShell functions to determine if Data Standard window is in copy mode. Set to true for the Data Standard functions Copy and Replace with Copy.

Note: When -CopyMode is true, -CreateMode is also set to true.

-EditMode

Vault: File, Folder, Custom Object

AutoCAD, Inventor

Type of value: bool

Can be used in PowerShell functions to determine if Data Standard window is in edit mode. Set to true for the Data Standard function: Datasheet.

-Format

Inventor

Type of value: string

Is set to the assigned format for an Inventor object or to the first element of ListValues.

Type of ListValues: List<string> Contains a list of formats which depend on the document type.

  • For Drawings: PDF, DXF, DWG
  • For Models: JT, STEP

-FileExt

Vault: File

AutoCAD, Inventor

Type of value: string

Contains the file extension.

-FileName

Vault: File

AutoCAD, Inventor

Type of value: string

Contains the file name without the extension.

-FilePath

Vault: File

AutoCAd, Inventor

Type of value: string

Contains the Vault file path (starting with $) without the file name.

-FolderName

Vault: Folder

Type of value: string

Contains the folder name.

-FolderPath

Vault: Folder

Type of value: string

Contains the Vault folder path (starting with $) without the file name.

-GeneratedNumber

Vault: File

Type of value: string

Contains the generated number. The value is set by the DSNumSchemeCtrl. See Numbering for more information.

-OriginalFileName

AutoCAD, Inventor

Type of value: string

Contains the source document's name during a Copy or Copy Include Drawing event.

-SaveCopyAsMode

Inventor

Type of value: bool

Value is set to true when an Inventor user clicks the Save Copy As button, otherwise value is false.

-SuggestedVaultPath

Inventor

Type of value: string

Contains the path of the directly related file, for example, the path of the parent assembly for components created in the assembly context, or the path of the main component view in the drawings.

-VaultVirtualPath

Inventor

Type of value: string

Contains the mapped virtual folder for Vault as defined in the Inventor project file.

-WorkspacePath

Inventor

Type of value: string

Contains the workspace path as defined in the Inventor project file.

Localization

When the property name in the square brackets [] starts with the prefix -XLTN- (e.g., $prop["-XLTN-TITLE-ITEM-CO"].Value), the name is mapped to the real property name of the localized Vault server version. See Localization for more information.

Object IProperty

The IProperty object is a wrapper for the underlying Vault or CAD property.

Note: The expression $prop["Title"] just returns an IProperty object for the property "Title." It does not return the direct value of the property.

Properties

Name

Type

Description

Value

object

Returns the value of the property. Can be used to get or set the property value.

IsValid

bool

Checks if the property is valid

IsInvalid

bool

Negation of IsValid. Useful because it is not easy to negate values in XAML.

ListValues

Object

Array

Only used for the special property "-Category." Returns a list of strings.

EnforceListValues

bool

Gets the existing value if any or can be set to override it.

IsObligatory

bool

Gets the existing value if any or can be set to override it.

Minimum Length

int

Gets the existing value if any or can be set to override it.

MaximumLength

int

Gets the existing value if any or can be set to override it.

Case

string

Gets the existing value if any or can be set to override it.

MinimumDate

DateTime

Gets the existing value if any or can be set to override it.

MaximumDate

DateTime

Gets the existing value if any or can be set to override it.

MinimumValue

int

Gets the existing value if any or can be set to override it.

MaximumValue

int

Gets the existing value if any or can be set to override it.

CustomValidation

ScriptBlock

Executes scriptblock and returns the result. The script block should return a bool value. When this is set, then all the other constraints are not executed.

CustomValidationErrorMessage

string

When the above CustomValidation returns false, any text set here will appear as tooltip on the control that this Prop object is bound to.

Events

Name

Description

PropertyChanged

Occurs when a property value changes. See Example-Using Events with the Data Standard Dialog for an example.

Examples

In PowerShell, properties can be accessed with the following syntax:

PowerShell

$fileName = $Prop["-FileName"].Value

The same object can be accessed through a XAML binding. However the syntax is slightly different:

XAML

<TextBox Text="{Binding Prop[-FileName].Value}"/>

Was this information helpful?