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