Intersect Example

AEC Auto

Intersect Example

Sub Example_Intersect ()

' This example will add make two profiles from rings, and intersect the first with the second

    On Error Resume Next
    Dim pointList1(0 To 9) As Double
    Dim pointList2(0 To 7) As Double
    pointList1(0) = 0: pointList1(1) = 0
    pointList1(2) = 1: pointList1(3) = 0
    pointList1(4) = 1: pointList1(5) = 1
    pointList1(6) = 0: pointList1(7) = 1
    pointList1(8) = 0: pointList1(9) = 0

    pointList2(0) = 0.5: pointList2(1) = 0.5
    pointList2(2) = 0.067: pointList2(3) = -0.25
    pointList2(4) = 0.933: pointList2(5) = -0.25
    pointList2(6) = 0.5: pointList2(7) = 0.5

    Dim ring1 As AecRing
    Dim ring2 As AecRing
    Dim profile1 As New AecProfile
    Dim profile2 As New AecProfile

    Dim doc As AecArchBaseDocument
    Set doc = AecArchBaseApplication.ActiveDocument
    Dim cprofiles As AecProfileStyles
    Dim profileStyle As AecProfileStyle
    
    Set cprofiles = doc.ProfileStyles
    Set profileStyle = cprofiles.Item("IntersectRing")
    If profileStyle Is Nothing Then
        Set profileStyle = cprofiles.Add("IntersectRing")
    End If
    Set ring1 = profile1.Rings.Add
    Set ring2 = profile2.Rings.Add

    ring1.FromPoints (pointList1)
    ring2.FromPoints (pointList2)

    profile1.Intersect profile2

    Set profileStyle.profile = profile1
    
End Sub