Message 1 of 4
Find intersection point between line segment and workplane

Not applicable
08-31-2011
08:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have to create a hole (extrude) in a wall part in my assembly document where a stack will be installed.
To determine where, I verify if a line segment pass through the wall (XY Plane).
But I get an error with the command: IntersectWithLine
Here's my code:
Public Function IntersectionPoint(ByVal app As Inventor.Application, ByVal wp As Inventor.WorkPlane) As Inventor.Point Dim oTransGeom As Inventor.TransientGeometry = app.TransientGeometry Dim startPoint As Inventor.Point = oTransGeom.CreatePoint(Me.StartVertex.X, Me.StartVertex.Y, Me.StartVertex.Z) Dim endPoint As Inventor.Point = oTransGeom.CreatePoint(Me.EndVertex.X, Me.EndVertex.Y, Me.EndVertex.Z) Try Dim pt1 As Inventor.Point = oTransGeom.CreatePoint(startPoint.X, startPoint.Y, startPoint.Z) Dim pt2 As Inventor.Point = oTransGeom.CreatePoint(endPoint.X, endPoint.Y, endPoint.Z) Dim vector As Inventor.Vector = pt1.VectorTo(pt2) Dim lineSeg As Inventor.LineSegment = oTransGeom.CreateLineSegment(pt1, pt2) Dim pt As Inventor.Point = wp.Plane.IntersectWithLine(lineSeg) 'THIS LINE GIVE ME AN ERROR Return pt Catch ex As Exception Throw New Exception(ex.Message, ex) End Try End Function
Thanks for help.
Pascal