วันพฤหัสบดีที่ 24 ธันวาคม พ.ศ. 2563

Boundary and Hatch to Area.

 

;; boundary and hatch to area.

(defun c:BHA (/ pt)

(setq old_cmdecho  (getvar "cmdecho"))

(setvar "cmdecho" 0)

       (setq txtH 10.0); Current height

       (setq txtS (getvar "textstyle")); Current Style

       (setq dec 3)  ; decimal 3  

       (setq tot_area 0.0)

      

       (while (setq pt (getpoint "\nPick internal point: "))

              (command "_.-boundary" "_a" "_i" "_n" "" "" "_non" pt "")

              (command "_.-hatch" "_p" "_solid" pt "")

              (command "_area" "o" "l")

              (setq tot_area (+ tot_area (getvar "area")))                      

       )

       (command "_erase" "l" "")

       (setq txt (strcat (rtos tot_area 2 dec)" m\U+00B2")) ;add , comma 

       (setq ptxt (getpoint "\n Pick Area Location: "))

       ;(setvar "cecolor" old_cecolor)

       (entmake

              (list

                     '(0 . "MTEXT")

                     '(100 . "AcDbEntity")

                     '(100 . "AcDbMText")

                     (cons 10 ptxt)

                     (cons 7  txtS)

                     (cons 40 txtH) 

                     (cons 41 0) ; 0 Width = no wrap

                     (cons 71 5) ; 1=Top Left   /2=Top Center   /3= Top Right

                                         ; 4=Middle Left/5=Middle Center/6=Middle Right

                                         ; 7=Bottom Left/8=Bottom Center/9=Bottom Right

                     (cons 50 0.0) ; rotation angle

                     (cons 1 txt)

              )

       )

(setvar "cmdecho" old_cmdecho)

(princ)

)

(prompt "\nEnter BHA to Start boundary and hatch to area.")


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

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