|
objcetArx 如何快速选择 长度大于多少的线段。 选择集里面那个那个组合是线段的长度?[code]ads_name sset, newss;
int result = acedSSGet(NULL, NULL, NULL, NULL, sset);
if (result != RTNORM) { return; }
Adesk::Int32 length = 0;
acedSSLength(sset, &length);
Acad::ErrorStatus es = Acad::eOk;
double dLength = 10.0; // 过滤线段的长度,假设为10米
acedSSAdd(NULL, NULL, newss);
for (int i = 0; i < length; i++)
{
ads_name ename;
acedSSName(sset, i, ename);
AcDbObjectId objId = AcDbObjectId::kNull;
es = acdbGetObjectId(objId, ename);
if (es != Acad::eOk) { continue; }
AcDbEntity* pEnt = NULL;
es = acdbOpenObject(pEnt, objId, AcDb::kForRead);
if (es != Acad::eOk) { continue; }
if (pEnt->isKindOf(AcDbCurve::desc()))
{
AcDbCurve* pCurve = AcDbCurve::cast(pEnt);
AcGePoint3d entPt;
pCurve->getEndPoint(entPt);
double length = 0.0;
pCurve->getDistAtPoint(entPt, length);
if (length >= dLength)
acedSSAdd(ename, newss, newss);
pCurve->close();
}
pEnt->close();
}
acedSSFree(sset);
acedSSSetFirst(newss, NULL); // 测试亮响
// ...
acedSSFree(newss);[/code] |
|