Lt Dan's legs Posted April 10, 2012 Posted April 10, 2012 I'm making a lisp to use inside the blockeditor. I have not figured out how to get the block name without having to type it in.. How do I go about achieving this? Quote
MSasu Posted April 10, 2012 Posted April 10, 2012 Seems that there is no system variable to store that (for REFEDIT command you have REFEDITNAME). One solution will be to try to redefine the BEDIT command to get control over user's selection. Regards, Mircea Quote
pBe Posted April 10, 2012 Posted April 10, 2012 I guess it would depend how you invoke the BEDIT command: (defun c:BedName () (setq bn (ssget "_:S:E:L" '((0 . "INSERT")))) (setq bnm (cdr (assoc 2 (entget (ssname bn 0))))) (sssetfirst nil bn) (command "_bedit") ) (defun otherFun (b) (princ (strcat "\nCurrent Blockname " b":")) (setq pt (getpoint "\nPick point:"))) (otherfun bnm); Quote
Lt Dan's legs Posted April 23, 2012 Author Posted April 23, 2012 I don't like it, but it works (defun c:test ( / l1 p l2 r ) (vl-load-com) (if (eq 1 (getvar 'blockeditor)) (progn (vlax-for x (vla-get-blocks (setq *acdoc* (cond ( *acdoc* ) ( (vlax-get (vlax-get-acad-object) 'ActiveDocument) ) ) ) )(setq l1 (cons (cons (vla-get-count x) x) l1)) ) (setq p (entmakex (list (cons 0 "point") (cons 10 '(0. 0. 0.)) ) ) ) (vl-cmdf "_.bsave")(entdel p) (vlax-for x (vla-get-blocks *acdoc*) (if (not (or (vl-position (cons (vla-get-count x) x) l1 ) (eq "*MODEL_SPACE" (vla-get-name x) ) ) )(setq l2 (cons x l2)) ) ) (alert (vla-get-name (car l2))) (vl-cmdf "_.bsave") ) (prompt "\nCommand only allowed in block editor!!") ) (princ) ) Quote
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.