TA的每日心情 | 开心 昨天 06:36 |
---|
签到天数: 15 天 [LV.4]偶尔看看III
管理员
- 积分
- 1308
|
- ////修改选中实体的颜色
- static void TESTchangecolorcmd()
- {
- ads采用name ssname;
- ////选择多个实体,传递NULL,让用户自己来选
- acedSSGet(NULL,NULL,NULL,NULL,ssname);
- long len;
- acedSSLength(ssname,&len);
- CString ss;
- ss.Format(采用T("已选中%d个实体"),len);
- acutPrintf(ss);
- ads采用name entname;
- AcDbObjectId id;
- AcDbEntity* ent = NULL;
- CString strName;
- int nNewColor;
- ////弹出颜色选择对话框
- if(acedSetColorDialog(nNewColor,Adesk::kFalse,256) != IDOK){
- return;
- }
- for(int i=0;i<len;i++)
- {
- if(acedSSName(ssname, i, entname) == RTNORM)
- {
- ////根据名称得到ID
- acdbGetObjectId(id,entname);
- ////以写模式,根据ID索引到对象,并打开ENTITY
- acdbOpenObject(ent,id,AcDb::OpenMode::kForWrite);
- strName.Format(采用T("%d"),ent->colorIndex());
- acutPrintf(采用T("\n"));
- acutPrintf(strName);
- /////如果只限制直线
- /*if(ent->isKindOf(AcDbLine::desc())){
- acutPrintf(采用T("\nfind line"));
- ent->setColorIndex(nNewColor);
- ent->close();
- }*/
- ent->setColorIndex(nNewColor);
- ent->close();
- }
- }
- acedSSFree(ssname);
- }
复制代码 |
|