实现ZOOM命令的Extents选项的几种方法

AutoCAD.Internal.Utils.ZoomAuto(1, 1, 1, 1, 1) '这个就是z e


Imports ZwSoft.ZwCAD.Runtime

Imports ZwSoft.ZwCAD.Geometry
Imports ZwSoft.ZwCAD.ApplicationServices
Imports ZwSoft.ZwCAD.DatabaseServices
Imports ZwSoft.ZwCAD.GraphicsSystem
Imports ZwSoft.ZwCAD.EditorInput


Public Class ZwApps


    _
    Public Sub ZoomExtentTest01()
        Dim ZcDoc As Document = Application.DocumentManager.MdiActiveDocument
        Dim ZcDb As Database = ZcDoc.Database
        Dim ZcEd As Editor = ZcDoc.Editor


        ZcDb.UpdateExt(True)
        Dim minPoint As Point3d = ZcDb.Extmin
        Dim maxPoint As Point3d = ZcDb.Extmax
        Dim min2d As New Point2d(minPoint.X, minPoint.Y)
        Dim max2d As New Point2d(maxPoint.X, maxPoint.Y)


        Dim NewView As ViewTableRecord = New ViewTableRecord()
        NewView.CenterPoint = min2d + ((max2d - min2d) / 2.0)
        NewView.Height = max2d.Y - min2d.Y
        NewView.Width = max2d.X - min2d.X
        ZcEd.SetCurrentView(NewView)


    End Sub
    _
    Public Sub ZoomExtentTest02()


        Dim ZwApp As Object = Application.ZcadApplication
        ZwApp.ZoomExtents()


    End Sub


    _
    Public Sub ZoomExtentTest03()


        Dim ZcDoc As Document = Application.DocumentManager.MdiActiveDocument
        ZcDoc.SendStringToExecute("_.ZOOM _E ", True, False, False)


    End Sub


    _
    Public Sub ZoomExtentTest04()


        Dim ZwApp As Object = Application.ZcadApplication
        ZwApp.ActiveDocument.SendCommand("_.ZOOM _E ")


    End Sub

End Class

上面四个命令:ZoomExtentTest01,ZoomExtentTest02,ZoomExtentTest03,ZoomExtentTest04分别定义了四种实现ZoomExtents方法。


你可能感兴趣的:(ZWCAD,.NET,API开发,ZoomExtents,.net,cad,api,缩放)