- 积分
- 30320
- 明经币
- 个
- 注册时间
- 2016-9-16
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
BF-pickset->list:AutoLispBaseFunctionLibrary是AutoCAD的AutoLisp/Vlisp的基础通用函数库函数;
是InspireFunction: 跃动方程(英文名为:Inspire Function)是一个编程爱好者成立的非营利性组织。 (gitee.com)
Cad二次开发类库ifoxCAD的维护大佬:山人等大佬维护整理的基础通用函数库!
- ;;(CNUM)圆周上的文字顺(逆)时针编号 by 702099480@qq.com 2024.4.9
- (defun C:CNUM(/ ang bf-pickset->list dxf edata ent lst lst1 lst2 num pt ss sslst timerun)
- (defun BF-pickset->list (SS)
- (vl-remove-if-not '(lambda (arg) (equal (type arg) 'ENAME)) (mapcar 'cadr (ssnamex SS)))
- )
- (defun dxf (code ent) (cdr (assoc code (entget ent))))
- (while (setq ss (ssget '((0 . "*TEXT"))))
- (setq num (getint "\n请输入起始编号,默认:<1>"))
- (if (or (= num "") (= num nil)) (setq num 1))
- (setq ang (getangle "\n请输入起始弧度值[0-2π],默认:<0>"))
- (if ang () (setq ang 0))
- (initget "s S n N")
- (setq timerun (getkword "\n[顺时针(S)/逆时针(N)],默认逆时针:<N>"))
- (if timerun (setq timerun (strcase timerun)) (setq timerun "N"))
- (if (setq pt (getpoint "\n指定中心点:"))
- (progn
- (setq sslst (BF-pickset->list ss))
- (cond
- ((= ang 0)
- (setq lst (vl-sort sslst '(lambda(x y)(< (angle pt (dxf 10 x)) (angle pt (dxf 10 y))))))
- (if (equal timerun "S") (setq lst (reverse lst)))
- )
- (t
- (setq lst1 (vl-remove-if-not '(lambda(x) (and (>= (angle pt (dxf 10 x)) ang) (< (angle pt (dxf 10 x)) (* 2 pi)))) sslst))
- (setq lst1 (vl-sort lst1 '(lambda(x y)(< (angle pt (dxf 10 x)) (angle pt (dxf 10 y))))))
-
- (setq lst2 (vl-remove-if-not '(lambda(x) (and (>= (angle pt (dxf 10 x)) 0) (< (angle pt (dxf 10 x)) ang))) sslst))
- (setq lst2 (vl-sort lst2 '(lambda(x y)(< (angle pt (dxf 10 x)) (angle pt (dxf 10 y))))))
-
- (if (equal timerun "S")
- (setq lst (append (reverse lst2) (reverse lst1)))
- (setq lst (append lst1 lst2))
- )
- )
- )
- (while (setq ent (car lst))
- (setq edata (entget ent))
- (setq edata (subst (cons 1 (rtos num)) (assoc 1 edata) edata))
- (entmod edata)
- (setq lst (cdr lst) num (1+ num))
- )
- )
- )
- )
- (prin1)
- )
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
评分
-
查看全部评分
|