center of block

center of block

Anonymous
Not applicable
896 Views
4 Replies
Message 1 of 5

center of block

Anonymous
Not applicable

Hi, Help needed in finding the center of a selected block. Thanks & Regards Sanjay Pandey

0 Likes
Accepted solutions (1)
897 Views
4 Replies
Replies (4)
Message 2 of 5

swaywood
Collaborator
Collaborator
hi sanjaymann:
you can use the blockreference's geometricextents.maxpoint & minpoint to get the two corner point, then calculate the center point
inbref.GeometricExtents.MaxPoint
0 Likes
Message 3 of 5

Anonymous
Not applicable

Tried using that but its not falling in the center.

 

Dim centerX As Double = br.GeometricExtents.MaxPoint.X + br.GeometricExtents.MinPoint.X / 2
Dim centerY As Double = br.GeometricExtents.MaxPoint.Y + br.GeometricExtents.MinPoint.Y / 2

 

Did i do something wrong?

0 Likes
Message 4 of 5

_gile
Consultant
Consultant
Accepted solution

Dim centerX As Double = (br.GeometricExtents.MaxPoint.X + br.GeometricExtents.MinPoint.X) / 2
Dim centerY As Double = (br.GeometricExtents.MaxPoint.Y + br.GeometricExtents.MinPoint.Y) / 2



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 5 of 5

Anonymous
Not applicable

OOPs my bad. Didn't put brackets before dividing by Zero.

 

Thanks a Ton.

0 Likes