วันพฤหัสบดีที่ 20 ตุลาคม พ.ศ. 2565

Dimensions Sum

;|

      Dimensions Sum #AutoCAD #CADTHAI

      - Selected Dimensions

      - Enter and pick to text sum.

|;

(defun c:sumdim (/ sum ss n dim mea ddata prec)

      (setq old_cmdecho (getvar "cmdecho"))

      (setvar "CMDECHO" 0)

      (setq sum 0.0)

      (prompt "\nAdd values of Dimensions")

      (if (setq ss (ssget '((0 . "DIMENSION"))))

            (progn

                  (repeat (setq n (sslength ss))

                        (setq dim (ssname ss (setq n (1- n))))

                        (setq mea (cdr (assoc 42 (setq ddata (entget dim)))))

                        (setq prec (getvar "DIMDEC")

                                sum (+ sum mea)

                        )

                  )

                  (setq p1 (getpoint "\nPick point to Text Sum. :"))

                  (command "text" "j" "mc" p1 (getvar "textsize") "0" (rtos sum (getvar 'lunits) prec))

                  (prompt(strcat "\nSum of distances = " (rtos sum (getvar 'lunits) prec)))

            )

            (prompt "\nNo Dimensions selected.")

      )

(setvar "CMDECHO" old_cmdecho)

(princ)

)


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

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