Components 元素参考
Components 元素用于指定构成一个版本的插件的组件。 多个 Components 元素可用于标识插件的组件;每个 Components 元素可以标识一个或多个组件。Components 元素的平台和产品信息由 RuntimeRequirements 元素定义。 如果要将所有在 Components 元素中定义的组件都应用到相同的平台,则无需将 RuntimeRequirements 元素添加到每个单独的 ComponentEntry 元素中。 除了 RuntimeRequirements 元素,Components 元素还可以包含一个或多个以下元素
注: Components 元素只能有一个 RegistryEntries、SystemVariables 和 EnvironmentVariables 元素,但可以包含多个 ComponentEntry 元素。
以下内容概述了 Components 元素及其可以包含的任何元素之间的基本关系。 <Components>
<RuntimeRequirements ... />
<RegistryEntries>
<RegistryEntry ... />
</RegistryEntries>
<SystemVariables>
<SystemVariable ... />
</SystemVariables>
<EnvironmentVariables>
<EnvironmentVariable ... />
</EnvironmentVariables>
<ComponentEntry ... >
<RuntimeRequirements ... />
<AssemblyMappings>
<AssemblyMapping ... />
<AssemblyMappingFolder ... />
</AssemblyMappings>
<Commands ...>
<Command ... />
</Commands>
</ComponentEntry>
<ComponentEntry ... />
</Components>
ComponentEntry 元素(基于 AutoCAD 2013 的产品及更高版本、AutoCAD LT 2024 及更高版本)ComponentEntry 元素是必需的,用于指定 Components 元素中各个组件的相关详细信息。 可以根据需要指定任意多个 ComponentEntry 元素。组件类型可以是以下文件格式之一:
如果 LoadReasons 属性设置为 LoadOnCommandInvocation,则 ComponentEntry 元素可能包含 Commands 元素。 注: ComponentEntry 元素按其列出的顺序加载,但自下而上。因此,其他组件所依赖的任何文件都必须位于列表的下方。例如,如果 ObjectARX 模块依赖 ObjectDBX 模块,则 ObjectARX 模块需要在列表中显示在 ObjectDBX 模块的上方。
ComponentEntry 元素可以有以下任一附着属性:
“Commands”元素(基于 AutoCAD 2013 的产品及更高版本、AutoCAD LT 2024 及更高版本)Commands 元素是可选的,除非已为e LoadReasons 属性启用 LoadOnCommandInvocation 参数。用于为 LoadOnCommandInvocation 指定注册哪些命令。 可以根据需要指定多个 Command 元素。 Commands 元素可以有以下附着属性:
“Command”元素(基于 AutoCAD 2013 的产品及更高版本、AutoCAD LT 2024 及更高版本)指定每个命令的全局和本地名称。 Command 元素可以有以下任一附着属性:
以下样例添加了在名为“ADSKCMDS”的组中定义的两个命令: <Commands GroupName="ADSKCMDS">
<Command Global="HELLOWORLD" Local="ADSKHELLOWORLD"/>
<Command Global="DRAWLINE" Local="ADSKDRAWLINE"/>
</Commands>
“AssemblyMappings”元素(基于 AutoCAD 2013 及更高版本的产品)AssemblyMappings 元素是可选的,并可以包含一个或多个 AssemblyMapping 或 AssemblyMappingFolder 元素。AssemblyMapping 和 AssemblyMappingFolder 元素用于将部件文件和文件夹路径添加到内部列表,供 AutoCAD 用来解析在产品安装文件夹中未找到的部件。
以下样例添加了两个文件夹,其中包含组件所使用的部件: <AssemblyMappings>
<AssemblyMappingFolder Path="./Content/Assemblies" />
<AssemblyMappingFolder Path="./Content/MoreAssemblies" />
</AssemblyMappings>
“RegistryEntries”元素(基于 AutoCAD 2015 的产品及更高版本、AutoCAD LT 2024 及更高版本)RegistryEntries 元素是可选的,并且可以包含一个或多个 RegistryEntry 元素。RegistryEntry 元素包含插件应该创建或修改的注册表项的定义。注册表项存储在 Windows 注册表中或 Mac 操作系统上的特性列表 (PLIST) 文件中。 注: 在 Windows 上,在“HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\<版本>\ACAD-<产品>:<语言>”下创建注册表项。无法在其他位置中创建注册表项。可以在 Mac 操作系统上的 PLIST 文件中使用该等效位置。
下面的样例将创建注册表项 MYREGKEY 并添加 STRING 和 NUMBER 值: <RegistryEntries>
<RegistryEntry
Key="MYREGKEY"
Name="STRING"
Value="Example"
Type="REG_SZ"
/>
<RegistryEntry
Key="MYREGKEY"
Name="NUMBER"
Value="123"
Type="REG_DWORD"
/>
</RegistryEntries>
“SystemVariables”元素(基于 AutoCAD 2015 的产品及更高版本、AutoCAD LT 2024 及更高版本)SystemVariables 元素是可选的,并且可以包含一个或多个 SystemVariables 元素。SystemVariable 元素包含插件应创建或修改的系统变量的定义。
以下样例创建了一个名为 MYVARIABLE 的系统变量: <SystemVariable
Name="MYVARIABLE"
PrimaryType="String"
StorageType="User"
Value="Example"
Owner=""
Flags="Create|DotIsEmpty|SpacesAllowed"
/>
以下样例在首次加载插件时,将 CURSORSIZE 系统变量的值更改为 100: <SystemVariable
Name="CURSORSIZE"
Value="100"
Flags="OpenOnce"
/>
“EnvironmentVariables”元素(基于 AutoCAD 2015 的产品及更高版本、AutoCAD LT 2024 及更高版本)EnvironmentVariables 元素是可选的,并且可以包含一个或多个 EnvironmentVariable 元素。EnvironmentVariable 元素包含插件应该创建或修改的环境变量的定义。环境变量存储在 Windows 注册表中或 Mac 操作系统上的特性列表 (PLIST) 文件中。 注: 环境变量的值始终存储为字符串,并且环境变量的名称区分大小写。
以下样例创建了两个名为 MYNUMVAR 和 MYSTRVAR 的环境变量: <EnvironmentVariables>
<EnvironmentVariable
Name="MYNUMVAR"
Value="123"
/>
<EnvironmentVariable
Name="MYSTRVAR"
Value="Example"
/>
</EnvironmentVariables>
变量值的运算符前缀运算符前缀用于在加载插件后,修改变量的当前值。可以将下表中列出的运算符前缀之一添加到 RegistryEntry、SystemVariable 或 EnvironmentVariable 元素的“Value”属性。
注: 如果变量的值应以某个运算符前缀开头,则在运算符之前添加一个反斜杠。例如,如果变量的值为 +radius,则输入值 \+radius。
下面的对象将始终启用 END、MID、CEN、NOD、QUA 和 INT 运行对象捕捉,并使所有其他对象捕捉保持原样: <SystemVariable
Name="OSMODE"
Value="|63"
Flags="Open"
/>
相关概念 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-11-3 00:14
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.