明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 223|回复: 1

【K:DynDrawCircle】Grread动态绘制圆并返回图元名称

[复制链接]
发表于 2024-4-12 21:46 | 显示全部楼层 |阅读模式
  1. ;动态绘制圆@Kucha
  2. (defun K:DynDrawCircle (StaPt Col / K:GrvecsCircle Code TgtKey EntNam)
  3.   ;grdraw绘制近似圆@LEEMAC
  4.   (defun K:GrvecsCircle (Cen Rad Col / ang inc)
  5.     (setq inc (/ (+ pi pi) 24.0)
  6.           ang 0.0
  7.     )
  8.     (repeat 24 (grdraw (polar Cen ang Rad) (polar Cen (setq ang (+ ang inc)) Rad) Col))
  9.   )
  10.   (while
  11.     (progn
  12.       (princ "\n→请指定半径<空格退出>: ")
  13.       (while (and (setq Code (grread T (+ 1 4 8))) (eq (car Code) 5))
  14.           (redraw)(K:GrvecsCircle StaPt (distance StaPt (cadr Code)) Col)
  15.       );显示预览
  16.       (setq TgtKey (cadr Code))
  17.       (cond
  18.         ((eq (car Code) 3);点选
  19.             (redraw)
  20.             (setq EntNam (entmakeX (list '(0 . "CIRCLE") (cons 10 (trans StaPt 1 0)) (cons 40 (distance StaPt (cadr Code))))))
  21.             Nil ;退出循环
  22.         )
  23.         (T Nil)
  24.       )
  25.     )
  26.   )
  27.   EntNam
  28. )



用法:
  1. (K:DynDrawCircle (getpoint) 1)

发表于 2024-4-12 23:50 | 显示全部楼层
感谢大佬分享~
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-4 03:23 , Processed in 0.275739 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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