If you use ATL along with ATL-based templates from AutoCAD to create Automation objects, all the interfaces listed above will be implemented. This frees you to concentrate on the specific properties and methods for your AcDbObject-derived class; everything else is implemented by either Autodesk or Microsoft.
Autodesk provides the following ATL-based templates for enabling basic Automation of custom objects and entities:
ATL-based templates (declared in axtempl.h) |
|
---|---|
Template |
Implements |
CProxy_AcadObjectEvents |
IConnectionPointImpl (exposes IAcadObjectEvents) |
IAcadBaseObjectImpl |
IAcadBaseObject, IConnectionPointContainer, CProxy_AcadObjectEvents, CProxy_PropertyNotifySink |
IAcadBaseObject2Impl |
IAcadBaseObject2, IAcadBaseObjectImpl |
IRetrieveApplicationImpl |
IRetrieveApplication |
IAcadObjectDispatchImpl |
IAcadObject2Impl, IDispatchImpl, IRetrieveApplicationImpl |
IAcadEntityDispatchImpl |
IAcadEntity |
IAcadBaseDatabaseImpl |
IAcadBaseDatabase |
By changing the derivation from the ATL IDispatchImpl template to IAcadEntityDispatchImpl or IAcadObjectDispatchImpl, you will have automatic implementation for the required interfaces. The steps required to implement Automation are covered in detail in Exposing Automation Functionality. Additional ATL templates for supporting AutoCAD's Properties palette feature are discussed in Properties Palette API.