วันอาทิตย์ที่ 21 กันยายน พ.ศ. 2568

Make Blocks

Make Blocks


;|

Make Blocks

- Pick Frist Point.

- Pick Second Point for Seclection conner.

- Setting insertionpoint to Frist Point.

- Setting Blockname "My_Block1" and count 1+

- Create and Design by SONGKHRAN JONGKUL September 2025           

- Contact https://www.facebook.com/groups/AutolispTH

|;


(defun c:MBLK (/ p1 p2 selectionset insertionpoint Blockname)

(setq old_cmdecho  (getvar "cmdecho"))

(setvar "cmdecho" 0)

(while (setq p1 (getpoint "\nFrist Conner :"))

   (setq p2 (getcorner p1 "\nSecond Conner :"))

(if (and (setq selectionset (ssget "w" p1 p2))

             (setq insertionpoint p1)

        )

(progn

(setq number 1

  Blockname (strcat "My_Block" (itoa number))

)

(while (tblsearch "BLOCK" Blockname)

(setq Blockname

(strcat "My_Block" (itoa (setq number (1+ number))))

)

)

(vl-cmdf "_.-Block" Blockname insertionpoint selectionset "")

(vl-cmdf  "_.-insert" Blockname insertionpoint "" "" "")

)

);;if make block

)

(setvar "cmdecho" old_cmdecho)

(princ)

)

(prompt "\n\t\t\t  +------------------------------------------+\n")

(prompt "\n\t\t\t  |      Start with MBLK to execute          |\n")

(prompt "\n\t\t\t  +------------------------------------------+\n")

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

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