izzimayaa Posted July 20, 2023 Posted July 20, 2023 (edited) I am using LeeMac's quickfield to update MLeader's text into Block's name. I modified one part of the lisp into (defun c:test3 ( ) (LM:QuickField "EffectiveName" "" 1)) to insert text into existed mleader. I think I may have to modify this part to get it to work with MLeader (?) I tried with creating a new text and it worked properly. The issue comes when I am updating the existing Mleader, it shows #### instead (see the attached video). I am not sure if it's right or not since I am new to lisp, but I guess it has something to do with this part that only works for text and need some modification in order for it to work with multi leader text property. Any help would be appreciated. Full lisp is attached. (defun LM:quickfield ( prop format mode / ent ins obj str ) (if (setq str (LM:quickfield:constructfieldstring prop format)) (cond ( (= 1 mode) (if (setq ent (LM:quickfield:selectifhasprop "Textstring" nentsel)) (progn (setq obj (vlax-ename->vla-object ent)) (vla-put-textstring obj "") ;; To clear any existing field (vla-put-textstring obj str) (if (= "ATTRIB" (cdr (assoc 0 (entget ent)))) (vl-cmdf "_.updatefield" ent "") ) ) ) ) quickfield_test3.mp4 QuickFieldV1-3.lsp Edited July 20, 2023 by fuccaro adding CODE tags Quote
BIGAL Posted July 21, 2023 Posted July 21, 2023 (edited) Using nentsel is different to entsel, you should read lisp help. Nentsel allows selection of a object that is inside a bigger object like in this case a leader. So a quick test. picking the text reveals (0 . "MTEXT") picking the arrow reveals (0 . "LEADER") So must pick the text when asked. Edited July 21, 2023 by BIGAL Quote
izzimayaa Posted July 21, 2023 Author Posted July 21, 2023 So does it mean that the original lisp should have worked with MLeader? I picked the text when asked, but it turns ####. It only works properly with MText. So which part should I modify in case I want to update text within MLeader? Quote
Lee Mac Posted July 21, 2023 Posted July 21, 2023 (edited) Change: (if (setq ent (LM:quickfield:selectifhasprop "Textstring" nentsel)) To: (if (setq ent (LM:quickfield:selectifhasprop "Textstring" entsel)) And it should work with MLeaders; however, following this change, you'll no longer be able to select block attributes (which was the reason I coded it in this way originally). If I were to rewrite the program, I would of course accommodate all object types. Edited July 21, 2023 by Lee Mac Quote
izzimayaa Posted July 24, 2023 Author Posted July 24, 2023 Quote On 7/21/2023 at 6:55 PM, Lee Mac said: Change: (if (setq ent (LM:quickfield:selectifhasprop "Textstring" nentsel)) To: (if (setq ent (LM:quickfield:selectifhasprop "Textstring" entsel)) And it should work with MLeaders; however, following this change, you'll no longer be able to select block attributes (which was the reason I coded it in this way originally). If I were to rewrite the program, I would of course accommodate all object types. I am using it to create field of block attribute, so it seems to lose its purpose this way. Thank you. 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.