Author Topic: entnext with attributed Block  (Read 3589 times)

0 Members and 1 Guest are viewing this topic.

Coder

  • Swamp Rat
  • Posts: 827
entnext with attributed Block
« on: November 22, 2012, 07:43:37 AM »
Hello guys .  :-)

I just wanted to know , when we use functions entnext with while n to step into attributed block , it considers only attributes only . is
this normal ?

Thanks you all .

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: entnext with attributed Block
« Reply #1 on: November 22, 2012, 08:21:27 AM »
Attribute references (ATTRIBs) are considered separate from the block definition (BLOCK) referenced by an inserted block reference (INSERT), this enables the attribute references to hold differing values between multiple block references of the same name.

The attribute definitions (ATTDEFs) found within the block definition simply instruct AutoCAD to generate the attribute references with a given tag, at a specific position relative to the block reference geometry when the block is inserted; however, additional attributes may also be added to the block reference programmatically, independent of the block definition following insertion of the block reference in the drawing.

As a result, when an attributed block reference is inserted, the block reference entity (INSERT) is added to the drawing database, followed by any attribute references (ATTRIBs) associated with the block reference, terminated by a sequence ending (SEQEND) entity.

The AutoLISP entnext function simply steps through all the non-deleted entities found within the drawing database in the order they were added to the database. If called with no arguments, entnext will return the first non-deleted entity in the database; if called with an entity name argument, entnext will return the first non-deleted entity following the supplied entity in the drawing database.

Now, amalgamating all of the above information: given that attribute reference entities are added to the drawing database after the block reference entity when an attribute block is inserted, calling entnext with the entity name of an attributed block reference will return the next non-deleted entity added to the drawing database - i.e. the attribute references (ATTRIBs), and repeated calls to entnext supplying each returned entity will finally result in the sequence ending (SEQEND) entity being returned.

Note that if you were to supply entnext with a non-attributed block reference entity name, entnext would simply return the next entity added to the drawing database, be it a Line, Circle etc. Similarly, if you called entnext with the SEQEND entity, entnext would just return the next non-deleted entity in the database, which could be any object created following insertion of the attributed block.

I hope this explanation is clear and accurate, however feel free to ask for clarification or correct any mistakes in the above information.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: entnext with attributed Block
« Reply #2 on: November 22, 2012, 09:08:37 AM »
Great explanation Lee.   8-)

Some code to look at:
http://www.theswamp.org/index.php?topic=1173.0
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: entnext with attributed Block
« Reply #3 on: November 22, 2012, 09:53:29 AM »
Thanks Alan  :-)

Coder

  • Swamp Rat
  • Posts: 827
Re: entnext with attributed Block
« Reply #4 on: November 23, 2012, 03:14:49 AM »
Thank you so much Lee for that informative and great details .

I am really very thankful  :-)


Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: entnext with attributed Block
« Reply #5 on: November 23, 2012, 07:23:18 AM »
You're very welcome coder, I'm glad it helps  :-)