Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations JAE on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Intersects with coordinates

Status
Not open for further replies.

jrice174

Civil/Environmental
Joined
Nov 8, 2004
Messages
129
Location
US
I'm attempting to find the insersection of two lines and store that points X and Y in an array before putting it in a spreadsheet. I can't figure out how to get the X and Y coordinates from the Intersection point. Below is the code I'm using.

Dim FirstLine As AcadLine
Dim SecondLine As AcadLine
Dim ThirdLine As AcadLine
Dim IntersectionPt As Variant

Set FirstLine = ThisDrawing.ModelSpace.AddLine(Pt1, Pt2)
Set SecondLine = ThisDrawing.ModelSpace.AddLine(Pt3, Pt4)
IntersectionPt = FirstLine.IntersectWith(SecondLine, acExtendBoth)

What I've tried is:
X1 = IntersectionPt(0): Y1 = IntersectionPt(1)
but it doesn't work. Any suggestions?
 
Just a check, are you checking that they return an intersection or not before you assign its values?

"Everybody is ignorant, only on different subjects." — Will Rogers
 
I know they intersect. I'm looking at the lines I'm working with and can't get the code to work. Does this work with lines or just objects? It seems like I'm having trouble converting the variant data into numeric data. Could that be the problem?
 
Maybe, do you get an error and what does it say if you do?

"Everybody is ignorant, only on different subjects." — Will Rogers
 
On the last line it says Type Mismatch.

The IntersectPt is a variant and is suppose to have an X, Y and Z (I think it's suppose to have a Z) coordinates. By the way, that X1 that I'm trying to get to receive the coordinates from IntersectionPt is a Double.

Any more ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top