IntersectWith Problems

#1
I'm trying to write a routine that determines which lines from a couple of selection sets intersect and where they intersect. Things work ok if there is always an intersection, but I get an error

Run-Time Error '-2147467259(80004005)'
method 'IntersectWith' of object 'IIcadLine' failed

If there are lines that don't intersect.

I am a bit new to VBA, so I'm at a loss for whether I'm missing something here about how IntersectWith is supposed to work, or IntersectWith has a problem or I've got a problem somewhere else that I haven't found yet.

I'd hate to have to check things using the start and endpoints manually myself - it seems like IntersectWith ought to return with a Null if they don't intersect.

I am using ver 5.1PE

The chunk of code which pukes is:

For i_1 = 1 To (num_elem - 1)
num_intersect = 0

For i_2 = 1 To objMassSS.Count

If (objMassSS(i_2).StartPoint.x <> objMassSS(i_2).EndPoint.x) Then

If Not IsNull(objElemSS(elem_indx(i_1)).IntersectWith(objMassSS(i_2), vicExtendNone)) Then
Set Elem_Mass_I1 = objElemSS(elem_indx(i_1)).IntersectWith(objMassSS(i_2), vicExtendNone)

It dies at the "If Not isNull..." if some of the lines don't intersect

Any thoughts?

Thanks,
Erik

#2
I get the same error you do. For now you could trap the error and go from there. AutoCAD returns and empty array when nothing intersects.

ssc

#3
Thanks for the follow-up.

I ended-up doing some pre-processing to make sure I had the lines I wanted, then using vicExtendBoth. This also solved another issue with what I needed to accomplish as well.

Erik