Jump to content

Recommended Posts

Posted (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 "")
                        )
                    )
                )
            )

QuickFieldV1-3.lsp

Edited by fuccaro
adding CODE tags
Posted (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 by BIGAL
Posted

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?

Posted (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 by Lee Mac
Posted
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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...