Следующий код показывает выполнению для нового класса AsdkMyClass:
ACRX_DXF_DEFINE_MEMBERS(AsdkMyClass, AcDbObject,
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent, 0,
ASDKMYCLASS, SAMP2);
// Gets the value of the integer data member.
//
Acad::ErrorStatus
AsdkMyClass::getData(Adesk::Int16& val)
{
// Tells AutoCAD a read operation is taking place.
//
assertReadEnabled();
val = mIntval;
return Acad::eOk;
}
// Sets the value of the integer data member.
//
Acad::ErrorStatus
AsdkMyClass::setData(Adesk::Int16 val)
{
// Triggers openedForModify notification.
//
assertWriteEnabled();
mIntval = val;
return Acad::eOk;
}
// Files data in from a DWG file.
//
Acad::ErrorStatus
AsdkMyClass::dwgInFields(AcDbDwgFiler* pFiler)
{
assertWriteEnabled();
AcDbObject::dwgInFields(pFiler);
// For wblock filing we wrote out our owner as a hard
// pointer ID so now we need to read it in to keep things
// in sync.
//
if (pFiler->filerType() == AcDb::kWblockCloneFiler) {
AcDbHardPointerId id;
pFiler->readItem(&id);
}
pFiler->readItem(&mIntval);
return pFiler->filerStatus();
}
// Files data out to a DWG file.
//
Acad::ErrorStatus
AsdkMyClass::dwgOutFields(AcDbDwgFiler* pFiler) const
{
assertReadEnabled();
AcDbObject::dwgOutFields(pFiler);
// Since objects of this class will be in the Named
// Objects Dictionary tree and may be hard referenced
// by some other object, to support wblock we need to
// file out our owner as a hard pointer ID so that it
// will be added to the list of objects to be wblocked.
//
if (pFiler->filerType() == AcDb::kWblockCloneFiler)
pFiler->writeHardPointerId((AcDbHardPointerId)ownerId());
pFiler->writeItem(mIntval);
return pFiler->filerStatus();
}
// Files data in from a DXF file.
//
Acad::ErrorStatus
AsdkMyClass::dxfInFields(AcDbDxfFiler* pFiler)
{
assertWriteEnabled();
Acad::ErrorStatus es;
if ((es = AcDbObject::dxfInFields(pFiler)) != Acad::eOk)
{
return es;