markv Posted October 17, 2011 Share Posted October 17, 2011 I am not sure if this is built into CAD or if I need a lisp. I would like to select a field that contains area information and have the object that is associated with that field highlight. The field is an attribute in a block. any suggestions? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 17, 2011 Share Posted October 17, 2011 Here is a basic form of the program: (defun c:fieldobject ( / en ) (while (progn (setvar 'ERRNO 0) (setq en (car (nentsel "\nSelect Field: "))) (cond ( (= 7 (getvar 'ERRNO)) (princ "\nMissed, try again.") ) ( (eq 'ENAME (type en)) (if (and (wcmatch (cdr (assoc 0 (setq en (entget en)))) "*TEXT,ATTRIB") (setq en (cdr (assoc 360 en))) (setq en (dictsearch en "ACAD_FIELD")) (setq en (dictsearch (cdr (assoc -1 en)) "TEXT")) (setq en (cdr (assoc 360 en))) (setq en (cdr (assoc 331 (entget en)))) ) (redraw en 3) (princ "\nObject does not contain a Field.") ) ) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted October 17, 2011 Share Posted October 17, 2011 This ... ? (defun c:TesT (/ selectionlist ss i ssNme lst) ;;; Tharwat 17. Oct. 2011 ;;; (if (setq selectionlist (ssadd) ss (ssget "_x" '((0 . "INSERT") (66 . 1))) ) (progn (repeat (setq i (sslength ss)) (setq ssNme (ssname ss (setq i (1- i)))) (vlax-for x (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)) ) (cdr (assoc 2 (entget ssNme))) ) (if (and (eq (vla-get-objectname x) "AcDbMText") (not (eq (vl-string-search "Area" (vla-fieldcode x) 0) "") ) ) (ssadd ssNme selectionlist) ) ) ) (sssetfirst nil Selectionlist) ) (princ) ) (princ) ) (vl-load-com) Tharwat Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 1, 2011 Share Posted November 1, 2011 Were either of these solutions suitable markv, or were we wasting our time? Quote Link to comment Share on other sites More sharing options...
markv Posted November 1, 2011 Author Share Posted November 1, 2011 Sorry i have been using the first soulution. Thansk for all the help. I thoguht I posted back already. again I apologize Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 1, 2011 Share Posted November 1, 2011 Sorry i have been using the first soulution. Thansk for all the help. I thoguht I posted back already. again I apologize No problem , and it is good to hear from you at last . Quote Link to comment Share on other sites More sharing options...
markv Posted November 1, 2011 Author Share Posted November 1, 2011 Now if I could just check for typos Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 2, 2011 Share Posted November 2, 2011 Good stuff markv 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.