Mirror Example [ActiveX and VBA Reference: AAR]

AEC Auto

Mirror Example

Sub Example_Mirror()
    ' This example creates a light weight polyline
    ' and then mirrors that polyline.
    
    ' Create the polyline
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 11) As Double
    points(0) = 1: points(1) = 1
    points(2) = 1: points(3) = 2
    points(4) = 2: points(5) = 2
    points(6) = 3: points(7) = 2
    points(8) = 4: points(9) = 4
    points(10) = 4: points(11) = 1
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True
    ZoomAll
    
    ' Define the mirror axis
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    point1(0) = 0: point1(1) = 4.25: point1(2) = 0
    point2(0) = 4: point2(1) = 4.25: point2(2) = 0
        
    MsgBox "Mirror the polyline.", , "Mirror Example"
    
    ' Mirror the polyline
    Dim mirrorObj As AcadLWPolyline
    Set mirrorObj = plineObj.Mirror(point1, point2)
    mirrorObj.Color = acRed
    
    ZoomAll
    MsgBox "Mirror completed.", , "Mirror Example"
    
End Sub