HFB Posted July 26, 2024 Posted July 26, 2024 Hi. I am getting my head around the sheet set manager, and have been using fields to reference different sheets numbers. I've broken some links at some point and have no problem fixing them, I just would like to know if there is a quick way to select all the MTEXT objects that contain fields. If I could narrow it down to ones that are broken (displaying ##), that would be even better. Prefer something simple, but am starting to use Lisps now that there are starting to be some LT useable ones. Quote
BIGAL Posted July 27, 2024 Posted July 27, 2024 Doing a google found an answer by the great Lee-mac. ;; Field Code - Lee Mac ;; Returns the field expression associated with an object. (defun LM:FieldCode ( en / fd id ) (cond ( (and (wcmatch (cdr (assoc 0 (setq en (entget en)))) "TEXT,MTEXT,ATTRIB") (setq en (cdr (assoc 360 en))) (setq en (dictsearch en "ACAD_FIELD")) (setq en (dictsearch (cdr (assoc -1 en)) "TEXT")) (setq fd (entget (cdr (assoc 360 en)))) ) (if (vl-string-search "\\_FldIdx " (cdr (assoc 2 en))) (vl-string-subst (if (setq id (cdr (assoc 331 fd))) (vl-string-subst (strcat "ObjId " (itoa (vla-get-objectid (vlax-ename->vla-object id)))) "ObjIdx 0" (cdr (assoc 2 fd)) ) (cdr (assoc 2 fd)) ) "\\_FldIdx 0" (cdr (assoc 2 en)) ) (cdr (assoc 2 en)) ) ) ) ) (vl-load-com) Quote
HFB Posted July 28, 2024 Author Posted July 28, 2024 On 7/27/2024 at 12:48 PM, BIGAL said: Doing a google found an answer by the great Lee-mac... Thanks for that, but when I run it (after editing to change LM: to c:), I just get "too few arguments". I even went straight to LM's site and copied straight from there (slightly different to the version you've pasted) and get the same result. I've tried selecting everything before running, just in case that made a difference. I am running AutoCAD LT 2024. Bearing in mind that lisps have only been useable in LT in the last year, I have very little knowledge of what sort of outcome I should expect from the code, so I can't even stare at it until I get an epiphany of where the problem might be... Quote
BIGAL Posted July 29, 2024 Posted July 29, 2024 You load the defun then need to call the defun. (defun LM:FieldCode ( en / fd id ) ......... ......... ) (LM:FieldCode (car (entsel "\nPick an entity for field check "))) Quote
SLW210 Posted July 29, 2024 Posted July 29, 2024 AutoCAD 2024 LT will not run VLISP. (just a tip, if you see (vl-load-com), VL, among other things, it's VLISP) Lee Mac's Code is VLISP. Quote
HFB Posted July 30, 2024 Author Posted July 30, 2024 (edited) 15 hours ago, SLW210 said: AutoCAD 2024 LT will not run VLISP. (just a tip, if you see (vl-load-com), VL, among other things, it's VLISP) Lee Mac's Code is VLISP. Thanks for the heads up on that one. I did think it odd that it had LM: instead of c : Edited July 30, 2024 by HFB c: autocorrected to smiley face Quote
SLW210 Posted July 30, 2024 Posted July 30, 2024 LM: just stands for LeeMac, Possibly look at AutoLISP sites for learning, you might be able to come up with a non=VLISP solution. IIRC there are DXF codes for fields, but I am not sure how much an AutoLISP code can manipulate fields. AfraLISP would be a good place to start. I am not at work today, but if no one jumps in, I'll try to find time tomorrow. Quote
SLW210 Posted July 30, 2024 Posted July 30, 2024 There was a frequent member on here that used pre-LISP AutoCAD LT and did a lot of customization, mostly using Excel and maybe Diesel. Browse through the AutoCAD LT section. Quote
HFB Posted August 5, 2024 Author Posted August 5, 2024 (edited) On 7/30/2024 at 11:16 PM, SLW210 said: There was a frequent member on here that used pre-LISP AutoCAD LT and did a lot of customization, mostly using Excel and maybe Diesel. Browse through the AutoCAD LT section. I will do that when I get a chance. I don't have a lot of spare time for creating/searching stuff at work, unfortunately. Edited August 5, 2024 by HFB minor amend 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.