Problems using IntersectWith method iCAD 7.2

The VBA forum deals with IntelliCAD 2000 VBA (Visual Basic for Applications) issues.

Moderator: CMS Inc

Post Reply
Accuright
Valued Contributor
Posts: 47
Joined: Thu Jul 26, 2012 2:19 pm

Problems using IntersectWith method iCAD 7.2

Post by Accuright » Tue Apr 16, 2013 10:02 am

The following code is within a blank userform with the command button placed on it. The code is taken straight from progeCAD help. Running it results in an "out of memory" error.

Code: Select all

Private Sub CommandButton4_Click()
    Dim myLine1 As IntelliCAD.Line
    Dim myLine2 As IntelliCAD.Line

    Set myLine1 = ThisWorkspace.ActiveDocument.ModelSpace.AddLine(Library.CreatePoint(4, 4), Library.CreatePoint(7, 1))
    myLine1.Update

    Set myLine2 = ThisWorkspace.ActiveDocument.ModelSpace.AddLine(Library.CreatePoint(5, 2), Library.CreatePoint(8, 4))
    myLine2.Update

    ' Find the intersection point.
    Dim intPoints As points
    Set intPoints = myLine1.IntersectWith(myLine2, vicExtendNone)
    ' Above line creates "out of memory" error.
    msgbox "Intersection point: " & Chr(13) & Chr(13) & "x = " & intPoints.Item(1).X & Chr(13) & "y = " & intPoints.Item(1).Y & Chr(13) & "z = " & intPoints.Item(1).Z
End Sub

I tested the above code after writing this out (in the same isolated userform). The below code results in an "Object does not support this action" error, when selecting two circles that intersect each other. When using it on the lines that the above code draws in modelspace, it results in the same "out of memory" error.

Code: Select all

Dim shape1 As IntelliCAD.Entity
Dim shape2 As IntelliCAD.Entity
Dim pickpt As IntelliCAD.POINT
Dim intPoints As points

Private Sub CommandButton1_Click()
    Me.Hide
    ThisWorkspace.ActiveDocument.Utility.GetEntity shape1, pickpt, "Choose 1st shape"
    Me.Show
End Sub

Private Sub CommandButton2_Click()
    Me.Hide
    ThisWorkspace.ActiveDocument.Utility.GetEntity shape2, pickpt, "Choose 2nd shape"
    Me.Show
End Sub

Private Sub CommandButton3_Click()
    
    msgbox "SHAPE 1 | " & "Name: " & shape1.EntityName & " | Type: " & shape1.EntityType
    msgbox "SHAPE 2 | " & "Name: " & shape2.EntityName & " | Type: " & shape2.EntityType
    
    Set intPoints = shape1.IntersectWith(shape2, vicExtendNone)

End Sub
Last edited by Accuright on Tue Apr 16, 2013 11:21 am, edited 1 time in total.
Accuright
Valued Contributor
Posts: 47
Joined: Thu Jul 26, 2012 2:19 pm

SOLUTION

Post by Accuright » Tue Apr 16, 2013 11:20 am

Upgrading to the NEWEST build v7.2.4141 03/07/2013 release resolved this issue. Will post as to other issues resolved by intsalling this build.

HOWEVER, still working on making this method work with two intersecting circles (math: a circle can not intersect a circle with same radius in only one place. There must be two intersecting points).
Post Reply