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

Finding intersection point of two lines

1 REPLY 1
Reply
Message 1 of 2
iwtblj
1525 Views, 1 Reply

Finding intersection point of two lines

What I'm trying to do is mirror a line and then find where it would intersect with the original if it were long enough. In VBA, I did it like this.

{code}
TempPt1 = PtArray(0, 0, bc)
TempPt3 = ArcObj.EndPoint
TempPt3(2) = bc
TempPt2 = TempPt1
TempPt2(0) = 1
Set lineobj1 = blockobj.AddLine(TempPt1, TempPt2)
lineobj1.Layer = "CL"
lineobj1.LinetypeScale = 0.125
TempPt5 = PtArray(0, 0, 0)
Set PtObj1 = blockobj.AddPoint(TempPt5)
PtObj1.Layer = "defpoints"
Set LineObj2 = lineobj1.Mirror(cpt, Polar(cpt, (RadAng + Pi) / 2, 12))
Set PtObj2 = PtObj1.Mirror(cpt, Polar(cpt, (RadAng + Pi) / 2, 12))

TempPt2 = lineobj1.IntersectWith(LineObj2, acExtendBoth)
{code}

but this doesn't work in VB.NET. VB.NET will give me a empty array fro TempPt2. Both LineObj1 and LineObj2 are ACADLines. I'm guessing, and it's just a guess, that something is going wrong with the mirroring. I say this because when I look at them in the debugger, both of them have an angle of 0 VB.NET, but not in VBA so my guess is that because both show an angle of 0, when it tries to extend them, it shows them as parallel so can't me an intersection point. That's my assumption anyway. I tried making LineObj1 and LineObj2 into Line3d, but that doesn't work either, possibly because they lines are too short to actually intersect. I tried adding a tolerance, but I wasn't able to find a good reference for what the tolerance object actually is so I was just guessing at the numbers. If someone could help me out, I would appreciate it. Edited by: iwtblj on Nov 25, 2009 8:07 PM
1 REPLY 1
Message 2 of 2
chiefbraincloud
in reply to: iwtblj

Working for Glidepath, huh.

That's my code you posted, which they bought from us 4 years ago.
Dave O.                                                                  Sig-Logos32.png

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