.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

center of block

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
sanjaymann
572 Views, 4 Replies

center of block

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

4 REPLIES 4
Message 2 of 5
swaywood
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
Message 3 of 5
sanjaymann
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?

Message 4 of 5
_gile
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
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 5 of 5
sanjaymann
in reply to: _gile

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

 

Thanks a Ton.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost