OBJECT ARX 修改选中实体的颜色 选择集的使用
2016-09-27 00:20
309 查看
[cpp] view
plain copy
print?
////修改选中实体的颜色
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);
}
plain copy
print?
////修改选中实体的颜色
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);
}
相关文章推荐
- iOS objective-c 判断field 是否带ASCII 码
- warning: could not load any Objective-C class information. This will significantly reduce the qualit
- 关于object类的clone方法浅克隆与深度克隆
- g++编译报错原因分析cannot allocate an object of abstract type“XXX ”
- java中的Object类
- 编译运行出现:__NSCFConstantString countByEate:objects:count: ?
- java.lang.Object源码浅析
- [OC基础]ARC机制
- 浅谈Objective-C对象初始化的三类程序猿
- [OC基础]手动内存管理
- Runtime中Swizz_method方法替换
- 数据库连接异常Cannot get a connection, pool error Timeout waiting for idle object
- JS与Objective-C交互(网页与原生交互---使用JavaScriptCore)
- 使用 ArcGIS中的ArcObjects进行二次开发
- xcode的Objective-C之helloworld
- Page object abstraction -- bdd script
- Javascript中的函数(Function)与对象(Object)的关系
- JavaScript的Function与Object浅析
- 初识Volley:JsonObjectRequest、StringRequest、RequestQueue
- [置顶] Android属性动画系列(一)——ObjectAnimator