- 积分
- 19100
- 明经币
- 个
- 注册时间
- 2003-8-16
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2011-6-18 14:47:30
|
显示全部楼层
本帖最后由 BDYCAD 于 2011-6-18 15:13 编辑
struct resbuf *XreDa=acutBuildList(RTSTR,_T("BDYCAD"),0),*TempRes;
int IDNumber;
ads_real Rad1,Rad2;
ads_name Ename,SS;
ads_point p1,p2;
AcGePoint3d Spt,Ept,Cpt1,Cpt2;
AcDbObjectId ObjID,TempID,BigCirID;
AcDbObjectIdArray IDList,TempIDList;
AcDbCurve *pCur;
AcDbCircle *pCir;
acutRelRb(XreDa);
XreDa=acutBuildList(AcDb::kDxfOperator,_T("<and"),
RTDXF0,_T("CIRCLE"),
AcDb::kDxfVisibility,kVisible,//显示的对象
AcDb::kDxfOperator,_T("and>"),0);
if (acedSSGet(NULL,NULL,NULL,XreDa,SS)!=RTNORM)return;
long SSlen;
acedSSLength(SS,&SSlen);
IDList=TempIDList=NULL;
for (int i=0;SSlen>i;i++) {//把SS选集的每一对象ID加下IDList
acedSSName(SS,i,Ename);
if (acdbGetObjectId(BigCirID,Ename)!=eOk)continue;
if (IDList.find(BigCirID,IDNumber)==TRUE)continue;//如果该圆处理过,跳过
if (acdbOpenObject(pCir,BigCirID,AcDb::kForWrite)!=Acad::eOk)continue;//该对象打不开,跳过
Cpt1=pCir->center();
pCir->close();
TempIDList=NULL;
TempIDList.append(BigCirID);
for (int i=0;SSlen>i;i++) {//把SS选集的每一对象ID加下IDList
acedSSName(SS,i,Ename);
if (acdbGetObjectId(TempID,Ename)!=eOk)continue;
if (BigCirID==TempID)continue;
if (IDList.find(BigCirID,IDNumber)==TRUE)continue;//如果该圆处理过,跳过
if (acdbOpenObject(pCir,TempID,AcDb::kForWrite)!=Acad::eOk)continue;
Cpt2=pCir->center();
pCir->close();
ads_point_set(asDblArray(Cpt1),p1);
ads_point_set(asDblArray(Cpt2),p2);
if (acutDistance(p1,p2)==0.0)
{
TempIDList.append(TempID);//同心圆
}
}
for (int i=0;TempIDList.length()>i;i++)
{
TempID=TempIDList.at(i);
IDList.append(TempID);
if (acdbOpenObject(pCir,TempID,AcDb::kForWrite)!=Acad::eOk)continue;
if (i==0)
{
Rad2=pCir->radius();
BigCirID=TempID;
}else{
Rad1=pCir->radius();
if (Rad1>Rad2){
Rad2=Rad1;
BigCirID=TempID;
}
}
pCir->close();
}
acdbOpenObject(pCir,BigCirID,AcDb::kForWrite);
pCir->setColorIndex(1);//把最大同心圆或单圆的色改为红色
pCir->close();
}
return; |
|