using System.Reflection ZoomWindow and ZoomScale
' using System.Reflection;
Public Class Zoom
Public Shared Sub ZoomWindow(p1 As Point3d, p2 As Point3d)
Dim acad As Object = Application.AcadApplication
Dim pts As Object() = {p1.ToArray(), p2.ToArray()}
acad.[GetType]().InvokeMember("ZoomWindow", BindingFlags.DeclaredOnly Or BindingFlags.[Public] Or BindingFlags.Instance Or BindingFlags.InvokeMethod, Nothing, acad, pts)
End Sub
Public Shared Sub ZoomExtents()
Dim acad As Object = Application.AcadApplication
acad.[GetType]().InvokeMember("ZoomExtents", BindingFlags.DeclaredOnly Or BindingFlags.[Public] Or BindingFlags.Instance Or BindingFlags.InvokeMethod, Nothing, acad, Nothing)
End Sub
Public Shared Sub ZoomScaled(scale As Double, zoomScaleType As Integer)
' zoomScaleType :
' acZoomScaledAbsolute = 0
' acZoomScaledRelative = 1
' acZoomScaledRelativePSpace = 2
Dim acad As Object = Application.AcadApplication
acad.[GetType]().InvokeMember("ZoomScaled", BindingFlags.DeclaredOnly Or BindingFlags.[Public] Or BindingFlags.Instance Or BindingFlags.InvokeMethod, Nothing, acad, New Object() {scale, zoomScaleType})
End Sub
Public Shared Sub ZoomCenter(pt As Point3d, magnitude As Double)
Dim acad As Object = Application.AcadApplication
acad.[GetType]().InvokeMember("ZoomCenter", BindingFlags.DeclaredOnly Or BindingFlags.[Public] Or BindingFlags.Instance Or BindingFlags.InvokeMethod, Nothing, acad, New Object() {pt.ToArray(), magnitude})
End Sub
End Class
AutoCAD性能优化
欢迎关注微信公众账号ByCAD