1
AutoLISP (Vanilla / Visual) / Need help "rotate block for preview prior pick point to insert block"
« Last post by Phuc Le on Today at 09:24:36 PM »I found Lee Mac's code at this link:
https://www.theswamp.org/index.php?topic=40686.0
but I can't execute the block rotation function when pressing the ESC key (when I press ESC it exits the command)
Can someone please help me if possible:
1. Change the block rotation function to the R key
2.maintain the block insertion command until the Enter or ESC key is pressed
Here is the code
(defun c:test ( / b c r )
(setq r 0.0)
(setq c (getvar 'CMDECHO))
(setvar 'CMDECHO 0)
(while
(not
(or
(eq "" (setq b (getstring t "\nBlock to Insert: ")))
(tblsearch "BLOCK" b)
)
)
(princ "\nBlock not found.")
)
(if (not (eq "" b))
(while
(progn
(princ "\nSpecify Insertion Point (Esc to Rotate): ")
(null (vl-cmdf "_.-insert" b "_S" 1.0 "_R" (* 180. (/ r pi)) pause))
)
(setq r (rem (+ r (/ pi 2.)) (+ pi pi)))
)
)
(setvar 'CMDECHO c)
(princ)
)
(vl-load-com)
https://www.theswamp.org/index.php?topic=40686.0
but I can't execute the block rotation function when pressing the ESC key (when I press ESC it exits the command)
Can someone please help me if possible:
1. Change the block rotation function to the R key
2.maintain the block insertion command until the Enter or ESC key is pressed
Here is the code
(defun c:test ( / b c r )
(setq r 0.0)
(setq c (getvar 'CMDECHO))
(setvar 'CMDECHO 0)
(while
(not
(or
(eq "" (setq b (getstring t "\nBlock to Insert: ")))
(tblsearch "BLOCK" b)
)
)
(princ "\nBlock not found.")
)
(if (not (eq "" b))
(while
(progn
(princ "\nSpecify Insertion Point (Esc to Rotate): ")
(null (vl-cmdf "_.-insert" b "_S" 1.0 "_R" (* 180. (/ r pi)) pause))
)
(setq r (rem (+ r (/ pi 2.)) (+ pi pi)))
)
)
(setvar 'CMDECHO c)
(princ)
)
(vl-load-com)