啊业_48384 发表于 2018-12-26 21:02:43

求批量怎样改直接读,求大侠帮改下

本帖最后由 啊业_48384 于 2019-1-11 23:07 编辑

(defun c:ff (/ hole str1 str2 wigh h1 h2 h3 h4 )   
    (princ "\n请选择物体:");怎样改直接读
    (command "style" "Standard" "SIMKAI.TTF" "0" "1.0" "0.0" "N" "N")
    (SETVAR "CMDECHO" 0 )
    (COMMAND "UNITS" "" "2" "" "" "" "N")
    (setq ly (getvar "clayer"))
    (setq hole (ssget )
          len (sslength hole )
          num 0 arc 0 )
    (setq wok "A" )
    (command "layer" "on" "pn1" "" )
    (repeat len
      (setq name (cdr (assoc 0 (entget (ssname hole num ))))
            num (+ num 1 )
      )
      (if (= name "ARC")(setq arc (+ arc 1 )))
    )

   (cond
      ((= arc 0 )
      (setq h1 (listna hole 0 )
            h2 (listna hole 1 )
            h3 (listna hole 2 )
            h4 (listna hole 3 )
            leng (rtos (max h1 h2 h3 h4 ))
            wigh (min h1 h2 h3 h4 )
            syo" = "
      )
      )
      ((> arc 0 )
      (setq num 0 )
      (while (= (setq cen (cdr (assoc 40 (entget (ssname hole num ))))) nil )
         (setq num (+ num 1 ))
      )
      (setq h1 (listna hole 0 )
            h2 (listna hole 1 )
            h3 (listna hole 2 )
            h4 (listna hole 3 )
            wigh (* cen 2)
      )

         (if (= arc 1 )
             (setq leng (rtos (+ leng cen ))syo " =)" )
         )
         (if (= arc 2 )
             (setq leng (rtos (+ leng wigh ))syo "(=)" )   
         )
      )
   )
      (setq str1 (strcat(rtos wigh)"*"leng )
            str2 (strcat(rtos wigh) "*"leng syo wok )
      )
    (setvar "clayer" "pn1" )
    (command "text" pt3 "3" "0" str1 )
    (setvar "clayer" "pn2" )
    (command "text" pt3 "3" "0" str2 )
    (command "layer" "off" "pn2" "y" "" )
    (setvar "clayer" ly )
)

lifuq1979 发表于 2018-12-27 23:37:55

(ssget )===>(ssget "X")

啊业_48384 发表于 2019-1-3 23:00:13

批量又怎样改

zmzk 发表于 2019-12-13 14:40:54

你来求帮助,还把门槛设置这么高?不理解

linheyuanpcb 发表于 2019-12-13 15:08:11

运行不了,不知道对不对
(defun c:fff (/ hole str1 str2 wigh h1 h2 h3 h4 )   
    ;(princ "\n请选择物体:");怎样改直接读
    (command "style" "Standard" "SIMKAI.TTF" "0" "1.0" "0.0" "N" "N")
    (SETVAR "CMDECHO" 0 )
    (COMMAND "UNITS" "" "2" "" "" "" "N")
    (setq ly (getvar "clayer"))
    (setq hole(ssget "x"(list'(cons 8 ly)));(ssget )
          len (sslength hole )
          num 0 arc 0 )
    (setq wok "A" )
    (command "layer" "on" "pn1" "" )
    (repeat len
      (setq name (cdr (assoc 0 (entget (ssname hole num ))))
            num (+ num 1 )
      )
      (if (= name "ARC")(setq arc (+ arc 1 )))
    )

   (cond
      ((= arc 0 )
      (setq h1 (listna hole 0 )
            h2 (listna hole 1 )
            h3 (listna hole 2 )
            h4 (listna hole 3 )
            leng (rtos (max h1 h2 h3 h4 ))
            wigh (min h1 h2 h3 h4 )
            syo" = "
      )
      )
      ((> arc 0 )
      (setq num 0 )
      (while (= (setq cen (cdr (assoc 40 (entget (ssname hole num ))))) nil )
         (setq num (+ num 1 ))
      )
      (setq h1 (listna hole 0 )
            h2 (listna hole 1 )
            h3 (listna hole 2 )
            h4 (listna hole 3 )
            wigh (* cen 2)
      )

         (if (= arc 1 )
             (setq leng (rtos (+ leng cen ))syo " =)" )
         )
         (if (= arc 2 )
             (setq leng (rtos (+ leng wigh ))syo "(=)" )   
         )
      )
   )
      (setq str1 (strcat(rtos wigh)"*"leng )
            str2 (strcat(rtos wigh) "*"leng syo wok )
      )
    (setvar "clayer" "pn1" )
    (command "text" pt3 "3" "0" str1 )
    (setvar "clayer" "pn2" )
    (command "text" pt3 "3" "0" str2 )
    (command "layer" "off" "pn2" "y" "" )
    (setvar "clayer" ly )
)
页: [1]
查看完整版本: 求批量怎样改直接读,求大侠帮改下