chpmould 发表于 2011-6-9 23:50:27

690994 发表于 2011-6-9 15:08 static/image/common/back.gif
象你只要求最大直径,这个比较简单,我以前要以圆之大小,线型,颜色,图层,附加数据等再判断同种孔有几 ...

你可以帮我按你所说的方式写个例子吗,示范将同心圆最大直径更改成红色即可...

690994 发表于 2011-6-12 16:05:15

chpmould 发表于 2011-6-9 23:50 static/image/common/back.gif
你可以帮我按你所说的方式写个例子吗,示范将同心圆最大直径更改成红色即可...

你试下下面这段代码,
(defun c:te( / cpt ent i itm lst r ss tem)   
    (setq ss (ssget '((0 . "CIRCLE")))
          tem '()
          i 0
    )   
   (repeat (sslength ss)
          (setq ent (ssname ss i)
                i (1+ i)
                      cpt (sam_dxf ent 10)
                      cpt(list (/ (fix(* 100000.0(car cpt)))100000.0)
                               (/ (fix(* 100000.0(cadr cpt)))100000.0)
                               (/ (fix(* 100000.0(caddr cpt)))100000.0)
                         )
                      r (sam_dxf ent 40)
                lst (list(list r (sam_dxf ent 5)))
             
          )
      (setq itm (assoc cpt tem))
          (if itm                   
                  (if (and (> i 1)(> r (caadr itm)))
                        (setq tem (vl-remove itm tem)
                              tem (append tem(list(append (list cpt) lst)))
                        )
                     )
                  (setq tem(append tem(list(append (list cpt) lst))))
          )                             
        )
        (setq ss (ssadd))                             
        (foreach x tem
           (setq ss (ssadd (handent (last(last x)))ss))
        )
        (command "change" ss "" "p" "c" 1 "")
)
(defun sam_dxf (ent n)
        (if (= (type ent) 'ename)
          (cdr (assoc n (entget ent)))
        )       
)

zhongys 发表于 2011-6-12 19:24:20

yewuqiang 发表于 2011-6-13 08:56:43

要处理这么多圆?

chpmould 发表于 2011-6-13 18:07:59

690994 发表于 2011-6-12 16:05 static/image/common/back.gif
你试下下面这段代码,
(defun c:te( / cpt ent i itm lst r ss tem)   
    (setq ss (ssget '((0 . "C ...

谢谢你的热心帮助,现在知道你之前所说做成表的方法了...
页: 1 2 [3]
查看完整版本: 获取同心圆中最大圆直径