- 积分
- 26747
- 明经币
- 个
- 注册时间
- 2007-4-24
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2022-5-26 17:46:42
|
显示全部楼层
本帖最后由 gzxl 于 2022-5-26 17:47 编辑
大概这样吧,可以参照下
- 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);
复制代码 |
|