spring 发表于 2003-8-8 20:15:00

xdate(功能:注解輸出)

;;;功能:注解輸出
;;;By Spring
;;;08/08-03
;;;______________________________________________________
;;;錯誤處理函數
(defun ai_error        (errmsg)
(if errmsg
    '("console break"
      "Function Cancelled"
   )
    (princ (strcat "\nError: " errmsg))
)
(princ)
) ;_defun
;;;______________________________________________________
(defun C:TT1 (/             t_hight        ss       count          en           neu
              hcount   ed        edd       circle_xy           rad
              cen      cen_x        cen_y       circle_x circle_y circle_xy
              n             listxy        tag       p1          ent
             )
(setq cm (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq old_error *error*)
(setq *error* ai_error)
(setq qq nil)
(princ "\nText high <")
(setq t_hight (getvar "TEXTSIZE"))
(princ t_hight)
(setq t_hight (getstring ">"))
(setq ss (ssget))
(setq count 0)
(while (> (sslength ss) count)
    (setq en (ssname ss count))
    (setq count (1+ count))
    (setq neu (itoa count))
    (setq hcount (strcat "h" neu))
    (setq ed (entget en '("MY_TAG")))
    (setq tag1 (cdr (cadr (cadr (assoc -3 ed)))))
    (setq edd (entget en))
    (if        (/= tag1 nil)
      (progn
        (if (= (cdr (assoc 0 edd)) "CIRCLE")
          (progn
          (setq circle_xy nil)
          (setq rad (cdr (assoc 40 ed)))
          (setq cen (cdr (assoc 10 ed)))
          (setq cen_x (car cen))
          (setq cen_y (nth 1 cen))
          (setq circle_x (+ cen_x (* 0.8 rad)))
          (setq circle_y (+ cen_y (* 0.8 rad)))
          (setq circle_xy (list circle_x circle_y))
          (command "UCS" "World")
          (command "TEXT" circle_xy t_hight 0 hcount)
          (command "UCS" "Prev")
          )
        )                                ;if
        (if (= (cdr (assoc 0 edd)) "LWPOLYLINE")
          (progn
          (setq n 0)
          (setq listxy nil)
          (while (/= (nth n edd) nil)
              (if (= (car (nth n edd)) 10)
                (setq listxy (append listxy
                                     (list (list (cadr (nth n edd))
                                               (caddr (nth n edd))
                                           )
                                     )
                             )

                )
              )
              (setq n (1+ n))
          )
          (setq listxy (nth 2 listxy))
          (command "UCS" "World")
          (command "TEXT" listxy t_hight 0 hcount)
          (command "UCS" "Prev")
          )
        )                                ;if
        (setq tag1 (strcat hcount ": " tag1))
        (setq qq (cons tag1 qq))
      )
    )
)                                        ;while
(if (/= qq nil)
    (progn
      (setq qq (reverse qq))
      (setq p1 (getpoint "\ninsert point"))
      (setq tag (nth 0 qq))
      (command "_.TEXT" p1 t_hight 0 tag)
      (setq qq (cdr qq))
      (foreach ent qq
        (command "_.TEXT" "" ent)
      )
    )
    (prompt "\n無標籤圖元可產生註解資料")
)
(setvar "cmdecho" cm)
(setq *error* old_error)
(princ)
)



如何注解成如下形式

spring 发表于 2003-8-8 20:17:00

DWG文件

spring 发表于 2003-8-9 16:31:00

謝謝 mccad 的獎勵.
大家認為 xdate 好不好用阿.

meflying 发表于 2003-8-9 16:54:00

我这里用不上,呵呵。

spring 发表于 2003-8-9 17:18:00

以下是前生以前說的:

我个人的意见是用词典类的东西,方便很多,
看看vlax-ldate-??类的函数

spring 发表于 2003-8-11 18:32:00

大俠們,幚幫我啊!!!!!!!!!!

spring 发表于 2003-8-12 19:34:00

唉,无耐的望着天,叹叹气把头摇.

龙龙仔 发表于 2003-8-13 08:05:00

供參考:屬性統計
http://dnstw.com/viewtopic.php?t=4606

spring 发表于 2003-8-13 12:08:00

我不是會員進不去

龙龙仔 发表于 2003-8-13 12:34:00

內容(繁體)
页: [1] 2
查看完整版本: xdate(功能:注解輸出)