calculate the Length off a polyline from begin till a point
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
calculate the Length off a polyline from begin till a point

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
Vrijbuiter
Guest





Posted: Sun May 08, 2005 4:10 pm    Post subject: calculate the Length off a polyline from begin till a point Reply with quote

I want to know the length of a line from the begin till the point where
I click or where the line cross a other line.
I can get the line and i can find where the intersection points are
with VBA but I can NOT find a function that calculate the the exact
length from begin to the intersection.
Can anyone help me to find the good way.


Thanks,

Alexander
Holland

Back to top
Wyatt Earp
Guest





Posted: Sun May 08, 2005 4:10 pm    Post subject: Re: calculate the Length off a polyline from begin till a po Reply with quote

What you want is the distance between the intersection point and one of
the endpoints of the line segment.

Assuming the intersection point's coordinates are given by
ix and iy and the line segment's endpoint coordinates are given by ex
and ey the distance d would be:

d = Sqrt(((ix-ex)*(ix-ex))+((iy-ey)*(iy-ey)))

I'm not sure if Sqrt() is a valid VBA function, I typically use a C#
over the VBA API, but the math is correct.




Vrijbuiter wrote:
Quote:
I want to know the length of a line from the begin till the point
where
I click or where the line cross a other line.
I can get the line and i can find where the intersection points are
with VBA but I can NOT find a function that calculate the the exact
length from begin to the intersection.
Can anyone help me to find the good way.


Thanks,

Alexander
Holland
Back to top
Vrijbuiter
Guest





Posted: Mon May 09, 2005 12:10 am    Post subject: Re: calculate the Length off a polyline from begin till a po Reply with quote

Dear Wyatt Earp

Thanks for your answer.
The function you use call at visual basic -> CalculateSquareRoot =
Sqr(NumberArg)
But the problem is that a polyline not a strait line but a combination
of more line's and arc's is, so I hope you see my problem.

Alxander
>From Holland

Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

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




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB