วันพฤหัสบดีที่ 18 มีนาคม พ.ศ. 2564

Circle to Dimond C2DM

 

;|

      - Circle to Dimond

      - Create by Songkhran Jongkul 19 March 2021

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

|;

(defun c:c2dm ( / e i ss)

(setq old_cmdecho  (getvar "cmdecho"))

(setq old_osnap (getvar "osmode"))

(setq old_layer (getvar "clayer"))            ; layer

(setvar "cmdecho" 0)

(setvar "osmode" 0) 

    (if (setq ss (ssget "_:L" '((0 . "CIRCLE"))))

        (progn

                  (repeat (setq i (sslength ss))                 

                        (setq e (ssname ss (setq i (1- i)))

                                ly (cdr(assoc 8  (entget e)))     ;layer name

                                ct (cdr(assoc 10 (entget e)))     ;center point

                                rd (cdr(assoc 40 (entget e)))     ;radial                  

                        )

                        (command "_erase" e "")

                        (setq dm1 (list (-(car ct) rd)(cadr ct))

                                dm2 (list (+(car ct) rd)(cadr ct))

                                dm3 (list (car ct)(+(cadr ct)(* rd 1.50)))

                                dm4 (list (car ct)(-(cadr ct)(* rd 1.50)))

                        )

                        (setvar "clayer" ly)

                        (command "_pline" dm1 dm3 dm2 dm4 "c")      

                  )

            )

    )

(setvar "cmdecho" old_cmdecho)

(setvar "osmode" old_osnap)

(setvar "clayer" old_layer)  

(princ)

)

(prompt "\nEnter C2DM to start. ")


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

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