Data Standard 模板

Data Standard 使用文档模板来创建新的 Data Standard 文件。

默认情况下,新标准文件函数会在 Vault 的 $\Templates 文件夹中查找文档模板。此路径可在 Data Standard File.xml 文件中进行修改。

管理员还可以选择为不同的应用程序指定单独的模板文件夹(例如,为 AutoCAD 模板指定一个文件夹,为 Inventor 模板指定另一个文件夹)。

工作方式

Data Standard 的默认“新建文件”对话框含有一个名为“文档类型”的组合框。

当用户从“文档类型”列表中选择一个选项并单击“确定”时,新的 Data Standard File 函数会在与该文档类型相关的 Vault 文件夹路径中查找模板。该模板用于生成新文件。

%programdata%\Autodesk\<Vault 版本>\Extensions\DataStandard\Vault\Configuration\File.xml

<?xml version="1.0" encoding="utf-8"?>
                <DocTypeData xmlns="">
                    <DocTypeInfo>
                        <DocName>Inventor</DocName>
                        <Path>$/Templates/Inventor</Path>
                    </DocTypeInfo>
                    <DocTypeInfo>
                        <DocName>AutoCAD Drawings</DocName>
                        <Path>$/Templates/AutoCAD</Path>
                    </DocTypeInfo>
                    <DocTypeInfo>
                        <DocName>Office Document</DocName>
                        <Path>$/Templates/Office</Path>
                    </DocTypeInfo>
                </DocTypeData>
           

元素 <Name> 定义了在“新建文件”对话框上的组合框中显示的值。元素 <TemplatePath> 对于用户是不可见的,它用于设置视图模型内的“TemplatePath”。

“文档类型”组合框如下所示:

...
<Label Content="Document Type" Grid.Row="2" Grid.Column="0" />
<ComboBox ItemsSource="{Binding Source={StaticResource DocTypes}, XPath=DocTypeInfo}"
          Name="DocTypeCombo"
          Grid.Row="2"
          Grid.Column="1"
          IsEnabled="{Binding IsNewEntryDialog}"
          DisplayMemberPath="Name"
          SelectedValuePath="TemplatePath"
          SelectedValue="{Binding TemplatePath}"
          SelectedIndex="0"></ComboBox>
...

属性 DisplayMemberPath 定义了将数据源中的哪个元素用于在组合框中显示。在本实例中,它被设置为 Name。

属性 SelectedValuePath 定义了将数据源(“TemplatePath”)中的哪个元素设置为要使用的模板路径值。

属性 SelectedValue="{Binding TemplatePath}" 设置了视图模型中的选定模板路径。必须将新的绑定特性“TemplatePath”添加到视图模型中。

Vault Office Data Standard 模板

Vault Office Client 提供了许多与 Vault Client 相同的功能,但它更为精简,并且专注于非 CAD 设计数据管理流程。由于 Vault Client 和 Vault Office Client 都有各自的 XAML,因此可以分别为它们创建唯一的 Data Standard 对话框。

通过修改 FileOffice.xml为 Vault Office Client 自定义 Data Standard 对话框。

已经为 Vault Office Client 定义了一个名为 FileOffice.xml 的模板。

    FileOffice.xml 位于 %programdata%\Autodesk\<Vault 版本>\Extensions\DataStandard\Vault\Configuration

<?xml version="1.0" encoding="utf-8"?>
                <DocTypeData xmlns="">       
                    <DocTypeInfo>
                        <DocName>Office Document</DocName>
                        <Path>$/Templates/Office</Path>
                    </DocTypeInfo>
                </DocTypeData>