- 积分
- 19100
- 明经币
- 个
- 注册时间
- 2003-8-16
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2009-2-6 08:53:00
|
显示全部楼层
- AcDbBlockTableRecord *GetModelSpace(AcDb::OpenMode Mode){
- AcDbDatabase *pDwg = acdbHostApplicationServices()->workingDatabase();
- AcDbBlockTable *pBlockTable;
- AcDbBlockTableRecord *pModelSpace;
- pDwg->getSymbolTable(pBlockTable, AcDb::kForRead);
- pBlockTable->getAt(ACDB_MODEL_SPACE, pModelSpace, Mode);
- pBlockTable->close();
- return pModelSpace;
- }
- AcDbObjectIdArray BreakEntity(AcDbObjectId ObjId,AcGePoint3d Spt,AcGePoint3d Ept){
- double param1,param2;
- AcGePoint3d p11,p21;
- AcDbEntity *pEnt;
- AcDbCurve *pCurve;
- AcDbObjectId NobjID;
- AcGeDoubleArray params;
- AcDbObjectIdArray BreakNewObjID=NULL;
- acdbOpenObject(pCurve,ObjId,AcDb::kForWrite);
- pCurve->getClosestPointTo(Spt,p11);
- pCurve->getClosestPointTo(Ept,p21);
- pCurve->getParamAtPoint(p11,param1);
- pCurve->getParamAtPoint(p21,param2);
- if (param1<param2){
- params.append(param1);
- params.append(param2);
- }else{
- params.append(param2);
- params.append(param1);
- }
- AcDbVoidPtrArray curveSegments;
- pCurve->getSplitCurves(params, curveSegments);
- AcDbBlockTableRecord *pModelSpace=GetModelSpace(AcDb::kForWrite);
- for (int i=0;curveSegments.length()>i;i++) {
- pEnt=(AcDbEntity*)curveSegments.at(i);
- pModelSpace->appendAcDbEntity(NobjID,pEnt);
- BreakNewObjID.append(NobjID);
- pEnt->close();
- }
- pModelSpace->close();
- pCurve->close();
- return BreakNewObjID;
- }
复制代码 |
|