明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3386|回复: 4

[基础] 如何获得多段线中圆弧的中间点坐标?

[复制链接]
发表于 2010-4-7 22:08 | 显示全部楼层 |阅读模式
如何获得多段线中圆弧的中间点坐标?我在网上下了一个可以把多段线顶点坐标输出的程序,但发现有圆弧时,只输出圆弧的起始点及结束点。
发表于 2010-4-8 15:17 | 显示全部楼层
思路:得到多段线对象的图元数据后,获取42组码和其前一个10组码和后一个10组码,然后根据42组码值的正负,用polar可取得圆弧中点。
发表于 2010-4-8 21:09 | 显示全部楼层

;|
From:  Doug Broad - view profile
Date:  Tues, Feb 11 2003 4:56 am 
Email:   "Doug Broad" <dbr...@earthlink.net>

Luis,
For 2D work with UCS = world this would be OK.
If you have arcs in 3D or a current UCS <> World then
you will have to do a lot more work.  Also, in order to
apply it within commands, you should either turn off
osnaps or ...
|;

(defun midarc (ent / dxf ent info cen sa ea da ma)
  (defun dxf (k l) (cdr (assoc k l)))
  (and
    ent
    (setq info (entget ent))
    (= "ARC" (dxf 0 info))
    (setq cen (dxf 10 info))  ;center
    (setq sa (dxf 50 info))  ;start
    (setq ea (dxf 51 info))  ;end
    (setq da (- ea sa))
    (setq da (if (minusp da)
        (+ (* 2 pi) da)
        da
      )
    )
    (setq ma (+ sa (/ da 2)))
  )
  (if ma
    (polar cen ma (dxf 40 info))
  )
)

发表于 2010-4-11 17:04 | 显示全部楼层

;by nonsmall

;曲线中点坐标

(Setq ob (Vlax-Ename->Vla-Object (car (entsel))))
(getpoint (vlax-curve-getPointAtDist ob (* 0.5 (vlax-curve-getDistAtPoint ob (vlax-curve-getEndPoint ob)))))

发表于 2015-10-15 16:58 | 显示全部楼层
谢谢分享!!!!!!!!!!!!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-20 18:54 , Processed in 0.186015 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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