laoguiqi 发表于 2012-5-2 14:53:59

新手求教!!

我想框选一个区域,并只选择该区域内的圆,其他的都不选!!然后要求修改圆的直径。改怎么弄啊!!

Andyhon 发表于 2012-5-2 15:02:59

参考先
http://bbs.mjtd.com/thread-71579-1-1.html

zyhandw 发表于 2012-5-2 16:09:27

给你写个吧,反正也很简单,代码如下:(defun c:modidiam( / cir-num newdia cirall cir-name cir-name-vla)
(vl-load-com)
(setq cir-num 0)
(setq newdia (getreal"\n请输入修改后的直径:"))
(if (setq cirall (ssget '((0 . "circle"))))
      (repeat (sslength cirall)
         (setq cir-name (ssname cirall cir-num))
         (setq cir-name-vla (vlax-ename->vla-object cir-name))
         (vlax-put-property cir-name-vla 'diameter newdia);cirall
         (setq cir-num (1+ cir-num))
      )
)
(princ)
)
(prompt "\n【程序运行命令:modidiam】")

梦醒才知原是梦 发表于 2012-5-2 17:27:38

收藏~~~~~~~~~

【KAIXIN】 发表于 2012-5-2 18:31:34

;改多圆、圆弧半径 作者:KAIXIN
(defun c:XX ()
(setq br (getreal "\n输入你想要的半径:"))
(prompt "\n请框选你要改变的圆: ")
(setq        ss (ssget '((0 . "CIRCLE,ARC")))
        i   -1
)
(while (setq s1 (ssname ss (setq i (1+ i))))
    (KX-SubUpd s1 40 br)
)
(princ)
)

(defun KX-SubUpd (ename code newvalue)

(entmod (subst (cons code newvalue)
   
(assoc code (entget ename))
   
(entget ename)
   )
)
(entget ename)
)

laoguiqi 发表于 2012-5-3 07:14:15

谢谢,大家的帮助!,感觉明经的好人真多啊!!
页: [1]
查看完整版本: 新手求教!!