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

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?