Jump to content

EDIT ANONYMOUS BLOCK


Trai

Recommended Posts

HI THERE, 

recently, I have an issue about block in my drawing. I have a file have many "anonymous block" . So I want to edit them without go to block editor then explode them. I only edit them when I explode them. Someone can help me a lips to fix that

Thank you for your time to help me !.

This is an example file 

T8_A3.dwg

Link to comment
Share on other sites

This seems to do the trick. I would use with caution.

 

(defun c:ub ()
  (vlax-for bl (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
    (setq nam (vla-get-name bl))
    (if (= "*U" (substr nam 1 2))
      (progn
        (setq nam2 (substr nam 2))
        (vla-put-name bl nam2)
        (princ (strcat "\n" nam " ---> " nam2))
      )
    )
  )
  (princ)
)

 

  • Like 1
Link to comment
Share on other sites

On 6/30/2022 at 2:17 AM, mhupp said:

This seems to do the trick. I would use with caution.

UnAnon.Lsp assigns block names after checking to make sure the names aren't already in use, no caution needed. They can be renamed afterwards.

Before Vehicle Tracking we used to use AutoTurn for vehicle paths and it made each of them an anonymous block, used UnAnon.Lsp for many years to fix them and hatches from many many earlier before they were improved which was probably what the lisp was created for in 1998. Might be the oldest routine I still use today, I've seen newer simular code but why fix something that's worked for me for so long?

  • Like 1
Link to comment
Share on other sites

12 minutes ago, tombu said:

UnAnon.Lsp assigns block names after checking to make sure the names aren't already in use, no caution needed.

 

I was saying that more for the fact they are anonymous blocks for a reason and/or could mess something when they aren't anymore.

And it does the whole drawing. rather than process the ones you select.

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
On 6/30/2022 at 9:17 AM, mhupp said:

This seems to do the trick. I would use with caution.

 

(defun c:ub ()
  (vlax-for bl (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
    (setq nam (vla-get-name bl))
    (if (= "*U" (substr nam 1 2))
      (progn
        (setq nam2 (substr nam 2))
        (vla-put-name bl nam2)
        (princ (strcat "\n" nam " ---> " nam2))
      )
    )
  )
  (princ)
)

 

Hi, 

how to make this lisp work only on selected blocks.

Link to comment
Share on other sites

On 6/4/2024 at 8:54 AM, Saqib said:

Hi, 

how to make this lisp work only on selected blocks.

What are you trying to do?

 

The UnAnon.lsp linked in 2nd post is selection unless you use UnanonAll option AFAIK.

 

 

Link to comment
Share on other sites

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...