- UID
- 306377
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2005-8-10
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
请教个ARX的问题:
我已经在某个图层选中了一个闭合polyline线
我现在要把这个闭合polyline线转移到图层"1"中,
在ARX中的程序怎么实现?谢谢
Acad::ErrorStatus
getselectpoly(const char* szLayerName)
{// 得到模型空间的块表记录,并遍历它得到所需要的实体
Acad::ErrorStatus es = Acad::eOk;
createnewlayer(szLayerName);
AcDbBlockTable *pBlockTable = NULL;
es = acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pBlockTable, AcDb::kForRead);
if (es != Acad::eOk) {
acutPrintf("\n以读方式打开块表操作失败!");
return es;
}
AcDbBlockTableRecord *pBlockTableRecord = NULL;
es = pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,
AcDb::kForRead);
if (es != Acad::eOk) {
pBlockTable->close();
acutPrintf("\n以读方式打开块表记录操作失败!");
return es;
}
pBlockTable->close();
AcDbBlockTableRecordIterator *pBlockIterator = NULL;
pBlockTableRecord->newIterator(pBlockIterator);
AcDbBlockTableRecordIterator *pBlkTblRcdItr; //生成块表记录的迭代器
pBlockTableRecord->newIterator(pBlkTblRcdItr);
AcDbEntity *pEnt; //遍历法获得并打印每一个实体的类名
int n=0,m=1,x=0;//,NoPl=0;
for (pBlkTblRcdItr->start(); !pBlkTblRcdItr->done(); pBlkTblRcdItr->step())
{
pBlkTblRcdItr->getEntity(pEnt, AcDb::kForRead);
// acutPrintf("\npEnt is: %s\n", (pEnt->isA())->name());
if (pEnt->isKindOf(AcDbPolyline::desc()))
{
AcDbPolyline *pPLine;
pPLine=AcDbPolyline::cast(pEnt);
if(pPLine->isClosed()!=0) //筛选闭合
{
以上代码为遍历所有图层 找出闭合的AcDbPolyline
我现在需要把这个pPLine实体转移到指定的"建筑功能线"层?
请教下怎么实现?(希望不吝指教)
先把实现该功能的lisp代码附上:
快速改变对象所在图层
;选择对象后,点击目标层上任一对象,即将所选转移到该对象所在层
(defun C:CL(/ ss e n)
(princ "改变实体所在图层,请选择要修改的实体...")
(setq ss (ssget))
(if ss
(progn
(setq e (car (entsel "选择目标层上任一实体:"))) ;car不能少!
(if e
(progn
(setq e (entget e))
(setq n (cdr (assoc 8 e)))
(command "chprop" ss "" "C" "BYLAYER" "")
(command "chprop" ss "" "LT" "BYLAYER" "")
(command "chprop" ss "" "LA" n "")
(princ (strcat "\n实体改到图层 : " n "." "\n其颜色线型属性为 BYLAYER."))
)
);end if e
(princ)
)
);end if ss
);end CL (Change Layer) |
|