- (defun c:AtInsert3 (/ obj)
- (if
- (setq obj
- (SelectifFoo
- (lambda (x)
- (if
- (vlax-property-available-p
- (setq x (vlax-ename->vla-object x))
- 'InsertionPoint
- )
- x
- )
- )
- "\nSelect Object: "
- )
- )
- ;; AJT begin edit
- ((lambda (ins)
- (if (eq 1 (logand 1 (getvar 'cmdactive)))
- ins
- (command "_.line" "_non" ins "_non" (c:ATInsert3))
- )
- )
- (trans (vlax-get obj 'InsertionPoint) 0 1)
- )
- ;; AJT end edit
- )
- )
- (defun SelectifFoo (foo str / sel x)
- (while
- (progn
- (setq sel (entsel str))
- (cond
- (
- (vl-consp sel)
- (if (not (setq x (foo (car sel))))
- (princ "\n** Invalid Object Selected **")
- )
- )
- )
- )
- )
- x
- )
当然,如果这就是你想要的,这可以简单得多。 |