×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Intersects with coordinates

Intersects with coordinates

Intersects with coordinates

(OP)
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?

RE: Intersects with coordinates

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

RE: Intersects with coordinates

(OP)
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?

RE: Intersects with coordinates

Maybe, do you get an error and what does it say if you do?

"Everybody is ignorant, only on different subjects." — Will Rogers

RE: Intersects with coordinates

(OP)
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?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources