Page 1 of 1

Error with 'IntersectWith' method

Posted: Wed Dec 24, 2008 8:58 am
by PeteWhite
I'm writing an application where I need to find the intersection point between a vertical (Z Axis) line and 3D Face.

I have the following self-contained test code which is producing an error when run...

Code: Select all

Public Sub TestIntersectWith()

    Dim IcadDoc As IntelliCAD.Document
    Set IcadDoc = ActiveDocument
    
    Dim my3DFace As IntelliCAD.Face3D
    Dim p1, p2, p3 As Point
    
    Dim myLine As IntelliCAD.Line
    Dim spoint, epoint As Point
    
    Set p1 = Library.CreatePoint(10, 9, 2)
    Set p2 = Library.CreatePoint(20, 20, 5)
    Set p3 = Library.CreatePoint(25, 8, 3)
    
    Set spoint = Library.CreatePoint(19, 13, 0)
    Set epoint = Library.CreatePoint(19, 13, 7)
    
    Set my3DFace = IcadDoc.ModelSpace.Add3DFace(p1, p2, p3, p3)  '<--- if I don't include the optional point 4, the
    my3DFace.Update                                              '     4th corner is drawn at 0,0 (A bug?)
    
    Set myLine = IcadDoc.ModelSpace.AddLine(spoint, epoint)
    myLine.Update

    Dim IntPoint As Points
    Set IntPoint = myLine.IntersectWith(my3DFace, vicExtendNone) '<--- This is where I get the error!!!

End Sub

The Line and 3DFace are drawn ok on screen and it's clear that the intersect, but I get the following error...

Code: Select all

Run-time error '-2147467259 (80004005)':
Method 'IntersectWith' of object 'IIcadline' failed

Anyone got any ideas? is this a bug?

Pete

Posted: Mon Dec 29, 2008 9:48 am
by JCAMPOS
Hello PeteWhite,

The intersectWith method works on coplanar entities. The test code you provided will not work unless you make the vertical line to be coplanar to one of the 3DFace segments.

Regards,
JCAMPOS