hardwired Posted September 9, 2008 Share Posted September 9, 2008 Hi, How do I get the current modelspace view to be centralised on screen using VBA? I have a program that lists all layouts or modelspace views and when the user clicks on them in the listbox, autocad displays that layout (obviously makes that layout active) or displays that view, but with the view, it is always left-aligned on screen, but i would prefer it to be central. Is there a way to do this? Quote Link to comment Share on other sites More sharing options...
hendie Posted September 9, 2008 Share Posted September 9, 2008 yes, use the zoom centre option grab the minimum and maximum coordinates, work out the view centre and use that Quote Link to comment Share on other sites More sharing options...
hardwired Posted September 9, 2008 Author Share Posted September 9, 2008 Hi, Which object has that as a property? I have this sample code but can't see which object would have the zoom centre option.. Dim ViewsX As AcadViews Dim ViewZ As AcadView Dim viewportObj As AcadViewport Set ViewZ = ThisDrawing.Views.Item(ListBox1.Text) Set viewportObj = ThisDrawing.ActiveViewport viewportObj.SetView ViewZ ThisDrawing.ActiveViewport = viewportObj Quote Link to comment Share on other sites More sharing options...
hendie Posted September 9, 2008 Share Posted September 9, 2008 it's not an object, it's a method - ZoomCenter, ZoomExtents, ZoomScaled etc straight out of the Help file.... ' ZoomCenter MsgBox "Perform a ZoomCenter using:" & vbCrLf & _ "Center 3, 3, 0" & vbCrLf & _ "Magnification: 10", , "ZoomWindow Example" Dim zcenter(0 To 2) As Double Dim magnification As Double zcenter(0) = 3: zcenter(1) = 3: zcenter(2) = 0 magnification = 10 zoomcenter zcenter, magnification Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.