Author Topic: Get center of block reference without its attributes?  (Read 1886 times)

0 Members and 1 Guest are viewing this topic.

JohanMagnusson

  • Guest
Get center of block reference without its attributes?
« on: May 08, 2010, 08:02:29 AM »
Im trying to figure this out, appreciate if someone could give me some tips on solving this one.

Is there any method to get the center point of a blockreference without itīs attributes?

If i do like this...

Code: [Select]
        public static Point3d CenterPoint3D(Entity entity)
        {
            Extents3d ext = entity.GeometricExtents;                                //get entity boundary

            Point3d center = new Point3d((ext.MinPoint.X + ext.MaxPoint.X) * 0.5,   //calculate center point
                                         (ext.MinPoint.Y + ext.MaxPoint.Y) * 0.5,
                                         (ext.MinPoint.Z + ext.MaxPoint.Z) * 0.5);

            return center;                                                          //return with center point
        }

i get the centerpoint but with itīs attributes.

I only want the "graphical" objects centerpoint, since itīs attributes can be placed in different locations.
Do i need to open the block definition and calculate the center point of it without it attributes or is there an easier way?

Any suggestions on how to do this in an as easy and correct way as possible?


It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8704
  • AKA Daniel
Re: Get center of block reference without its attributes?
« Reply #1 on: May 08, 2010, 08:58:57 AM »
I might try creating a new temporary Blockreference off the definition,  use transformby to line things up, then get the extents of the new reference