<?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: viewport Number -1 ? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/viewport-number-1/m-p/2429494#M71823</link>
    <description>If the size of viewport is &amp;gt;= of layout dimension -1 si returned&lt;BR /&gt;
as soon you have created a viewport with dimension inside layout the number increase...&lt;BR /&gt;
example:&lt;BR /&gt;
&lt;BR /&gt;
1 layout 210x297&lt;BR /&gt;
creation viewport with same size--&amp;gt; -1 returned&lt;BR /&gt;
creation viewport with same size--&amp;gt; -1 returned&lt;BR /&gt;
creation viewport size 205x290 . --&amp;gt; 4 or 5.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Well,  the viewport internal is numbered but autocad don't show us the index , until he (you..)  drawing inside the layout.&lt;BR /&gt;
I think that is a bug. If I need to create a viewport outside the layout (and autocad allows this.) autocad must to number all the viewports&lt;BR /&gt;
created. Please tell me if i wrong..</description>
    <pubDate>Thu, 12 Feb 2009 09:43:07 GMT</pubDate>
    <dc:creator>bikelink</dc:creator>
    <dc:date>2009-02-12T09:43:07Z</dc:date>
    <item>
      <title>viewport Number -1 ?</title>
      <link>https://forums.autodesk.com/t5/net-forum/viewport-number-1/m-p/2429493#M71822</link>
      <description>Hi, I have created 2 viewport in my layout via code.&lt;BR /&gt;
1 of this , has property Number -1. No one error during creation ...but it's have number -1. Object id is valid.&lt;BR /&gt;
Then when i try to get it in writemode an error occurred. Any suggestion ?</description>
      <pubDate>Thu, 12 Feb 2009 09:09:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/viewport-number-1/m-p/2429493#M71822</guid>
      <dc:creator>bikelink</dc:creator>
      <dc:date>2009-02-12T09:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: viewport Number -1 ?</title>
      <link>https://forums.autodesk.com/t5/net-forum/viewport-number-1/m-p/2429494#M71823</link>
      <description>If the size of viewport is &amp;gt;= of layout dimension -1 si returned&lt;BR /&gt;
as soon you have created a viewport with dimension inside layout the number increase...&lt;BR /&gt;
example:&lt;BR /&gt;
&lt;BR /&gt;
1 layout 210x297&lt;BR /&gt;
creation viewport with same size--&amp;gt; -1 returned&lt;BR /&gt;
creation viewport with same size--&amp;gt; -1 returned&lt;BR /&gt;
creation viewport size 205x290 . --&amp;gt; 4 or 5.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Well,  the viewport internal is numbered but autocad don't show us the index , until he (you..)  drawing inside the layout.&lt;BR /&gt;
I think that is a bug. If I need to create a viewport outside the layout (and autocad allows this.) autocad must to number all the viewports&lt;BR /&gt;
created. Please tell me if i wrong..</description>
      <pubDate>Thu, 12 Feb 2009 09:43:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/viewport-number-1/m-p/2429494#M71823</guid>
      <dc:creator>bikelink</dc:creator>
      <dc:date>2009-02-12T09:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: viewport Number -1 ?</title>
      <link>https://forums.autodesk.com/t5/net-forum/viewport-number-1/m-p/2429495#M71824</link>
      <description>isn't this...yet.&lt;BR /&gt;&lt;BR /&gt;I try to make a viewport inside the layout..with height 10 in A3. It's very little viewport...and autocad return -1.&lt;BR /&gt;&lt;BR /&gt;and the viewport is drawing in paper space&lt;BR /&gt;&lt;BR /&gt;if the size Y-height increases 20 (example), return positive number and of course the viewport is ok.&lt;BR /&gt;&lt;BR /&gt;there are  a minimum size to build a viewport in paperspace ?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;in my viewport buildin snapon =false..&lt;BR /&gt;&lt;BR /&gt;I don't know where can i find a solution..&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;that's my code:&lt;BR /&gt;&lt;BR /&gt;using (DocumentLock l = d.LockDocument())&lt;BR /&gt;&lt;BR /&gt;            {&lt;BR /&gt;&lt;BR /&gt;                using (Transaction t = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())&lt;BR /&gt;&lt;BR /&gt;                {&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;                    Point3d pt1 = new Point3d(0, 0, 0);&lt;BR /&gt;&lt;BR /&gt;                    Point3d pt2 = new Point3d(s.X, s.Y, 0);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;                    Viewport vport = new Viewport();&lt;BR /&gt;&lt;BR /&gt;                    vport.Height = (double)Math.Abs(pt1.Y - pt2.Y);&lt;BR /&gt;&lt;BR /&gt;                    vport.Width = (double)Math.Abs(pt1.X - pt2.X);&lt;BR /&gt;&lt;BR /&gt;                    // da controllare la sottrazione dei due vettori&lt;BR /&gt;&lt;BR /&gt;                    //Vector3d ptc = pt2.GetAsVector().Subtract(pt1.GetAsVector());&lt;BR /&gt;&lt;BR /&gt;                    vport.CenterPoint = new Point3d(pt2.X / 2, pt2.Y / 2, 0);&lt;BR /&gt;&lt;BR /&gt;                    vport.SetDatabaseDefaults();&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;                    BlockTable bt = (BlockTable)t.GetObject(db.BlockTableId, OpenMode.ForWrite, false);&lt;BR /&gt;&lt;BR /&gt;                    BlockTableRecord blkRec = (BlockTableRecord)t.GetObject(bt[BlockTableRecord.PaperSpace], OpenMode.ForWrite, false);&lt;BR /&gt;&lt;BR /&gt;                    blkRec.AppendEntity(vport);&lt;BR /&gt;&lt;BR /&gt;                    vport.On = true;      // can't be set until after it is added to database&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;                    vport.SnapOn = false;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;                    vport.Color = Autodesk.AutoCAD.Colors.Color.FromColor(System.Drawing.Color.Red);&lt;BR /&gt;&lt;BR /&gt;                    {color:#ff0000}int vpNum = vport.Number;{color}&lt;BR /&gt;&lt;BR /&gt;                    t.AddNewlyCreatedDBObject(vport, true);&lt;BR /&gt;&lt;BR /&gt;                    t.Commit();&lt;BR /&gt;&lt;BR /&gt;                    viewportID = vport.ObjectId;&lt;BR /&gt;&lt;BR /&gt;                }&lt;BR /&gt;&lt;BR /&gt;                return viewportID;&lt;BR /&gt;&lt;BR /&gt;            }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;why the number is -1 when the viewport is created with a small size in y dimension ?&lt;BR /&gt;&lt;BR /&gt;the same code if i try to build a viewport with Height 20 instead of 10 return vport.number &amp;gt; 0</description>
      <pubDate>Thu, 12 Feb 2009 11:21:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/viewport-number-1/m-p/2429495#M71824</guid>
      <dc:creator>bikelink</dc:creator>
      <dc:date>2009-02-12T11:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: viewport Number -1 ?</title>
      <link>https://forums.autodesk.com/t5/net-forum/viewport-number-1/m-p/2429496#M71825</link>
      <description>OK....i don't understood ...the zoom in paper space is the base of my trouble.&lt;BR /&gt;
if you look from distant the layout, the viewports with a little size aren't numbered!&lt;BR /&gt;
if you perform a zoom in paper space..or better a zoom with the angle of your viewport in creation...then the number will be correct.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
the right sequence is&lt;BR /&gt;
create layout&lt;BR /&gt;
zoom extension in paper space  (but if you have an A0/A1 and some little viewport this couldn't be are enough)&lt;BR /&gt;
better zoom on your size viewport.&lt;BR /&gt;
creation viewport. the number is right.&lt;BR /&gt;
&lt;BR /&gt;
thanks autocad...for this joke.. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Thu, 12 Feb 2009 13:16:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/viewport-number-1/m-p/2429496#M71825</guid>
      <dc:creator>bikelink</dc:creator>
      <dc:date>2009-02-12T13:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: viewport Number -1 ?</title>
      <link>https://forums.autodesk.com/t5/net-forum/viewport-number-1/m-p/3298333#M71826</link>
      <description>&lt;P&gt;Excellent!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry to bring an old thread back from the dead, but I just ran into this exact issue!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My newly created viewports were comining up with the number of -1. &amp;nbsp;After doing a zoom extents on the new layout (prior to creating the new viewports), the viewports are numbered properly and I no longer get an error!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for figuring this out bikelink!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2012 23:40:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/viewport-number-1/m-p/3298333#M71826</guid>
      <dc:creator>Rob.O</dc:creator>
      <dc:date>2012-01-18T23:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: viewport Number -1 ?</title>
      <link>https://forums.autodesk.com/t5/net-forum/viewport-number-1/m-p/3299787#M71827</link>
      <description>&lt;P&gt;İ am confused a little. arent ViewPortTableRecords member of ViewPortTable ?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2012 19:16:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/viewport-number-1/m-p/3299787#M71827</guid>
      <dc:creator>cincir</dc:creator>
      <dc:date>2012-01-19T19:16:56Z</dc:date>
    </item>
  </channel>
</rss>

