In this post, let us look at the RXClass in a bit detail and see what it can give us when programming with AutoCAD .NET. Then we may find good use of it in the future.
Here is the test command and code to inspect at the RXClass for the Circle class:
[CommandMethod("RxClassInfo")]
public static void RxClassInfo_Method()
{
Editor ed = MgdAcApplication.DocumentManager.MdiActiveDocument.Editor;
RXClass rxClass = RXClass.GetClass(typeof(Circle));
string str = "RXClass info for Circle:\n";
str += string.Format("\tName: {0}\n", rxClass.Name);
str += string.Format("\tDxfName: {0}\n", rxClass.DxfName);
str += string.Format("\tAppName: {0}\n", rxClass.AppName);
str += string.Format("\tClassVersion: {0}\n", rxClass.ClassVersion);
str += string.Format("\tParent: {0}\n", rxClass.MyParent.Name);
str += string.Format("\tProxyFlags: {0}\n", rxClass.ProxyFlags);
str += string.Format("\tAutoDelete: {0}\n", rxClass.AutoDelete);
str += string.Format("\tIsDisposed: {0}\n", rxClass.IsDisposed);
ed.WriteMessage(str);
}
Here is the output:
Command: RxClassInfo
RXClass info for Circle:
Name: AcDbCircle
DxfName: CIRCLE
AppName: ObjectDBX Classes
ClassVersion: 19.0.0.0
Parent: AcDbCurve
ProxyFlags: 0
AutoDelete: False
IsDisposed: False
So the name of the RXClass can be expected as the prefix AcDb plus the AutoCAD .NET class name and the DxfName is the upper cases of the .NET class name. The AppName seems always to be ObjectDBX Classes for AutoCAD native classes. The ClassVersion is 19.0.0.0 here though the test command/code was run in an AutoCAD 2012 (internal/registry version 18.2). The parent RXClass of the Circle is AcDbCurve as can also be expected. The ProxyFlags is 0 indicating Circle is not from a third party or the application (such as the ObjectDBX) defining it is being loaded and enabled. The AutoDelete and the IsDisposed are straightforward.
The leading edge AutoCAD .NET Addin Wizard (AcadNetAddinWizard) provides various project wizards, item wizards, coders and widgets to help program AutoCAD .NET addins.
Hi Mr Spider - I every now and then see this RXclass on the forums - with examples just have you've done above. But I have no idea what it is, and what its purpose is, and how the Rx object is different from the DBobject types we are familiar with in the .net api. was hoping you could shed some light on it. rgds, Ben
Posted by: BKSpurgeon | 02/07/2017 at 10:03 AM
BKSpurgeon, a good question. RXClass is a basic stuff and more ARX than .NET. It may provide some useful information such as DXFName and AppName. In fact, if you read the ARX documentation, you will notice a few RXClass related stuffs such as AcRxDictionary and some macros. You can simply iterate through the whole ARX class tree and their protocol extensions using them. However, the class has not been exposed to the .NET API and likely will not.
But still we can use the RXClass to make our coding life a bit easier and improve the app performance if necessary. Here are a couple of posts demonstrating these.
http://spiderinnet1.typepad.com/blog/2012/10/autocad-net-find-objects-from-database-concisely-reliably-and-quickly.html
http://spiderinnet1.typepad.com/blog/2012/04/various-ways-to-check-object-types-in-autocad-net.html
Posted by: Spiderinnet1 | 02/07/2017 at 05:09 PM
Thank you Mr Spider I will study those blog posts. rgds, Ben
Posted by: BKSpurgeon | 02/07/2017 at 07:43 PM