<?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: ZoomWindow and ZoomScale in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3248878#M58131</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;excuse me not directly answering to your problem ... as I never used ".Bounds" &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But what is this code for? After you have calculated pMin and pMax:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;you create a line from pMin to pMax&lt;/LI&gt;&lt;LI&gt;you create an Extents3D object by getting the line.bounds ==&amp;gt; eExtents&lt;/LI&gt;&lt;LI&gt;you dispose the line&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;If I need an Extents3D-object from 2 points I would do&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;eExtents = new Extents3D(pMin,pMax)&amp;nbsp;&amp;nbsp;&amp;nbsp; ... and that's it, or where am I wrong?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Be careful with creating and disposing elements without necessity, it uses memory and releasing the memory used is a little bit tricky.&lt;/P&gt;&lt;P&gt;At least it costs performance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
    <pubDate>Sat, 03 Dec 2011 10:14:09 GMT</pubDate>
    <dc:creator>Alfred.NESWADBA</dc:creator>
    <dc:date>2011-12-03T10:14:09Z</dc:date>
    <item>
      <title>ZoomWindow and ZoomScale</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3247620#M58127</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anybody tell me how to convert this vba code to vb.net?&lt;BR /&gt;&lt;BR /&gt;Thank you&lt;/P&gt;&lt;PRE&gt;Dim BL(0 To 2) As Double: Dim TR(0 To 2) As Double
Call AddRec(BL, TR)

Function AddRec(FP, SP)
    ZoomWindow FP, SP
    ZoomScaled 0.8, acZoomScaledRelative
End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2011 12:14:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3247620#M58127</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-02T12:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: ZoomWindow and ZoomScale</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3247648#M58128</link>
      <description>I am using VS 2008 and AutoCAD 2007.</description>
      <pubDate>Fri, 02 Dec 2011 12:44:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3247648#M58128</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-02T12:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: ZoomWindow and ZoomScale</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3247692#M58129</link>
      <description>&lt;P&gt;Take a lok at online docs:&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html?url=WS1a9193826455f5ff2566ffd511ff6f8c7ca-4875.htm,topicNumber=d0e51"&gt;http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html?url=WS1a9193826455f5ff2566ffd511ff6f8c7ca-4875.htm,topicNumber=d0e51&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2011 13:07:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3247692#M58129</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2011-12-02T13:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: ZoomWindow and ZoomScale</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3248842#M58130</link>
      <description>&lt;PRE&gt;&lt;BR /&gt;Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.Geometry

Public Class Class1
    &amp;lt;CommandMethod("ZoomWindow")&amp;gt; _
        Public Sub ZoomWindow()
        '' Zoom to a window boundary defined by 1.3,7.8 and 13.7,-2.6
        Dim pMin As Point3d = New Point3d(1.3, 7.8, 0)
        Dim pMax As Point3d = New Point3d(13.7, -2.6, 0)

        Zoom(pMin, pMax, New Point3d(), 1)
    End Sub
    Public Sub Zoom(ByVal pMin As Point3d, ByVal pMax As Point3d,ByVal pCenter As Point3d, ByVal dFactor As Double)
        '' Get the current document and database
        Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
        Dim acCurDb As Database = acDoc.Database
        Dim nCurVport As Integer = System.Convert.ToInt32(Application.GetSystemVariable("CVPORT"))
        '' Get the extents of the current space when no points 

        '' or only a center point is provided

        '' Check to see if Model space is current

        If acCurDb.TileMode = True Then

      If pMin.Equals(New Point3d()) = True And pMax.Equals(New Point3d()) = True Then
                pMin = acCurDb.Extmin
                pMax = acCurDb.Extmax
            End If

        Else
            '' Check to see if Paper space is current
            If nCurVport = 1 Then

                If pMin.Equals(New Point3d()) = True And pMax.Equals(New Point3d()) = True Then
                    pMin = acCurDb.Pextmin
                    pMax = acCurDb.Pextmax
                End If

            Else

                '' Get the extents of Model space

          If pMin.Equals(New Point3d()) = True And pMax.Equals(New Point3d()) = True Then
                    pMin = acCurDb.Extmin
                    pMax = acCurDb.Extmax

                End If

            End If

        End If

        '' Start a transaction

        Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()

            '' Get the current view

            Using acView As ViewTableRecord = acDoc.Editor.GetCurrentView()

                Dim eExtents As Extents3d



                '' Translate WCS coordinates to DCS

                Dim matWCS2DCS As Matrix3d

                matWCS2DCS = Matrix3d.PlaneToWorld(acView.ViewDirection)

                matWCS2DCS = Matrix3d.Displacement(acView.Target - Point3d.Origin) * matWCS2DCS

          matWCS2DCS = Matrix3d.Rotation(-acView.ViewTwist, acView.ViewDirection,acView.Target) * matWCS2DCS
                '' If a center point is specified, define the 

                '' min and max point of the extents

                '' for Center and Scale modes

                If pCenter.DistanceTo(Point3d.Origin) &amp;lt;&amp;gt; 0 Then

              pMin = New Point3d(pCenter.X - (acView.Width / 2),pCenter.Y - (acView.Height / 2), 0)
                    pMax = New Point3d((acView.Width / 2) + pCenter.X, (acView.Height / 2) + pCenter.Y, 0)
                End If
                '' Create an extents object using a line

                Using acLine As Line = New Line(pMin, pMax)

                    eExtents = New Extents3d(acLine.Bounds.Value.MinPoint, acLine.Bounds.Value.MaxPoint)

                End Using



                '' Calculate the ratio between the width and height of the current view

                Dim dViewRatio As Double

                dViewRatio = (acView.Width / acView.Height)



                '' Tranform the extents of the view

                matWCS2DCS = matWCS2DCS.Inverse()

                eExtents.TransformBy(matWCS2DCS)



                Dim dWidth As Double

                Dim dHeight As Double

                Dim pNewCentPt As Point2d



                '' Check to see if a center point was provided (Center and Scale modes)

                If pCenter.DistanceTo(Point3d.Origin) &amp;lt;&amp;gt; 0 Then

                    dWidth = acView.Width

                    dHeight = acView.Height



                    If dFactor = 0 Then

                        pCenter = pCenter.TransformBy(matWCS2DCS)

                    End If



                    pNewCentPt = New Point2d(pCenter.X, pCenter.Y)

                Else '' Working in Window, Extents and Limits mode

                    '' Calculate the new width and height of the current view

                    dWidth = eExtents.MaxPoint.X - eExtents.MinPoint.X

                    dHeight = eExtents.MaxPoint.Y - eExtents.MinPoint.Y



                    '' Get the center of the view

                    pNewCentPt = New Point2d(((eExtents.MaxPoint.X + eExtents.MinPoint.X) * 0.5), ((eExtents.MaxPoint.Y + eExtents.MinPoint.Y) * 0.5))

                End If



                '' Check to see if the new width fits in current window

                If dWidth &amp;gt; (dHeight * dViewRatio) Then dHeight = dWidth / dViewRatio



                '' Resize and scale the view

                If dFactor &amp;lt;&amp;gt; 0 Then

                    acView.Height = dHeight * dFactor

                    acView.Width = dWidth * dFactor

                End If



                '' Set the center of the view

                acView.CenterPoint = pNewCentPt



                '' Set the current view

                acDoc.Editor.SetCurrentView(acView)

            End Using



            '' Commit the changes

            acTrans.Commit()

        End Using

    End Sub
End Class&lt;BR /&gt;&lt;BR /&gt;I am getting error near "eExtents = New Extents3d(acLine.Bounds.Value.MinPoint, acLine.Bounds.Value.MaxPoint)" line. I am using autocad 2007.&lt;BR /&gt;&lt;BR /&gt;My requirement is in the drawing there will be horizontal and vertical lines so that a grid is formed. While running the program, each box in the grid should zoom by taking the box min and max values.&lt;BR /&gt;Thank you &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Dec 2011 04:37:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3248842#M58130</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-03T04:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: ZoomWindow and ZoomScale</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3248878#M58131</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;excuse me not directly answering to your problem ... as I never used ".Bounds" &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But what is this code for? After you have calculated pMin and pMax:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;you create a line from pMin to pMax&lt;/LI&gt;&lt;LI&gt;you create an Extents3D object by getting the line.bounds ==&amp;gt; eExtents&lt;/LI&gt;&lt;LI&gt;you dispose the line&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;If I need an Extents3D-object from 2 points I would do&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;eExtents = new Extents3D(pMin,pMax)&amp;nbsp;&amp;nbsp;&amp;nbsp; ... and that's it, or where am I wrong?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Be careful with creating and disposing elements without necessity, it uses memory and releasing the memory used is a little bit tricky.&lt;/P&gt;&lt;P&gt;At least it costs performance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Sat, 03 Dec 2011 10:14:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3248878#M58131</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2011-12-03T10:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: ZoomWindow and ZoomScale</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3249340#M58132</link>
      <description>&lt;PRE&gt;// using System.Reflection;&lt;BR /&gt;public class Zoom
{
    public static void &lt;STRONG&gt;ZoomWindow&lt;/STRONG&gt;(Point3d p1, Point3d p2)
    {
        object acad = Application.AcadApplication;
        object[] pts = { p1.ToArray(), p2.ToArray() };
        acad.GetType().InvokeMember("ZoomWindow", BindingFlags.DeclaredOnly | BindingFlags.Public |
             BindingFlags.Instance | BindingFlags.InvokeMethod, null, acad, pts);
    }
    public static void &lt;STRONG&gt;ZoomExtents&lt;/STRONG&gt;()
    {
        object acad = Application.AcadApplication;
        acad.GetType().InvokeMember("ZoomExtents", BindingFlags.DeclaredOnly | BindingFlags.Public |
             BindingFlags.Instance | BindingFlags.InvokeMethod, null, acad, null);
    }
    public static void &lt;STRONG&gt;ZoomScaled&lt;/STRONG&gt;(double scale, int zoomScaleType)
    {&lt;BR /&gt;        // zoomScaleType :&lt;BR /&gt;       &amp;nbsp;//    acZoomScaledAbsolute  = 0
        //    acZoomScaledRelative  = 1
        //    acZoomScaledRelativePSpace  = 2
        object acad = Application.AcadApplication;
        acad.GetType().InvokeMember("ZoomScaled", BindingFlags.DeclaredOnly | BindingFlags.Public |
             BindingFlags.Instance | BindingFlags.InvokeMethod, null, acad, new object[] { scale, zoomScaleType });
    }
    public static void &lt;STRONG&gt;ZoomCenter&lt;/STRONG&gt;(Point3d pt, double magnitude)
    {
        object acad = Application.AcadApplication;
        acad.GetType().InvokeMember("ZoomCenter", BindingFlags.DeclaredOnly | BindingFlags.Public |
             BindingFlags.Instance | BindingFlags.InvokeMethod, null, acad, new object[] { pt.ToArray(), magnitude });
    }
}
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Dec 2011 18:57:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3249340#M58132</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2011-12-04T18:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: ZoomWindow and ZoomScale</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3249430#M58133</link>
      <description>&lt;P&gt;&lt;FONT size="2" face="arial,helvetica,sans-serif"&gt;Try this&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" face="arial,helvetica,sans-serif"&gt;Imports Autodesk.AutoCAD.ApplicationServices&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" face="arial,helvetica,sans-serif"&gt;Application.AcadApplication.ZoomExtents()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;﻿&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Dec 2011 21:38:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3249430#M58133</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-04T21:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: ZoomWindow and ZoomScale</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3249612#M58134</link>
      <description>Thank you so much. Now it is working fine.</description>
      <pubDate>Mon, 05 Dec 2011 06:17:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3249612#M58134</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-05T06:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: ZoomWindow and ZoomScale</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3266892#M58135</link>
      <description>&lt;P&gt;Alex, Thanks. That was Great. I was struggling a lot unitl I found this.&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;P&gt;Janet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2011 00:13:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoomwindow-and-zoomscale/m-p/3266892#M58135</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2011-12-18T00:13:11Z</dc:date>
    </item>
  </channel>
</rss>

