Message 1 of 3
Not applicable
11-26-2014
09:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone, having trouble when using InsersectWith on a polyline to check if a line definited by 2 points would intersect with it. Currently I am geting an "eInvalidInput" error whenever the IntersectWith method is called. Any help would be greatly appreciated. Code below:
Public Function checkIntersect(ByVal pt1 As Point3d, ByVal pt2 As Point3d) As Boolean
Dim line As Line = New Line(pt1, pt2)
Dim plane As New Plane(Point3d.Origin, ed.CurrentUserCoordinateSystem.CoordinateSystem3d.Zaxis)
Dim pts As Point3dCollection = New Point3dCollection
Dim filterList(3) As TypedValue
filterList.SetValue(New TypedValue(DxfCode.Operator, "<and"), 0)
filterList.SetValue(New TypedValue(DxfCode.Start, "LWPOLYLINE"), 1)
filterList.SetValue(New TypedValue(DxfCode.LayerName, areaLayersArray(i)), 2)
filterList.SetValue(New TypedValue(DxfCode.Operator, "and>"), 3)
Dim filter As New SelectionFilter(filterList)
Dim res As PromptSelectionResult = ed.SelectAll(filter)
If res.Status = PromptStatus.OK Then
Dim oset As SelectionSet = res.Value
Dim objIDs() As ObjectId = oset.GetObjectIds
Using tr As Transaction = db.TransactionManager.StartTransaction()
For Each acObjId As ObjectId In objIDs
Dim polyLine As Polyline = CType(tr.GetObject(acObjId, OpenMode.ForRead), Polyline)
Dim entity As Entity = CType(line, Entity)
polyLine.IntersectWith(entity, Intersect.ExtendBoth, pts, IntPtr.Zero, IntPtr.Zero)
Next
tr.Commit()
End Using
End If
If pts.Count = 0 Then
Return False
Else
Return True
End If
End Function
Solved! Go to Solution.