samifox Posted April 20 Share Posted April 20 hi im trying to write a lisp that -ask user to select objects and capture them - invoke the boundary command so user can pick point - capture the new object generated deletes the old objects the lisp yell this error, ; error: bad argument type: VLA-OBJECT nil i can't debug since the breakpoint is ignored. any idea? (defun c:br (/ original_objects new_boundary) (setq original_objects (ssget '((0 . "*LINE")))) (if (and original_objects (> (sslength original_objects) 0));; if selected (progn (command "-BOUNDARY") (setq new_boundary (entlast)) (repeat (sslength original_objects) (vla-delete (vlax-ename->vla-object (ssname original_objects 0))) ) (princ "\nBoundaries created and original polylines replaced.") ) (princ "\nNo polylines found to replace.") ) (princ) Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted April 20 Share Posted April 20 (edited) I've changed just slightly your code, but untested I think that it should work... (defun c:br ( / original_objects new_boundary k e ) (setq original_objects (ssget "_:L" (list (cons 0 "*LINE")))) (if (and original_objects (> (sslength original_objects) 0));; if selected (progn (initdia) (command "_.BOUNDARY") (while (< 0 (getvar (quote cmdactive))) (command "\\") ) (setq new_boundary (entlast)) (setq k -1) (repeat (sslength original_objects) (if (and (setq e (ssname original_objects (setq k (1+ k)))) (not (vlax-erased-p e))) (entdel e) ) ) (princ "\nBoundaries created and original polylines replaced.") ) (princ "\nNo polylines found to replace.") ) (princ) ) HTH. M.R. Edited April 21 by marko_ribar Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.