http://www.charlesandhudson.com/archives/hand-tools-list-important.jpgPPT_LOGO_4b
‹#›
Autodesk Confidential Information November 2009
美酒– AcRxVariable
创建自己的AutoCAD系统变量
AutoCAD系统变量基础
§基于Session/User/Profile/Database的存储类型
§反应器/事件
Variable.Changing
Variable.Changed
§定义在 HKLM\<ProductRegRoot>\Variables
§
ObjectARX 和.NET 支持
下面一个新功能是AcRxVariable 。其实在2010这个功能就加上了,只是当时还需要一些补充,我们就没做出介绍。这个功能能够创建自定义的AutoCAD系统变量。你可以直接在注册表里创建自己的系统变量,然后通过ARX或.NET进行访问。

如图所示:我们定义了一个变量,通过注册表项定义了类型是整形,上下限,缺省值,以及哪个addin可以对其进行修改。

你可以使用相关方法去监控该变量修改的事件

The AcRxVariable API was implemented in AutoCAD 2010. We didn’t talk about it then because we had a little more work to do. This is an infrastructure to allow you to create custom AutoCAD system variables. You can create your variables simply by defining them in the AutoCAD registry. You can then query the variables through the ObjectARX or .NET API.

You define the name, variable type, upper and lower bounds, value, default, and the name of the addin that’s allowed to edit it (if its read-only).

Your application is notified when to the user changes the variable by subscribing to an event.