I have the following code where after creating a new layer, I loop a function where the user selects an object that get a boundingbox and some property-changes.
What I would like after the user is done selecting objects, is to execute two commands . But when pressing spacebar I get an error message "error: bad argument type: lentityp nil".
(defun C:REVN ( / ss blockID point1 point2 newRevLayer rev rRev obj *error*)
(vl-load-com)
(setq ss (ssget "_X" '((2 . "BL-H-H1"))))
(setq blockID (ssname ss 0))
(setq rRev (getpropertyvalue blockID "REV"))
(setq rev (vl-string-trim " " rRev))
(setq newRevLayer (strcat "REVMARK"rev))
(command "._layer" "_make" newRevLayer "_color" 7 "" "")
(while
(setq obj (vlax-ename->vla-object (car (entsel))))
(vla-getboundingbox obj 'point1 'point2)
(setq point1 (vlax-safearray->list point1))
(setq point2 (vlax-safearray->list point2))
(setq point1 (list (car point1) (cadr point1)))
(setq point2 (list (car point2) (cadr point2)))
(command "._rectang" point1 point2 "")
(command "._pedit" "_last" "w" 2 "")
(command "chprop" "_last" "" "c" 50 "tr" 40 "")
)
(command "._IsdInsertn" "IN-RIVNING")
(while (> (getvar 'CmdActive) 0) (command pause))
(command "._layer" "_set" 0 "")
)