LYC688 发表于 2023-11-6 00:26:34

hhh454 发表于 2023-11-4 13:49
需要加载院长的自定函数,论坛里面有

是这个函数吗?
(defun xyp-SubUpd (ename code val / ent x y i s1)

(cond ((= (type ename) 'ENAME)

(setq ent (entget ename))

(if (and (= (type code) 'LIST) (= (type val) 'LIST))

(mapcar '(lambda (x y) (xyp-SubUpd ename x y)) code val)

(progn

(if (= (xyp-dxf code ename) nil)

(entmod (append ent (list (cons code val))))

(entmod (subst (cons code val) (assoc code ent) ent))

)

(entupd ename)

)

)

)

((= (type ename) 'PICKSET)

(setq i -1)

(while (setq s1 (ssname ename (setq i (1+ i))))

(xyp-SubUpd s1 code val)

)

)

((= (type ename) 'LIST)

(foreach s1 ename (xyp-SubUpd s1 code val))

)

)

ename

)

吾一岁就很帅 发表于 2023-11-7 08:10:42

前来学习

LYC688 发表于 2023-11-7 22:35:08

xyp1964 发表于 2023-11-4 09:52
(defun c:tt ()
"批量更新圆或圆弧的半径"
(setq rr (Ureal 7 "" "新半径" rr))


(defun c:11 ()
"批量更新圆或圆弧的半径"
(setq rr (getreal "输入新半径:"))
(while (setq ss (ssget '((0 . "CIRCLE,ARC"))))
    (xyp-SubUpd ss 40 rr)
)
(princ)
)

(defun xyp-SubUpd (ename code val / ent x y i s1)
(cond
    ((= (type ename) 'ENAME)
   (setq ent (entget ename))
   (if (and (= (type code) 'LIST) (= (type val) 'LIST))
       (mapcar '(lambda (x y) (xyp-SubUpd ename x y)) code val)
       (progn (if (= (xyp-dxf code ename) nil)
                (entmod (append ent (list (cons code val))))
                (entmod (subst (cons code val) (assoc code ent) ent))
              )
              (entupd ename)
       )
   )
    )
    ((= (type ename) 'PICKSET)
   (setq i -1)
   (while (setq s1 (ssname ename (setq i (1+ i))))
       (xyp-SubUpd s1 code val)
   )
    )
    ((= (type ename) 'LIST)
   (foreach s1 ename (xyp-SubUpd s1 code val))
    )
)
ename
)

(defun xyp-dxf (code ename / ent lst a)
(if (= (type code) 'list)
    (progn (setq ent (entget ename))
           (setq lst nil)
           (foreach a code
             (setq lst (cons (list a (cdr (assoc a ent))) lst))
           )
           (reverse lst)
    )
    (progn (if (= code -3)
             (progn (cdr (assoc code (entget ename '("*")))))
             (progn (cdr (assoc code (entget ename))))
           )
    )
)
)

LYC688 发表于 2023-11-7 22:36:27

LYC688 发表于 2023-11-7 22:35
(defun c:11 ()
"批量更新圆或圆弧的半径"
(setq rr (getreal "输入新半径:"))


感觉也不行;P

LYC688 发表于 2023-11-7 22:41:07

LYC688 发表于 2023-11-7 22:35
(defun c:11 ()
"批量更新圆或圆弧的半径"
(setq rr (getreal "输入新半径:"))


院长的函数加在一起其实也挺长的呀

ghgh0130 发表于 2023-11-7 23:14:09

{:1_1:}{:1_1:}{:1_1:}

paulpipi 发表于 2023-11-7 23:17:25


感谢楼主分享,VERY GOOD

阿猪蛋 发表于 2023-11-14 09:41:09

很实用,小白一枚,向大佬学习

wangsr 发表于 2023-11-18 10:14:43

我的20132024全可以用谢谢

bonny 发表于 2023-12-5 16:17:11

太过分啦:lol
页: 1 [2] 3
查看完整版本: 批量更新圆的半径