- UID
- 11305
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-10-13
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2003-8-21 08:44:14
|
显示全部楼层
CView *pView = acedGetAcadDwgView();
if(pView == NULL) return;
CRect rect;
pView->GetClientRect (&rect);
ads_name ssname;
acedDwgPoint ptToLe;
acedDwgPoint ptBoRi;
acedCoordFromPixelToWorld(rect.TopLeft (), ptToLe);
acedCoordFromPixelToWorld(rect.BottomRight (), ptBoRi);
if(acedSSGet("W", ptToLe, ptBoRi, NULL, ssname) != RTNORM) return;
long length;
if(acedSSLength(ssname, &length) == RTNORM)
{
AcGeVoidPointerArray curveSet;
actrTransactionManager->startTransaction();
for(int i=0; i<length; i++)
{
ads_name tempName;
AcDbObjectId tempId;
if(acedSSName(ssname, i, tempName) == RTNORM)
{
acdbGetObjectId(tempId, tempName);
AcDbEntity *pEnt = NULL;
if(actrTransactionManager->getObject((AcDbObject *&)pEnt, tempId, AcDb::kForRead) == Acad::eOk)
{
addToPtrArray(pEnt, curveSet); //此处返回的是转换后的 AcGeCurve 数组
}
if(pEnt != NULL) pEnt->close();
}
}
int geLength = curveSet.length();
if(geLength < 2) return;
AcGeInterval otherInter;
((AcGeCurve3d *)curveSet[0])->getInterval(otherInter);
for(int n=1; n<geLength; n++)
{
AcGeInterval resultInter;
AcGeInterval tempInter;
((AcGeCurve3d *)curveSet[n])->getInterval(tempInter);
double std; double end;
otherInter.getBounds(std, end);
acutPrintf("\n 0 >> start: %lf, end: %lf", std, end);
tempInter.getBounds(std, end);
acutPrintf("\n 1 >> start: %lf, end: %lf", std, end);
Adesk::Boolean er = otherInter.intersectWith(tempInter, resultInter);
if(er)
{
resultInter.getBounds(std, end);
acutPrintf("\n result >> start: %lf, end: %lf", std, end);
acutPrintf("\n insertsectWidth is %s", "TRUE");
}
else
acutPrintf("\n insertsectWidth is %s", "FALSE");
otherInter = resultInter;
}
} |
|