<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: zoom WIndow .NET in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185315#M75503</link>
    <description>Thank you! The "SetViewportFromView" did the job. Here is the &lt;BR /&gt;
alternative version going through Interop:&lt;BR /&gt;
&lt;BR /&gt;
             AcadApplication app = &lt;BR /&gt;
(AcadApplication)Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication;&lt;BR /&gt;
             Extents3d ext = mem.GeometricExtents;&lt;BR /&gt;
             Vector3d v = new Vector3d((ext.MinPoint - &lt;BR /&gt;
ext.MaxPoint).ToArray());&lt;BR /&gt;
             Point3d ll = (ext.MinPoint - v * 100.0 / zoomFactor);&lt;BR /&gt;
             Point3d ur = (ext.MaxPoint + v * 100.0 / zoomFactor);&lt;BR /&gt;
             app.ZoomWindow(ll.ToArray(), ur.ToArray());&lt;BR /&gt;
&lt;BR /&gt;
Just make sure you dont have DOTNET3.5SP1 installed, it has a LOT of &lt;BR /&gt;
side effects.&lt;BR /&gt;
&lt;BR /&gt;
Ampplee37 wrote:&lt;BR /&gt;
&amp;gt; Here you go Hope this helps you out. There is still some junk in there i&lt;BR /&gt;
&amp;gt; need to clean up. its just left over from trying to get it to work&lt;BR /&gt;
&amp;gt; properly. Dim Layout As String = SwitchTabs("Model") Dim Mytransman As&lt;BR /&gt;
&amp;gt; Autodesk.AutoCAD.DatabaseServices.TransactionManager Dim Mytrans As&lt;BR /&gt;
&amp;gt; Autodesk.AutoCAD.DatabaseServices.Transaction Dim MyDWG As&lt;BR /&gt;
&amp;gt; Autodesk.AutoCAD.ApplicationServices.Document Dim MyDWGDB As&lt;BR /&gt;
&amp;gt; Autodesk.AutoCAD.DatabaseServices.Database Dim MyEd As&lt;BR /&gt;
&amp;gt; EditorInput.Editor MyDWG =&lt;BR /&gt;
&amp;gt; Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
&amp;gt; Mytransman = MyDWG.TransactionManager Mytrans =&lt;BR /&gt;
&amp;gt; Mytransman.StartTransaction MyDWGDB = MyDWG.Database MyEd = MyDWG.Editor&lt;BR /&gt;
&amp;gt; Dim currentvisstyle As New&lt;BR /&gt;
&amp;gt; Autodesk.AutoCAD.GraphicsInterface.VisualStyle Dim lowerbounds1 As New&lt;BR /&gt;
&amp;gt; Geometry.Point3d(-10000, -10000, 0) Dim UpperBounds1 As New&lt;BR /&gt;
&amp;gt; Geometry.Point3d(10000, 10000, 0) Dim cVP1 As Integer =&lt;BR /&gt;
&amp;gt; System.Convert.ToInt32(Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("CVPORT"))&lt;BR /&gt;
&amp;gt; Dim ZoomWindow1 As Autodesk.AutoCAD.GraphicsSystem.View =&lt;BR /&gt;
&amp;gt; MyDWG.GraphicsManager.GetGsView(cVP1, True)&lt;BR /&gt;
&amp;gt; ZoomWindow1.ZoomExtents(lowerbounds1, UpperBounds1)&lt;BR /&gt;
&amp;gt; MyDWG.GraphicsManager.SetViewportFromView(cVP1, ZoomWindow1, True, True,&lt;BR /&gt;
&amp;gt; False) 'MyEd.Regen() ZoomWindow1.Dispose() Mytrans.Commit()&lt;BR /&gt;
&amp;gt; Mytrans.Dispose() Mytransman.Dispose() SwitchTabs(Layout)</description>
    <pubDate>Fri, 07 Nov 2008 18:57:33 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2008-11-07T18:57:33Z</dc:date>
    <item>
      <title>zoom WIndow .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185306#M75494</link>
      <description>Using VS2005 and AutoCAD 07/08 and SQL Server 2000&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Hopefully maybe a stupid question but i guess we'll see....Why doesnt this work??????  &lt;BR /&gt;
&lt;BR /&gt;
MORE CODE ABOVE HERE..........................&lt;BR /&gt;
&lt;BR /&gt;
Dim Xmax As Decimal&lt;BR /&gt;
                    Dim Xmin As Decimal&lt;BR /&gt;
                    Dim Ymax As Decimal&lt;BR /&gt;
                    Dim Ymin As Decimal&lt;BR /&gt;
                    Xmax = (MyEnt.GeometricExtents.MaxPoint.X + 1)&lt;BR /&gt;
                    Xmin = (MyEnt.GeometricExtents.MinPoint.X - 1)&lt;BR /&gt;
                    Ymax = (MyEnt.GeometricExtents.MaxPoint.Y + 1)&lt;BR /&gt;
                    Ymin = (MyEnt.GeometricExtents.MinPoint.Y - 1)&lt;BR /&gt;
                    'Dim zoomRec As New DatabaseServices.ViewTableRecord&lt;BR /&gt;
                    'Dim ZoomHelp As (Autodesk.AutoCAD.Runtime.Interop)MyDWG&lt;BR /&gt;
&lt;BR /&gt;
                    Dim zoomwindow As New Autodesk.AutoCAD.GraphicsSystem.View&lt;BR /&gt;
                    Dim lowerbounds As New Geometry.Point2d(Xmin, Ymin)&lt;BR /&gt;
                    Dim UpperBounds As New Geometry.Point2d(Xmax, Ymax)&lt;BR /&gt;
                    zoomwindow.ZoomWindow(lowerbounds, UpperBounds)&lt;BR /&gt;
&lt;BR /&gt;
MORE CODE bELOW HERE..........................&lt;BR /&gt;
&lt;BR /&gt;
What i am doing is selecting labels that are mtext.   That is where the coordinates come from. I am trying to zoom to each one in a for next statement.  It wont zoom to the window though. There are no errors thrown.  Through out the Whole code.  Just cant get it to zoom to the entity.  I did look through the posts on here and they mention "interop"  I dont know what that is and have never used it.  &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I</description>
      <pubDate>Wed, 20 Feb 2008 21:10:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185306#M75494</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-02-20T21:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: zoom WIndow .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185307#M75495</link>
      <description>you can't create a new view without more code.&lt;BR /&gt;
I think what you want is to use the modelspace view to zoom around the drawing, in which case you should add some code like this:&lt;BR /&gt;
&lt;BR /&gt;
Dim doc As Document = Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
            Dim cVP As Integer = System.Convert.ToInt32(Application.GetSystemVariable("CVPORT"))&lt;BR /&gt;
&lt;BR /&gt;
then instead of creating a new view, set the view obj. to the current view like so:&lt;BR /&gt;
&lt;BR /&gt;
Dim zoomwindow As Autodesk.AutoCAD.GraphicsSystem.View = doc.GraphicsManager.GetGsView(cVP, True)&lt;BR /&gt;
&lt;BR /&gt;
then make sure to call zoomwindow.update() everytime you change the zoomwindow object.</description>
      <pubDate>Thu, 21 Feb 2008 20:23:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185307#M75495</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-02-21T20:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: zoom WIndow .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185308#M75496</link>
      <description>Also,&lt;BR /&gt;
&lt;BR /&gt;
you probably don't want to use zoomwindow, you probably want to use zoomextents()&lt;BR /&gt;
&lt;BR /&gt;
otherwise you are drawing a zoom window based on the size of your entity, instead of zooming the screen to the entity.&lt;BR /&gt;
&lt;BR /&gt;
oh, and you are actually creating a temporary view of modelspace.  when the user regen's they will find they are in the spot they were before the command executed.  so you may want to do a regen programmatically to compensate for the screen not being where they think it is.</description>
      <pubDate>Thu, 21 Feb 2008 20:27:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185308#M75496</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-02-21T20:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: zoom WIndow .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185309#M75497</link>
      <description>THAT WORKS GREAT!!! Thank you so much.  I did use the zoomextents() also.</description>
      <pubDate>Thu, 21 Feb 2008 21:43:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185309#M75497</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-02-21T21:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: zoom WIndow .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185310#M75498</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
the zooms works, but it looks different from the view before. That is,&lt;BR /&gt;
1) before I had 2-line view of the pipe network on white background&lt;BR /&gt;
2) in zoom i have some kind of polygon view on grey background&lt;BR /&gt;
3) after regen I have the old view, but on grey background, mousewheel &lt;BR /&gt;
acts funny and it suddenly jumps to a view of the complete modelspace&lt;BR /&gt;
&lt;BR /&gt;
Here is the code, what is wrong?&lt;BR /&gt;
&lt;BR /&gt;
             Document doc = AcadApp.DocumentManager.MdiActiveDocument;&lt;BR /&gt;
             Int32 cVP = &lt;BR /&gt;
System.Convert.ToInt32(Application.GetSystemVariable("CVPORT"));&lt;BR /&gt;
             Autodesk.AutoCAD.GraphicsSystem.View zoomwindow = &lt;BR /&gt;
doc.GraphicsManager.GetGsView(cVP, true);&lt;BR /&gt;
             zoomwindow.ZoomExtents( obj.GeometricExtents.MinPoint, &lt;BR /&gt;
obj.GeometricExtents.MaxPoint);&lt;BR /&gt;
             zoomwindow.Update();&lt;BR /&gt;
&lt;BR /&gt;
             AcadApp.ShowAlertDialog("Click me to exit zoom.");&lt;BR /&gt;
             doc.SendStringToExecute("REGEN ", false, false, false);&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Patrick&lt;BR /&gt;
&lt;BR /&gt;
Cadkid82 wrote:&lt;BR /&gt;
&amp;gt; Also,&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; you probably don't want to use zoomwindow, you probably want to use zoomextents()&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; otherwise you are drawing a zoom window based on the size of your entity, instead of zooming the screen to the entity.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; oh, and you are actually creating a temporary view of modelspace.  when the user regen's they will find they are in the spot they were before the command executed.  so you may want to do a regen programmatically to compensate for the screen not being where they think it is.</description>
      <pubDate>Tue, 04 Nov 2008 19:49:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185310#M75498</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-11-04T19:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: zoom WIndow .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185311#M75499</link>
      <description>I have some code at work that fixed that.  I fought with it for the longest time.  I will email it to you in the morning.</description>
      <pubDate>Wed, 05 Nov 2008 04:02:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185311#M75499</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-11-05T04:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: zoom WIndow .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185312#M75500</link>
      <description>Please Post your code to the Forum for the Benefit of all. &lt;BR /&gt;
&lt;BR /&gt;
Thank You.</description>
      <pubDate>Wed, 05 Nov 2008 05:10:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185312#M75500</guid>
      <dc:creator>arcticad</dc:creator>
      <dc:date>2008-11-05T05:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: zoom WIndow .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185313#M75501</link>
      <description>My "email address" is NOT nospam@autodesk.com. Please post it to the list.&lt;BR /&gt;
&lt;BR /&gt;
Did you clone the old view, or create a new view from the old ptr?&lt;BR /&gt;
I just discovered there is "SetViewFromViewport" and so on.&lt;BR /&gt;
&lt;BR /&gt;
ampplee37 wrote:&lt;BR /&gt;
&amp;gt; I have some code at work that fixed that. I fought with it for the&lt;BR /&gt;
&amp;gt; longest time. I will email it to you in the morning.</description>
      <pubDate>Thu, 06 Nov 2008 10:14:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185313#M75501</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-11-06T10:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: zoom WIndow .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185314#M75502</link>
      <description>Here you go Hope this helps you out.  There is still some junk in there i need to clean up.  its just left over from trying to get it to work properly.  &lt;BR /&gt;
&lt;BR /&gt;
Dim Layout As String = SwitchTabs("Model")&lt;BR /&gt;
        Dim Mytransman As Autodesk.AutoCAD.DatabaseServices.TransactionManager&lt;BR /&gt;
        Dim Mytrans As Autodesk.AutoCAD.DatabaseServices.Transaction&lt;BR /&gt;
        Dim MyDWG As Autodesk.AutoCAD.ApplicationServices.Document&lt;BR /&gt;
        Dim MyDWGDB As Autodesk.AutoCAD.DatabaseServices.Database&lt;BR /&gt;
        Dim MyEd As EditorInput.Editor&lt;BR /&gt;
        MyDWG = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
        Mytransman = MyDWG.TransactionManager&lt;BR /&gt;
        Mytrans = Mytransman.StartTransaction&lt;BR /&gt;
        MyDWGDB = MyDWG.Database&lt;BR /&gt;
        MyEd = MyDWG.Editor&lt;BR /&gt;
        Dim currentvisstyle As New Autodesk.AutoCAD.GraphicsInterface.VisualStyle&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
        Dim lowerbounds1 As New Geometry.Point3d(-10000, -10000, 0)&lt;BR /&gt;
        Dim UpperBounds1 As New Geometry.Point3d(10000, 10000, 0)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
        Dim cVP1 As Integer = System.Convert.ToInt32(Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("CVPORT"))&lt;BR /&gt;
        Dim ZoomWindow1 As Autodesk.AutoCAD.GraphicsSystem.View = MyDWG.GraphicsManager.GetGsView(cVP1, True)&lt;BR /&gt;
        ZoomWindow1.ZoomExtents(lowerbounds1, UpperBounds1)&lt;BR /&gt;
        MyDWG.GraphicsManager.SetViewportFromView(cVP1, ZoomWindow1, True, True, False)&lt;BR /&gt;
        'MyEd.Regen()&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
        ZoomWindow1.Dispose()&lt;BR /&gt;
        Mytrans.Commit()&lt;BR /&gt;
        Mytrans.Dispose()&lt;BR /&gt;
        Mytransman.Dispose()&lt;BR /&gt;
        SwitchTabs(Layout)</description>
      <pubDate>Thu, 06 Nov 2008 14:11:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185314#M75502</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-11-06T14:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: zoom WIndow .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185315#M75503</link>
      <description>Thank you! The "SetViewportFromView" did the job. Here is the &lt;BR /&gt;
alternative version going through Interop:&lt;BR /&gt;
&lt;BR /&gt;
             AcadApplication app = &lt;BR /&gt;
(AcadApplication)Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication;&lt;BR /&gt;
             Extents3d ext = mem.GeometricExtents;&lt;BR /&gt;
             Vector3d v = new Vector3d((ext.MinPoint - &lt;BR /&gt;
ext.MaxPoint).ToArray());&lt;BR /&gt;
             Point3d ll = (ext.MinPoint - v * 100.0 / zoomFactor);&lt;BR /&gt;
             Point3d ur = (ext.MaxPoint + v * 100.0 / zoomFactor);&lt;BR /&gt;
             app.ZoomWindow(ll.ToArray(), ur.ToArray());&lt;BR /&gt;
&lt;BR /&gt;
Just make sure you dont have DOTNET3.5SP1 installed, it has a LOT of &lt;BR /&gt;
side effects.&lt;BR /&gt;
&lt;BR /&gt;
Ampplee37 wrote:&lt;BR /&gt;
&amp;gt; Here you go Hope this helps you out. There is still some junk in there i&lt;BR /&gt;
&amp;gt; need to clean up. its just left over from trying to get it to work&lt;BR /&gt;
&amp;gt; properly. Dim Layout As String = SwitchTabs("Model") Dim Mytransman As&lt;BR /&gt;
&amp;gt; Autodesk.AutoCAD.DatabaseServices.TransactionManager Dim Mytrans As&lt;BR /&gt;
&amp;gt; Autodesk.AutoCAD.DatabaseServices.Transaction Dim MyDWG As&lt;BR /&gt;
&amp;gt; Autodesk.AutoCAD.ApplicationServices.Document Dim MyDWGDB As&lt;BR /&gt;
&amp;gt; Autodesk.AutoCAD.DatabaseServices.Database Dim MyEd As&lt;BR /&gt;
&amp;gt; EditorInput.Editor MyDWG =&lt;BR /&gt;
&amp;gt; Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
&amp;gt; Mytransman = MyDWG.TransactionManager Mytrans =&lt;BR /&gt;
&amp;gt; Mytransman.StartTransaction MyDWGDB = MyDWG.Database MyEd = MyDWG.Editor&lt;BR /&gt;
&amp;gt; Dim currentvisstyle As New&lt;BR /&gt;
&amp;gt; Autodesk.AutoCAD.GraphicsInterface.VisualStyle Dim lowerbounds1 As New&lt;BR /&gt;
&amp;gt; Geometry.Point3d(-10000, -10000, 0) Dim UpperBounds1 As New&lt;BR /&gt;
&amp;gt; Geometry.Point3d(10000, 10000, 0) Dim cVP1 As Integer =&lt;BR /&gt;
&amp;gt; System.Convert.ToInt32(Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("CVPORT"))&lt;BR /&gt;
&amp;gt; Dim ZoomWindow1 As Autodesk.AutoCAD.GraphicsSystem.View =&lt;BR /&gt;
&amp;gt; MyDWG.GraphicsManager.GetGsView(cVP1, True)&lt;BR /&gt;
&amp;gt; ZoomWindow1.ZoomExtents(lowerbounds1, UpperBounds1)&lt;BR /&gt;
&amp;gt; MyDWG.GraphicsManager.SetViewportFromView(cVP1, ZoomWindow1, True, True,&lt;BR /&gt;
&amp;gt; False) 'MyEd.Regen() ZoomWindow1.Dispose() Mytrans.Commit()&lt;BR /&gt;
&amp;gt; Mytrans.Dispose() Mytransman.Dispose() SwitchTabs(Layout)</description>
      <pubDate>Fri, 07 Nov 2008 18:57:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoom-window-net/m-p/2185315#M75503</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-11-07T18:57:33Z</dc:date>
    </item>
  </channel>
</rss>

