Author Topic: Access all entities within a Block Reference  (Read 2147 times)

0 Members and 1 Guest are viewing this topic.

mailmaverick

  • Bull Frog
  • Posts: 495
Access all entities within a Block Reference
« on: December 08, 2014, 06:38:03 AM »
How to Access all entities within a Block Reference.

Please note that I don't want to access all entities within a Block Definition but Block Reference.



roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Access all entities within a Block Reference
« Reply #1 on: December 08, 2014, 07:46:50 AM »
A block reference does not contain entities. It is merely a reference to a block definition that contains entities. Maybe you should explain what you want to accomplish.

Lee Mac

  • Seagull
  • Posts: 12937
  • London, England
Re: Access all entities within a Block Reference
« Reply #2 on: December 08, 2014, 12:19:13 PM »
Here is a brief explanation I posted a while back which may clarify things for you.

mailmaverick

  • Bull Frog
  • Posts: 495
Re: Access all entities within a Block Reference
« Reply #3 on: December 08, 2014, 12:53:08 PM »
I want to get bounding box of some of the entities (not all) in the block reference.

Also, I do not want bounding box of the entire block.

I have found certain LISP routines on the internet to get list of entities in a block, it gives me list of original entities in the block definition. When I take bounding box of these entities, I see that the coordinates point to the original block definition and not the selected block reference. However, I need coordinates of the entities with respect to the selected block reference.

How to accomplish that ?

gile

  • Gator
  • Posts: 2522
  • Marseille, France
Re: Access all entities within a Block Reference
« Reply #4 on: December 08, 2014, 01:14:07 PM »
Hi,

You can 'vla-Explode' the block reference, 'vla-GetBoundingBox' the returned entities and 'vla-Delete' them.
« Last Edit: December 08, 2014, 01:17:12 PM by gile »
Speaking English as a French Frog

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Access all entities within a Block Reference
« Reply #5 on: December 08, 2014, 01:41:30 PM »
Like the block instance is the similar to the definition modified for instance scale and rotation, any boundary coordinates can be applied to each instance using the same transform process.  Calculate the boundary once then modify it using the properties of each needed instance.
If you are going to fly by the seat of your pants, expect friction burns.

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

mailmaverick

  • Bull Frog
  • Posts: 495
Re: Access all entities within a Block Reference
« Reply #6 on: December 08, 2014, 07:53:28 PM »
Like the block instance is the similar to the definition modified for instance scale and rotation, any boundary coordinates can be applied to each instance using the same transform process.  Calculate the boundary once then modify it using the properties of each needed instance.

Can you please post some code for this.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Access all entities within a Block Reference
« Reply #7 on: December 09, 2014, 06:00:57 AM »
It seems to me what you're after is a "translate" function to convert the internal coordinates of a block to the external coordinates of one of its references. If so here's an old thread where Lee helped me out: http://www.cadtutor.net/forum/showthread.php?57392-Transforming-Points-in-mirrored-blocks
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Lee Mac

  • Seagull
  • Posts: 12937
  • London, England
Re: Access all entities within a Block Reference
« Reply #8 on: December 09, 2014, 02:46:58 PM »
You could also refer to my LM:blockboundingbox function included in my Automatic Block Break program.