Author Topic: Block name entity Anonymous?  (Read 5057 times)

0 Members and 1 Guest are viewing this topic.

dubb

  • Swamp Rat
  • Posts: 1105
Block name entity Anonymous?
« on: August 27, 2018, 07:36:54 PM »
I'm not sure how to phrase this question.

When I am listing the entity properties for a certain block. using
Code: [Select]
(assoc 2 (entget(car(entsel)))) I get
Code: [Select]
(2 . "*U237") I am trying to obtain the block name. But I think this is the anonymous name?

How do always get the block name. I am writing a script to give me a list of block names for an entire selection set.

Crank

  • Water Moccasin
  • Posts: 1503
Re: Block name entity Anonymous?
« Reply #1 on: August 28, 2018, 02:15:36 AM »
If it's a real anonymous block, then "*U237" is the block name.

If it's a dynamic or parametric block then you need the effective name.
Vault Professional 2023     +     AEC Collection

tombu

  • Bull Frog
  • Posts: 289
  • ByLayer=>Not0
Re: Block name entity Anonymous?
« Reply #2 on: August 28, 2018, 07:23:08 AM »
I use UnAnon.Lsp by David Bethel for renaming an anonymous block.  It's on his free lisp page: http://www.davidbethel.com/lisp/
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

dubb

  • Swamp Rat
  • Posts: 1105
Re: Block name entity Anonymous?
« Reply #3 on: August 28, 2018, 03:48:57 PM »
Thanks, I wonder why they make it more complicated.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Block name entity Anonymous?
« Reply #4 on: August 29, 2018, 09:59:01 AM »
Thanks, I wonder why they make it more complicated.

Because it needs to be.  If the block name wasn't unique, then changing one dynamic property would chance the properties of *all* instances of that block.  While that may be desirable in some circumstances it would really neuter features like having one block definition with multiple visibility states.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

dubb

  • Swamp Rat
  • Posts: 1105
Re: Block name entity Anonymous?
« Reply #5 on: August 29, 2018, 11:35:16 AM »
aH..That makes sense.

Thanks, I wonder why they make it more complicated.

Because it needs to be.  If the block name wasn't unique, then changing one dynamic property would chance the properties of *all* instances of that block.  While that may be desirable in some circumstances it would really neuter features like having one block definition with multiple visibility states.

dubb

  • Swamp Rat
  • Posts: 1105
Re: Block name entity Anonymous?
« Reply #6 on: August 29, 2018, 11:41:06 AM »
Thanks to your explanation, I found out if I resetted all of my dynamic blocks, then generated a list of blocks, I didn't get anonymous block names.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Block name entity Anonymous?
« Reply #7 on: August 29, 2018, 12:33:39 PM »
Thanks to your explanation, I found out if I resetted all of my dynamic blocks, then generated a list of blocks, I didn't get anonymous block names.

This is not necessary - did you read the content of the link provided by Crank?

dubb

  • Swamp Rat
  • Posts: 1105
Re: Block name entity Anonymous?
« Reply #8 on: August 29, 2018, 01:09:53 PM »
I reread that, and I think I'll try implementing that method into my block listing script.

ahsattarian

  • Newt
  • Posts: 112
Re: Block name entity Anonymous?
« Reply #9 on: January 01, 2021, 08:30:58 AM »
I use UnAnon.Lsp by David Bethel for renaming an anonymous block.  It's on his free lisp page: http://www.davidbethel.com/lisp/

Would u please offer the lisp here   ????

The link doesn't work for me   !!!!

Thanks

hmspe

  • Bull Frog
  • Posts: 362
Re: Block name entity Anonymous?
« Reply #10 on: January 01, 2021, 08:53:14 AM »
@ahsattarian:

Try an interner search for "UnAnon.lsp".  The code is posted on several sites.
"Science is the belief in the ignorance of experts." - Richard Feynman

Dlanor

  • Bull Frog
  • Posts: 263
Re: Block name entity Anonymous?
« Reply #11 on: January 01, 2021, 09:30:20 AM »
Unanon.lsp will probably need updating as IIRC it has an error routine that contains command call(s). This will cause an error in AutoCAD 2015 and later.

elyosua

  • Mosquito
  • Posts: 1
Re: Block name entity Anonymous?
« Reply #12 on: March 19, 2021, 02:14:07 PM »
Yo tuve este problema y lo solucioné borrando el bloque anónimo y después insertándolo pero eligiendo el nombre verdadero del bloque.
I had this problem and I solved it by deleting the anonymous block and then inserting it but choosing the true name of the block.
« Last Edit: March 19, 2021, 02:18:55 PM by elyosua »

tombu

  • Bull Frog
  • Posts: 289
  • ByLayer=>Not0
Re: Block name entity Anonymous?
« Reply #13 on: March 19, 2021, 03:04:05 PM »
Unanon.lsp will probably need updating as IIRC it has an error routine that contains command call(s). This will cause an error in AutoCAD 2015 and later.
I believe I updated the attached version to use command-s in 2016. Don't need it often but always saved me when I needed it.

David Bethel thanks again!
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

MrSmith

  • Newt
  • Posts: 23
Re: Block name entity Anonymous?
« Reply #14 on: March 19, 2021, 06:47:21 PM »
I use this for getting the name of blocks.

Code - Auto/Visual Lisp: [Select]
  1. (defun blkName (vlaBlk)
  2.         (if (vlax-property-available-p vlaBlk 'effectivename)
  3.                 (vla-get-effectivename vlaBlk)
  4.                 (vla-get-name vlaBlk)
  5.         )
  6. )
  7.