TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Marc'Antonio Alessi on February 21, 2020, 09:13:41 AM
-
; simple example:
(defun ALE_Block_Draw_Insert (NewLyr / LstEnt)
(if (> (atof (getvar "ACADVER")) 23.0)
(command "_CLASSICINSERT")
(progn (initdia 1) (command "_.INSERT"))
)
(setq LstEnt (entlast))
(command "_.CHPROP" LstEnt "" "_LAYER" NewLyr "")
(princ)
)
in this sample (entlast) refers to the last entity before the command.
-
(defun ALE_Block_Draw_Insert (NewLyr / LstEnt)
(if (> (atof (getvar "ACADVER")) 23.0)
(command "_CLASSICINSERT")
(progn (initdia 1) (command "_.INSERT"))
)
(setq LstEnt (entlast))
(command "_.CHPROP" LstEnt "" "_LAYER" NewLyr "")
(princ)
)
Maybe
(command ".chprop" "last" "" "_LAYER" NewLyr "")
-
Maybe :
(defun ALE_Block_Draw_Insert (NewLyr / LstEnt)
(if (> (atof (getvar "ACADVER")) 23.0)
(command "_CLASSICINSERT")
(progn (initdia 1) (command "_.INSERT"))
)
(while (< 0 (getvar 'cmdactive)) (command "\\"))
(setq LstEnt (entlast))
(command "_.CHPROP" LstEnt "" "_LAYER" NewLyr "")
(princ)
)
-
Marko, V-Man thanks, both of your solutions seem to works properly.