- UID
- 5043
- 积分
- 1347
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-5-13
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
AcDb: deriving from AcDbPolyline
Published date: 2008-10-14
ID: TS47354
Applies to:
AutoCAD® 2009
AutoCAD® 2008
AutoCAD® 2007
问题:
Deriving from AcDbPolyline works correctly, however, it seems DWG files
containing instances of my custom entity derived from AcDbPolyline do not
contain proxy graphic information for them. Why?
解决方案:
AutoCAD does not save the proxy graphic information for classes derived from
AcDbPolyline. The reason for this is that the 'saveAs()' method is implemented
as follows:
void AcDbPolyline::saveAs(AcGiWorldDraw* mode, AcDb::SaveType st) {
assertReadEnabled();
if ( st == AcDb::kR12Save )
// ... do something to convert into AcDb2dPolyline
}
Whereas it should be as follows:
void AcDbPolyline::saveAs(AcGiWorldDraw* mode, AcDb::SaveType st) {
assertReadEnabled();
if ( st == AcDb::kR12Save )
// ... do something to convert into AcDb2dPolyline
else
worldDraw (mode) ;
}
As a result, proxy graphic data is never saved, which causes your derived
AcDbPolyline entity to be invisible if your DBX-object enabler application is
not loaded. Although this is not ideal, it does not affect any other behavior or
functionality of your custom entity.
A simple override of the 'saveAs()' method can solve this problem as follows:
When the "_PEDIT" command starts, the AsdkEdReactor::commandWillStart() reactor
callback is called and the bPEdit Boolean is set to True. Then AutoCAD verifies
that the entity selected is "kind of" an AcDbPolyline. To do this AutoCAD calls
the AcRxObject::isKindOf() method, this in turn calls the class descriptor of
the entity (AcDbMyPloyline::desc()), which returns the AutoCAD AcDbPolyline
class descriptor. In all other situations, it returns a real custom entity class
descriptor (child of AcDbCurve).
Forward Compatibility Issues
The two problems will be fixed in a later release of AutoCAD, it should be asked
if the custom entity derived from AcDbPolyline will continue to work. Although a
custom entity derived from AcDbPolyline will continue to work, you will also be
allowed to remove the workarounds in this solution without any problems,
including reloading files from one implementation to another.
|
|