VBA中的列表视图坐标
你好我需要一个当前项目从VBA(从独立应用程序通过ActiveX automation访问AutoCAD)列出图形“扩展”区域(即它在模型空间中的整个绘图区域)的坐标。由于图形负载非常大,因此解析实体以收集坐标并对其进行排序并不是一个解决方案,因为它持续时间太长。
因此,我的解决方案是进行缩放/扩展,根据其中心坐标和大小创建视图和列表;由此可以计算视图左下角和右上角的坐标,从而得出绘制区域(当然,在一个方向上不一定精确)。不幸的是,作为视图功能列出的值似乎与屏幕上手动列出的值不匹配。
Dim theAcadApp, CrDrawing As Object
Set theAcadApp = CreateObject("AutoCAD.Application")
Set CrDrawing = theAcadApp.Documents.Open("...ARandomFile...")
theAcadApp.ZoomExtents
Dim theExtendView As Object
Dim theCenter As Variant
Dim theCornerBL(1) As Double
Dim ViewWidth, ViewHeight As Double
Set theExtendView = CrDrawing.Views.Add("NewView01")
theCenter = theExtendView.Center
ViewWidth = theExtendView.Width
ViewHeight = theExtendView.Height
theCornerBL(0) = theCenter(0) - 0.5 * ViewWidth
theCornerBL(1) = theCenter(1) - 0.5 * ViewHeight
有人知道我做错了什么吗?或者有另一个更好的解决方案来解决我的问题?
非常感谢。
当做
米尔恰
页:
[1]