Subtract Example

AEC Auto

Subtract Example

Sub Example_Subtract ()
  
' This example adds two profiles from rings, and subtracts the second from the first

    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("SubtractRing")
    If profileStyle Is Nothing Then
        Set profileStyle = cprofiles.Add("SubtractRing")
    End If
    Set ring1 = profile1.Rings.Add
    Set ring2 = profile2.Rings.Add

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

    profile1.Subtract profile2

    Set profileStyle.profile = profile1
    
End Sub