- UID
- 107516
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2004-2-29
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
我找一下论坛上的关于AcDbRegion的例子,写代码如下:
//从AcDbObjectId,创建REGION
AcDbObjectId calculate::CreateRegionFromId(AcDbObjectId polylineID)
{
// 打开POLYLINE.
AcDbEntity* pPolyline;
AcDbObjectId regionId;
acdbOpenAcDbEntity(pPolyline, polylineID, AcDb::kForRead);
// 用polyline创建REGION
AcDbVoidPtrArray polylineArray;
polylineArray.append((void*)pPolyline);
AcDbVoidPtrArray regions;
AcDbRegion::createFromCurves(polylineArray, regions);
AcDbRegion *pRegion = NULL;
pRegion = AcDbRegion::cast((AcRxObject*)regions[0]);
pPolyline->close();
// 添加REGION到数据库
AcDbBlockTable* pBlockTable;
acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable, AcDb::kForRead);
AcDbBlockTableRecord* pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);
pBlockTable->close();
AcDbRegion* regionObj = AcDbRegion::cast((AcRxObject*)regions[0]);
pBlockTableRecord->appendAcDbEntity(regionId, regionObj);
pBlockTableRecord->close();
regionObj->close();
// 返回REGION的ID
return regionId;
}
在选闭合polyline线生成AcDbRegion时,老是在AcDbRegion::createFromCurves(polylineArray, regions);出现CAD崩溃,请问高手?最好给一个实例,谢谢! |
|