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

Edit Left and Right Cross-Section Distance

 


;|    

      Edit Left and Right Cross-Section Distance

Designed and Created February 2022

      - Options Decimal

      - Add Number Bank(Taling)

      - Select object   

|;

(defun c:EDTD (/ ddata)

(setq old_dimzin (getvar "dimzin"))

(setvar "dimzin" 4)

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

(initget "0 0.0 0.00 0.000")

      (setq opt0 (getkword "\nOptions Decimal \n [  0 /  0.0 /  0.00 /  0.000 ] : <0> "))

      (if (= opt0 "") (setq opt0 "0"))

      (cond

            ((if (= opt0 "0")  (setq dec 0))) ;decimal 1

            ((if (= opt0 "0.0")  (setq dec 1))) ;decimal 1

            ((if (= opt0 "0.00")  (setq dec 2))) ;decimal 2

            ((if (= opt0 "0.000")  (setq dec 3))) ;decimal 3

      ); setq

;(setq dec 3)     

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

      (if (not addon) (setq addon 59.0))

      (setq txtMtemp

            (getdist (strcat "\nAdd Number Bank(Taling) : <"

                            (rtos addon 2 dec)

                                     "> : "

                                          ) ;_ strcat

            ) ;_ getdist

      ) ;_ setq

      (if (not txtMtemp) (setq txtMtemp addon) (setq addon txtMtemp))

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

      (princ "Select object (window) :")

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

            (progn

                  (setq c -1)

                  (repeat (sslength dimss)

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

                                str (atof (cdr (assoc 1 ddata)))

                        )

                        (setq ddata (subst

                                                (cons 1 (if (= str addon)

                                                                  (if(= dec 0)(rtos 0.0 2 dec)            ;0

                                                                        (strcat "0"(rtos 0.0 2 dec))  ;0.0 0.00 0.000

                                                                  )

                                                                  (rtos (- str addon)2 dec)

                                                            )

                                                )

                                                (assoc 1 ddata)

                                                ddata

                                          ); subst

                        ); setq

                        (entmod ddata)

                  )

            );progn

      )    

(setvar "dimzin" old_dimzin) 

(princ)

); defun

(prompt "\nCreate and Design by SONGKHRAN JONGKUL February 2022")

(prompt "\nEnter EDTD to start. ")

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

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