วันพุธที่ 23 กุมภาพันธ์ พ.ศ. 2565

Add message Text or Dimension

 

;|     

       Add message Text or Dimension

       - Add message

       - front / behind

|;

(defun c:ADTD (/ dimss c ddata); = Dimension Text:

;-----------------------------------

       (if (or (not addon) (/= (type addon) 'STR)) (setq addon "เมตร"))

       (setq txtMtemp

              (getstring T (strcat "\npecify text to add message <"

                             addon

                                     "> : "

                                                ) ;_ strcat

              ) ;_ getdist

       ) ;_ setq

       (if (= txtMtemp "") (setq txtMtemp addon) (setq addon txtMtemp))

;-----------------------------------

(initget "front behind")

       (setq opt0 (getkword "\nAdd message \n[ front / behind ] : <front> "))

       (if (= opt0 "") (setq opt0 "front"))

       (setq dimss (ssget ":L" '((0 . "MTEXT,DIMENSION")))

                c -1

                dec 2 ;decimal

       ); setq

       (repeat (sslength dimss)

              (setq ddata (entget (ssname dimss (setq c (1+ c)))))

              (print (cdr (assoc 0 ddata)))

              (print addon)

              (cond

                     ((= (cdr (assoc 0 ddata)) "DIMENSION")    

                           (setq ddata (subst

                                                       (cons 1 (if (= opt0 "front")(strcat addon(rtos (cdr (assoc 42 ddata))2 dec))

                                                                                  (strcat (rtos (cdr (assoc 42 ddata))2 dec)addon)

                                                                     )

                                                       )

                                                       (assoc 1 ddata)

                                                       ddata

                                  ); subst & adjusted ddata

                           ); setq

                           (entmod ddata)             

                     );if

                     ((= (cdr (assoc 0 ddata)) "MTEXT")

                           (setq ddata (subst

                                                       (cons 1 (if (= opt0 "front")(strcat addon(cdr (assoc 1 ddata)))

                                                                                  (strcat(cdr (assoc 1 ddata)) "" addon)

                                                                     )

                                                       )

                                                       (assoc 1 ddata)

                                                       ddata

                                                ); subst & adjusted ddata

                           ); setq

                           (entmod ddata)

                     );if

              )

       ); repeat

       (princ)

); defun

(prompt "\nEnter ADTD to start. ")

ไม่มีความคิดเห็น:

แสดงความคิดเห็น