今天在代码自测时,发现当块中含有自定义实体时,调用explode()会返回Adesk::eNotApplicable,而对自定义体直接调用explode()方法、以及在CAD执行“炸开”命令均正常。
用ARX开发包自带的polysamp例子进行模拟测试却正常。后经调试,发现对块参照调用explode()时,会调用自定义实体的getTransformedCopy()方法,故在自定义实体类中增加对getTransformedCopy()的重载,问题解决!
后来在Autodesk Discussion Groups中也得到证实:
AcDbBlockReference::explode() uses
getTransformedCopy() on each entity in the block definition to create the
explode set. Unfortunately, AcDbPolyFaceMesh::getTransformedCopy() doesn't
copy the xdata to the copy.
链接:http://forums.autodesk.com/t5/Autodesk-ObjectARX/Explode-with-the-ACAD-EXPLODE-Command/td-p/315823