Zoom methods examples

Private Sub ZoomMethodExamples()
' This example creates a line and adds it to the drawing using the AddLine
' method. It then calls the different zoom methods.
     Dim scalefactor As Double
     Dim scaletype As AcZoomScaleType
     Dim PtStart(0 To 2) As Double
     Dim PtEnd(0 To 2) As Double
     PtStart(0) = 0: PtStart(1) = 0: PtStart(1) = 0
     PtEnd(0) = 4: PtEnd(1) = 3: PtEnd(2) = 0
     Call ThisDrawing.ModelSpace.AddLine(PtStart, PtEnd)
     PtStart(0) = 40: PtStart(1) = 30: PtStart(2) = 0
     PtEnd(0) = 44: PtEnd(1) = 33: PtEnd(2) = 0
     Call ThisDrawing.ModelSpace.AddLine(PtStart, PtEnd)
' ZoomAll
    MsgBox "Perform a ZoomAll", , "Zoom Method Examples"
    ZoomAll
' ZoomCenter
    MsgBox "Perform a ZoomCenter using:" & vbCrLf & _
           "Center 22, 16.5, 0" & vbCrLf & _
           "Magnification: 10", , "Zoom Method Examples"
    Dim PtCenter(0 To 2) As Double
    Dim magnification As Double
    PtCenter(0) = 22: PtCenter(1) = 16.5: PtCenter(2) = 0
    magnification = 10
    ZoomCenter PtCenter, magnification
    
' ZoomExtents
    MsgBox "Perform a ZoomExtents", , "Zoom Method Examples"
    ZoomExtents
    
' ZoomScaled
    MsgBox "Perform a ZoomScaled using:" & vbCrLf & _
           "Scale Type: acZoomScaledRelative" & vbCrLf & _
           "Scale Factor: 6", , "Zoom Method Examples"
    scalefactor = 6
    scaletype = acZoomScaledRelative
    ZoomScaled scalefactor, scaletype
    
' ZoomWindow
    MsgBox "Perform a ZoomWindow using the following coordinates:" & vbCrLf & _
           "-10,-10,0" & vbCrLf & _
           "50,40,0", , "Zoom Method Examples"
    Dim Pt1(0 To 2) As Double
    Dim Pt2(0 To 2) As Double
    Pt1(0) = -10: Pt1(1) = -10: Pt1(2) = 0
    Pt2(0) = 50: Pt2(1) = 40: Pt2(2) = 0
    ZoomWindow Pt1, Pt2
    
' ZoomScaled
    MsgBox "Perform a ZoomScaled using:" & vbCrLf & _
           "Scale Type: acZoomScaledRelative" & vbCrLf & _
           "Scale Factor: 5", , "Zoom Method Examples"
    scalefactor = 5
    scaletype = acZoomScaledRelative
    ZoomScaled scalefactor, scaletype
    
' ZoomPickWindow
    MsgBox "Perform a ZoomPickWindow", , "Zoom Method Examples"
    ZoomPickWindow
End Sub

© Bricsys NV. All rights reserved.