Jump to content

Centralised ModelSpace Views (VBA)..


hardwired

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...