- UID
- 100636
- 积分
- 781
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-12-6
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
目的:将一个图层的所有对象转移到另一个图层,并删除原图层。
- [FONT=courier new]
- AcDbObjectId eId;
- AcDbObject *pObj;
- AcDbEntity *pE;
- ads_name ss;
- ads_name ent;
- ads_point pt;
- long len;
- char * layer_tc1;
- char * layer_tc2;
- struct resbuf eb;
- struct resbuf blc;
-
- int rc = acedEntSel("\n选择被合并图层实体:",ent,pt);
- switch(rc)
- {
- case RTERROR :
- acutPrintf("\n未选中实体! ");
- break;
- case RTCAN :
- acutPrintf("\n取消! ");
- break;
- case RTNORM :
- acdbGetObjectId(eId,ent);
- acdbOpenObject(pE, eId, AcDb::kForRead, false);
- layer_tc1 = pE->layer();//查询实体所在的图层
- pE->close();
- int rcc = acedEntSel("\n选择合并图层实体:",ent,pt);
- switch(rcc)
- {
- case RTERROR :
- acutPrintf("\n未选中实体! ");
- break;
- case RTCAN :
- acutPrintf("\n取消! ");
- break;
- case RTNORM :
- acdbGetObjectId(eId,ent);
- acdbOpenObject(pE, eId, AcDb::kForRead, false);
- layer_tc2 = pE->layer();
- pE->close();
- eb.restype = 8;//层名
- eb.resval.rstring = layer_tc1;
- eb.rbnext = NULL;
- acedSSGet("X",NULL,NULL,&eb,ss);
- free(eb.resval.rstring);
- acedSSLength(ss,&len);
- for(int i=0; i<len; i++)
- {
- acedSSName(ss,i,ent);
- acdbGetObjectId(eId,ent);
- acdbOpenObject(pE, eId, AcDb::kForWrite, false);
- pE->setLayer(layer_tc2);
- pE->close();
- }
- acedSSFree(ss);
- blc.restype = RTSTR;
- blc.resval.rstring = "0";
- acedSetVar("CLAYER",&blc);//设置当前图层为0层
- AcDbLayerTable * pLayerTbl;//定义层表指针
- acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pLayerTbl, AcDb::kForWrite);
-
- AcDbLayerTableRecord * pLayerTblRcd; //定义层表记录指针
- if ( Acad::eOk == pLayerTbl->getAt(layer_tc1 , pLayerTblRcd , AcDb::kForWrite))
- {
- pLayerTblRcd->erase(true);//删除图层
- }
- pLayerTblRcd->close();
- pLayerTbl->close();
- free(layer_tc2);
- break;
- }
- free(layer_tc);
- break;
- }
- [/FONT]
复制代码 |
|