Get Bounds of BlockReference Autocad 2009

Get Bounds of BlockReference Autocad 2009

Anonymous
Not applicable
718 Views
1 Reply
Message 1 of 2

Get Bounds of BlockReference Autocad 2009

Anonymous
Not applicable

 

// Have a BlockReference name: acBlkRef

Extents3d acExt3d = acBlkRef.Bounds.GetValueOrDefault();
double acHeight = Math.Abs(acExt3d .MinPoint.Y - acExt3d .MaxPoint.Y);

Hi everyone, I have a code to get height of BlockReference like this.

It works fine in Autocad2014. But in Autocad2009 using VS2005, the "BlockReference class doesn't have contain 'Bounds'" Error appears.

 

 

So is there any way to get height of blockreference, thank you.

 

0 Likes
Accepted solutions (1)
719 Views
1 Reply
Reply (1)
Message 2 of 2

_gile
Consultant
Consultant
Accepted solution

Hi,

 

You can use The Entity.GeometricExtents property which return an Extents3d instance instead of a Nullable<Extents3d> and works with all versions from 2007 to 2017.

 

// Have a BlockReference name: br

Extents3d extents = br.GeometricExtents;
double height = extents.MaxPoint.Y - extents.MinPoint.Y;

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub