明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: superxzg

[求助]多段线中圆弧圆心如何获得?

[复制链接]
发表于 2014-11-29 15:31:04 | 显示全部楼层
superxzg 发表于 2007-2-5 16:35
zzxxqq,你真是我的偶像啊,真厉害!这都能想到!能不能给我介绍一下“p”的含义?我看书上是说“对应Autoc ...

;凸度计算弧心
  1. (defun c:tt ()
  2. (setq pclst (list))
  3. (if (and (setq s1 (entsel "\n选择多段线: "))
  4.           (setq ent (entget(car s1)))
  5.           (= (cdr(assoc 0 ent)) "LWPOLYLINE")) (progn
  6.   (setq J 0 N (cdr (assoc 90 ent)) CL (rem (cdr (assoc 70 ent)) 2) K 1)
  7.   (while (/= (car (nth J ent)) 10) (setq J (1+ J)))
  8.   (setq P1 (cdr (nth J ent)) PS P1)
  9.   (repeat (1- N)
  10.    (setq P2 (cdr (nth (+ J (* K 4)) ent)) BULGE (cdr (nth (+ J (* K 4) -1) ent)))
  11.    (if (> (abs BULGE) 0.0)
  12.     (setq LL (* (distance P1 P2) 0.5) ANG (angle P1 P2)
  13.           PC (polar (polar P1 ANG LL) (- ANG AL1) (* (+ BULGE (if (> BULGE 0) -1 1)) LL))
  14.           pclst (cons PC pclst))
  15.    )
  16.    (setq P1 P2)
  17.   )
  18.   (setq BULGE (cdr (nth (+ J (* K 4) -1) ent)))
  19.   (if (= CL 1)
  20.    (if (> (abs BULGE) 0.0)
  21.     (setq LL (* (distance P1 PS) 0.5) ANG (angle P1 PS)
  22.          PC (polar (polar P1 ANG LL) (- ANG AL1) (* (+ BULGE (if (> BULGE 0) -1 1)) LL))
  23.          pclst (cons PC pclst))
  24.    )
  25.   )
  26. ))
  27. pclst
  28. )
发表于 2015-10-15 16:50:47 | 显示全部楼层
谢谢分享!!!!!!!!!!!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-7-16 04:22 , Processed in 0.139156 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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