高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】框选实体、设置颜色总是出错(已解决)
框选实体、设置颜色总是出错(已解决)
框选实体、设置颜色总是出错(已解决)
目的是框选实体,被选择实体改变颜色
以下是代码:
acedinitget(32,null);
ads_point pt,result;//分别为框选两角点
if(acedgetpoint(null,"\npoint\n",pt)!=rtnorm) //第一角点选择
return;
if(acedgetcorner(pt,"\ncorner\n",result)!=rtnorm)//框选
return;
ads_name ents;
if(acedssget("c",pt,result,null,ents)!=rtnorm)//取实体
return;
ads_name ent;
acedssname(ents,0,ent);//取第一个实体
acdbobjectid objid;
acdbgetobjectid(objid, ent);
acdbentity *pent;
acdbopenobject(pent,objid,acdb::kforwrite,false);//打开实体以编辑
accmcolor color;
color.setrgb(255,0,0);
if(pent!=null)
pent->setcolor(color,adesk::ktrue); //这步失败,察看pent=0xcccccc
else
acedalert("failure");
pent->close();
没出错,
不过要注意,最后清空删除选集
change your life style.
问题解决了,又是忘了锁文档了,,非模式对话框
大家引以为戒哈
|