明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 841|回复: 6

[讨论] 多段线两端画圆,修改

[复制链接]
发表于 2020-5-7 08:31:30 | 显示全部楼层 |阅读模式
多段线两端画圆,为什么画不出,请大师修改。谢谢
(defun c:TT        (/ ss1 slth ename ent point1 point2 n)
  (setvar "cmdecho" 0)
  (setq        ss1  (ssget '((0 . "PLINE")))
        slth (sslength ss1)
  )
  (setq n 0)
  (if (/= ss1 nil)
    (repeat slth
      (setq ename  (ssname ss1 n)
            ent           (entget ename)
            point1 (cdr (assoc 10 ent))
            point2 (cdr (assoc 11 ent))
      )
      (command "_donut" 0.0 0.4 point1 point2 "")
      (setq n (+ 1 n))
    )
  )
)
(princ "\n 直线两侧绘制实心圆 huyuan")

发表于 2020-5-7 09:39:11 | 显示全部楼层
(defun c:dyxldhy (/ ent lst n radius slth ss1 temp)
  (setvar "cmdecho" 0)
  (setq
                ss1  (ssget '((0 . "LWPOLYLINE")))
                slth (sslength ss1)
  )
  (setq n 0)
  (if (and
                                (/= ss1 nil)
                                (setq radius (getreal "\n请输入半径"))
                        )
    (repeat slth
                        (setq lst nil)
                        (setq ent (entget (ssname ss1 n)))
                        (while (setq temp (car ent))
                                (if (= (car temp) 10)
                                        (setq lst (append lst (list (cdr temp))))
                                )
                                (setq ent (cdr ent))
                        )
                        (command "_CIRCLE" (car lst) radius)
                        (command "_CIRCLE" (last lst) radius)
      (setq n (+ 1 n))
    )
  )
)

评分

参与人数 1金钱 +10 收起 理由
yp9819 + 10 很给力!

查看全部评分

回复 支持 1 反对 0

使用道具 举报

发表于 2020-5-7 09:03:09 | 显示全部楼层
(defun c:TT (/ ent lst n slth ss1 temp)
  (setvar "cmdecho" 0)
  (setq
                ss1  (ssget '((0 . "LWPOLYLINE")))
                slth (sslength ss1)
  )
  (setq n 0)
  (if (/= ss1 nil)
    (repeat slth
                        (setq lst nil)
                        (setq ent (entget (ssname ss1 n)))
                        (while (setq temp (car ent))
                                (if (= (car temp) 10)
                                        (setq lst (append lst (list (cdr temp))))
                                )
                                (setq ent (cdr ent))
                        )
                        (command "_donut" 0.0 0.4 (car lst) "")
                        (command "_donut" 0.0 0.4 (last lst) "")
      (setq n (+ 1 n))
    )
  )
发表于 2020-5-7 09:11:49 | 显示全部楼层
多段线没有 (assoc 11 ent) ,只有普通直线有, 多段线的点 都是 (cons 10 pt)集合

(setq pts (vl-remove-if-not '(lambda(x) (= 10 (car x))) ent))
(foreach pt pts
(command "_donut" 0.0 0.4 (cdr  pt) "")
)
 楼主| 发表于 2020-5-7 09:13:33 | 显示全部楼层
taoyi0727 发表于 2020-5-7 09:03
(defun c:TT (/ ent lst n slth ss1 temp)
  (setvar "cmdecho" 0)
  (setq

谢谢老师,能不能修改下,这个程序是画实心圆,半径很小,我想修改为绘制空心圆,半径可以设置输入。
 楼主| 发表于 2020-5-7 09:25:11 | 显示全部楼层
谢谢老师,老师的程序其他我没有修改,我就只修改了命令名
defun c:dyxldhy (/ ent lst n slth ss1 temp)
可是加载后,提示
命令: dyxldhy
未知命令“DYXLDHY”。按 F1 查看帮助。
 楼主| 发表于 2020-5-7 09:47:26 | 显示全部楼层
taoyi0727 发表于 2020-5-7 09:39
(defun c:dyxldhy (/ ent lst n radius slth ss1 temp)
  (setvar "cmdecho" 0)
  (setq

感谢感谢老师,测试成功了!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-18 03:54 , Processed in 0.165764 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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