Revit API

Reply
Distinguished Contributor
chuck.han
Posts: 122
Registered: ‎09-27-2004
Message 1 of 7 (613 Views)

programmatically zoom/pan?

613 Views, 6 Replies
07-27-2011 10:15 AM

I'm racking my brains on this one.  I can't seem to find a way to programmatically zoom/pan.  I know I can zoom to the extents of the selected objects, but that's not what I want.

 

thanks in advance, Chuck

Contributor
NatCad74
Posts: 16
Registered: ‎03-06-2009
Message 2 of 7 (599 Views)

Re: programmatically zoom/pan?

07-29-2011 11:13 PM in reply to: chuck.han

Don't believe it's possible I would also like to save current extents, center point & zoom for the current view to re-use on another level which would put the user in the same spot.

Distinguished Contributor
Dale.Bartlett
Posts: 140
Registered: ‎01-06-2003
Message 3 of 7 (417 Views)

Re: programmatically zoom/pan?

06-17-2012 10:39 PM in reply to: NatCad74

I simply want to Zoom Fit in the current active view. Seems simple but again I can't find the answer. Any takers? Thanks Dale

Contributor
NatCad74
Posts: 16
Registered: ‎03-06-2009
Message 4 of 7 (413 Views)

Re: programmatically zoom/pan?

06-18-2012 04:38 AM in reply to: chuck.han

You could try this worked for what I needed a while ago now... http://forums.augi.com/showthread.php?106364-lower-amp-upper-bounds-of-the-current-window-view

 

Imports AC_App = Autodesk.AutoCAD.ApplicationServices.Application

Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Interop

Public Class FloorSurferView

    Private pMax As Point3d
    Private pMin As Point3d

    Public Sub New()
        SaveView()
    End Sub

    Private Sub SaveView()

        Dim ed As Editor = AC_App.DocumentManager.MdiActiveDocument.Editor

        Using acView As ViewTableRecord = ed.GetCurrentView()

            Dim pCenter As Point3d = New Point3d(acView.CenterPoint.X, acView.CenterPoint.Y, 0)
            pMin = New Point3d(pCenter.X - (acView.Width / 2), pCenter.Y - (acView.Height / 2), 0)
            pMax = New Point3d(pCenter.X + (acView.Width / 2), pCenter.Y + (acView.Height / 2), 0)

        End Using

    End Sub

    Public Sub Zoom()

        Dim app As AcadApplication = CType(Application.AcadApplication, AcadApplication)
        Dim lower() As Double = New Double() {pMin.X, pMin.Y, pMin.Z}
        Dim upper() As Double = New Double() {pMax.X, pMax.Y, pMax.Z}
        app.ZoomWindow(lower, upper)

    End Sub

End Class

 

Distinguished Contributor
Dale.Bartlett
Posts: 140
Registered: ‎01-06-2003
Message 5 of 7 (410 Views)

Re: programmatically zoom/pan?

06-18-2012 09:03 AM in reply to: chuck.han

Thanks for the reply, but I need this for Revit (2013). Regards, Dale

ADN Support Specialist
jeremytammik
Posts: 458
Registered: ‎08-20-2007
Message 6 of 7 (405 Views)

Re: programmatically zoom/pan?

06-19-2012 02:17 AM in reply to: Dale.Bartlett

Hey guys,

 

you seem to have missed my last post:

 

http://thebuildingcoder.typepad.com/blog/2012/06/uiview-and-windows-device-coordinates.html

 

The UIView class provides full support for pan and zoom. That is what it is there for, as far as I can tell.

 

Best regards,

 

Jeremy
--
Jeremy Tammik
Autodesk Developer Network -- http://www.autodesk.com/joinadn
The Building Coder -- http://thebuildingcoder.typepad.com




Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Distinguished Contributor
chuck.han
Posts: 122
Registered: ‎09-27-2004
Message 7 of 7 (396 Views)

Re: programmatically zoom/pan?

06-20-2012 09:54 AM in reply to: jeremytammik

Thanks, Jeremy!

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.