.NET

Reply
Valued Contributor
sanjaymann
Posts: 97
Registered: ‎05-22-2013
Message 1 of 5 (150 Views)
Accepted Solution

center of block

150 Views, 4 Replies
03-19-2014 02:45 AM

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

Valued Contributor
swaywood
Posts: 91
Registered: ‎08-22-2013
Message 2 of 5 (145 Views)

Re: center of block

03-19-2014 02:53 AM in reply to: sanjaymann
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
Valued Contributor
sanjaymann
Posts: 97
Registered: ‎05-22-2013
Message 3 of 5 (138 Views)

Re: center of block

03-19-2014 03:40 AM in reply to: swaywood

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?

*Expert Elite*
_gile
Posts: 2,082
Registered: ‎04-29-2006
Message 4 of 5 (135 Views)

Re: center of block

03-19-2014 03:42 AM in reply to: sanjaymann

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
Valued Contributor
sanjaymann
Posts: 97
Registered: ‎05-22-2013
Message 5 of 5 (130 Views)

Re: center of block

03-19-2014 03:47 AM in reply to: _gile

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

 

Thanks a Ton.

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.