Upper Left and Lower Right Extents of a view

Upper Left and Lower Right Extents of a view

Anonymous
Not applicable
279 Views
2 Replies
Message 1 of 3

Upper Left and Lower Right Extents of a view

Anonymous
Not applicable
Is there any way using VBA to programmatically return the Upper Left and Lower Right extents of a view, or programmatically set these two values?
0 Likes
280 Views
2 Replies
Replies (2)
Message 2 of 3

alberto_manero_geograma
Enthusiast
Enthusiast
Time ago I had the same question, then I made this code.

I really do not remember it's accuracy, but I hope you can start with it.

Dim Viusize As Long
Dim ViuCenter As Variant
Dim Scren As Variant
Dim minX2, minY2, maxX2, maxY2 As Double

Viusize = ThisDrawing.GetVariable("VIEWSIZE")
ViuCenter = ThisDrawing.GetVariable("VIEWCTR")
Scren = ThisDrawing.GetVariable("SCREENSIZE")

minY2 = ViuCenter(1) - Viusize / 2
maxY2 = ViuCenter(1) + Viusize / 2
Viusize = Viusize * Scren(0) / Scren(1)
minX2 = ViuCenter(0) - Viusize / 2
maxX2 = ViuCenter(0) + Viusize / 2

For seting those two values you can make a "ZoomWindow" with your desired values.
Luis Alberto Manero, Geograma.com
0 Likes
Message 3 of 3

Anonymous
Not applicable
Ironically, I had the need to do the same thing. This gets the coordinates for the view and places them in mincoord, and maxcoord. You might be able to use the Coordinate property of the view to assign a new value. I didn't need to do that, so I don't know! Private Sub GetViewComponentSelSet(viewnum As Integer) Dim objView As AcadView Dim ssMode As Integer Dim mincoord(2) As Double Dim maxcoord(2) As Double Dim var As Variant 'Get a selection set with the components in this view Set objView = ThisDrawing.Views.item(index) var = objView.Center mincoord(0) = var(0) - objView.Width / 2 mincoord(1) = var(1) - objView.height / 2 mincoord(2) = 0 maxcoord(0) = var(0) + objView.Width / 2 maxcoord(1) = var(1) + objView.height / 2 maxcoord(2) = 0 Set componentSS = vbdPowerSet("viewss" + Str(index)) Dim groupCode(1) As Integer Dim dataCode(1) As Variant groupCode(0) = 0 dataCode(0) = "INSERT" groupCode(1) = 2 '2 stands for block name dataCode(1) = "cline" ssMode = acSelectionSetCrossing componentSS.Select ssMode, mincoord, maxcoord, groupCode, dataCode componentSS.Highlight (True) MsgBox "pauseing" componentSS.Highlight (False) End Sub "Ron Mills" wrote in message news:4055bd90$2_2@newsprd01... Is there any way using VBA to programmatically return the Upper Left and Lower Right extents of a view, or programmatically set these two values?
0 Likes