Error

Get the lenght o one segment on AnnProtract

#1 Posted : Monday, September 10, 2007 1:12:07 AM(UTC)

Groups: Registered
Posts: 51

Hi,
need to known, how is possible to get the side's lenght of an AnnProtractorObject, specially from centerpoint to secondpoint.
I see that I can read the lenght of the protractor on screen, but I can't found any properties of function that I can use to get it programmatically, how I can do that.

#2 Posted : Monday, September 10, 2007 9:38:43 AM(UTC)

Posts: 764

There isn't any property of the AnnProtractorObject (even the AnnLine object doesn't) that tells you the length of either of the lines.  You will have to calculate this from the points.  Just use the Pythagorean Theorem and then convert that value from whatever unit it's in (most likely pixels) to the unit you want (inches, cm, etc.).

#3 Posted : Monday, September 10, 2007 9:42:06 AM(UTC)

BoydP

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

AnnProtractorObject exposes its three points as AnnPoints through the properties CenterPoint, FirstPoint and SecondPoint.  You can get the x and y coordinates of them and use the basic distance formula to determine the length of each side.  The following code determines the length of the side from the CenterPoint to SecondPoint.

Dim pt1 as AnnPoint = annProtractorObj.CenterPoint
Dim pt2 as AnnPoint = annProtractorObj.SecondPoint

Dim distance As Double = Math.Sqrt(Math.Pow(pt1.X - pt2.X, 2) + Math.Pow(pt1.Y - pt2.Y, 2))

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.