找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 135|回复: 0

修改多段线的凸度

[复制链接]

1

主题

0

回帖

37

积分

管理员

积分
37
发表于 2024-5-4 18:44:07 | 显示全部楼层 |阅读模式
  1. static void zffObjectARX采用MyCommand5(void)
  2. {
  3. ads采用point pick;
  4. ads采用name name;
  5. if (acedEntSel(NULL,name,pick)!=RTNORM)
  6. {
  7. return;
  8. }
  9. AcGePoint3d ptClosest;
  10. AcDbObjectId polyId;
  11. double param;
  12. AcDbPolyline* pPoly=NULL;
  13. acdbGetObjectId(polyId,name);
  14. acdbOpenObject(pPoly,polyId,AcDb::kForWrite);
  15. pPoly->getClosestPointTo(asPnt3d(pick),ptClosest);
  16. pPoly->getParamAtPoint(ptClosest,param);
  17. int vernum=int(param);
  18. int vernumEnd=int(param+1);
  19. AcGePoint3d ptS,ptE;
  20. pPoly->getPointAt(vernum,ptS);
  21. pPoly->getPointAt(vernumEnd,ptE);
  22. pPoly->close();
  23. AcGePoint2d ptCur;
  24. int track=1,type;
  25. struct resbuf result;
  26. while (track>0)
  27. {
  28. acedGrRead(track,&type,&result);
  29. ptCur.x=result.resval.rpoint[X];
  30. ptCur.y=result.resval.rpoint[Y];
  31. AcGeCircArc2d arc(CPointUtil::ToPoint2d(ptS),ptCur,CPointUtil::ToPoint2d(ptE));
  32. AcGePoint2d ptCenter=arc.center();
  33. AcGeVector2d verS(ptS.x-ptCenter.x,ptS.y-ptCenter.y);
  34. double angleS=verS.angle();
  35. AcGeVector2d verE(ptE.x-ptCenter.x,ptE.y-ptCenter.y);
  36. double angleE=verE.angle();
  37. double bulge=(angleE-angleS)/pi();
  38. acdbOpenObject(pPoly,polyId,AcDb::kForWrite);
  39. pPoly->setBulgeAt(vernum,bulge);
  40. pPoly->close();
  41. if (type==3)
  42. {
  43. track=0;
  44. }
  45. }
  46. }
复制代码
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|膜结构网

GMT+8, 2025-1-4 13:14 , Processed in 0.137308 second(s), 23 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表