Class Implementation Macros

To implement your custom class, use one of these three macros in the source file:

For AsdkPoly, the following line expands to a very long single line of code:

ACRX_DXF_DEFINE_MEMBERS(AsdkPoly, AcDbCurve, AcDb::kDHL_CURRENT,\
    AcDb::kMReleaseCurrent, 0, POLYGON, /*MSG0*/"AutoCAD");

When reformatted to multiple lines for clarity, the line looks like this:

AcRxClass* AsdkPoly::desc()
{
    if (AsdkPoly::gpDesc != 0)
        return AsdkPoly::gpDesc;
    return AsdkPoly::gpDesc =
        (AcRxClass*)((AcRxDictionary*)acrxSysRegistry()->
        at("ClassDictionary"))->at("AsdkPoly");
}
AcRxClass* AsdkPoly::isA() const
{
    return AsdkPoly::desc();
}
AcRxClass* AsdkPoly::gpDesc = 0;
static AcRxObject * makeAsdkPoly()
{
    return new AsdkPoly();
}
void AsdkPoly::rxInit()
{
    if (AsdkPoly::gpDesc != 0)
        return;
    AsdkPoly::gpDesc = newAcRxClass("AsdkPoly",
        "AsdkCurve", AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
         0, &makeAsdkPoly, "POLYGON", "\"AutoCAD\"");
};

When expanded, the semicolon (;) at the end of the macro call line moves to just after the closing brace (}) for a function definition. Therefore, this semicolon is not required for this macro call line.

If you want to write your own rxInit() function, use the ACRX_DEFINE_MEMBERS() macro by itself, which defines desc(), cast(), and isA() for your class but does not define the rxInit() function. This macro also does not create the associated AcRxClass object, which is the responsibility of the rxInit() function.