如果需要在绘图窗口中增大或减小图像的放大倍率,请更改当前视图的 和 属性。调整视图大小时,请确保按相同的系数更改 和 属性。调整当前视图大小时计算的比例因子通常基于以下情况之一:WidthHeightWidthHeight
使用指定的比例放大活动图形此示例代码演示如何使用“操作当前视图”主题中定义的缩放过程将当前视图减少 50%。 虽然缩放过程总共传递了四个值,但前两个是未使用的新 3D 点。传递的第三个值是用于调整视图大小的中心点,传递的最后一个值是用于调整视图大小的比例因子。 VB.NET<CommandMethod("ZoomScale")> _ Public Sub ZoomScale() '' Get the current document Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument '' Get the current view Using acView As ViewTableRecord = acDoc.Editor.GetCurrentView() '' Get the center of the current view Dim pCenter As Point3d = New Point3d(acView.CenterPoint.X, _ acView.CenterPoint.Y, 0) '' Set the scale factor to use Dim dScale As Double = 0.5 '' Scale the view using the center of the current view Zoom(New Point3d(), New Point3d(), pCenter, 1 / dScale) End Using End Sub C#[CommandMethod("ZoomScale")] static public void ZoomScale() { // Get the current document Document acDoc = Application.DocumentManager.MdiActiveDocument; // Get the current view using (ViewTableRecord acView = acDoc.Editor.GetCurrentView()) { // Get the center of the current view Point3d pCenter = new Point3d(acView.CenterPoint.X, acView.CenterPoint.Y, 0); // Set the scale factor to use double dScale = 0.5; // Scale the view using the center of the current view Zoom(new Point3d(), new Point3d(), pCenter, 1 / dScale); } } VBA/ActiveX 代码参考Sub ZoomScale() Dim scalefactor As Double Dim scaletype As Integer scalefactor = 0.5 scaletype = acZoomScaledRelative ThisDrawing.Application.ZoomScaled scalefactor, scaletype End Sub 父主题: |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-7 19:45
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.