<?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: Layouts and Viewports in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3130486#M59649</link>
    <description>&lt;P&gt;Thank you.&amp;nbsp; I should have caught that in the documentation.&lt;/P&gt;</description>
    <pubDate>Fri, 19 Aug 2011 22:26:04 GMT</pubDate>
    <dc:creator>fieldguy</dc:creator>
    <dc:date>2011-08-19T22:26:04Z</dc:date>
    <item>
      <title>Layouts and Viewports</title>
      <link>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3128748#M59646</link>
      <description>&lt;P&gt;I found several links discussing viewports and layouts and found it a bit confusing.&amp;nbsp; I managed to get what I wanted but am left with some questions.&amp;nbsp; We are planning for a base coordinate system change which means&amp;nbsp;all of our CAD data will move.&amp;nbsp; The ultimate goal is to check scales, then&amp;nbsp;pan and zoom&amp;nbsp;each floating modelspace viewport as&amp;nbsp; required, in potentially 1000s of dwg files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The dwg file I am testing has 45 layouts and 1 viewport on each.&amp;nbsp; The code attached&amp;nbsp;is what I used to get the numbers to match.&amp;nbsp; I understand that viewport 1 on the layout is the paperspace layout itself.&amp;nbsp; But, I had several viewport numbers of -1 on each layout.&amp;nbsp;&amp;nbsp;I thought -1 represented an empty list, like nothing selected in a listbox.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Questions&lt;/P&gt;&lt;P&gt;1&amp;nbsp;- What does&amp;nbsp;viewport number -1 mean?&lt;/P&gt;&lt;P&gt;2 -&amp;nbsp;What is the purpose of viewporttable?&lt;/P&gt;&lt;P&gt;3 - Why doesn't&amp;nbsp;viewporttable contain viewporttablerecords that have&amp;nbsp;this information - or does it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There might be more later - now I need a vacation.&lt;/P&gt;&lt;P&gt;TIA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2011 17:02:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3128748#M59646</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2011-08-18T17:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: Layouts and Viewports</title>
      <link>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3129960#M59647</link>
      <description>&lt;P&gt;I've never noticed the viewport number of -1 before until trying your code, looks to me like that number represents a non-current layout, maybe someone knows otherwise? It looks like the current layout will give a positive number and non-current will give a number of -1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The ViewportTable holds ViewportTableRecord objects which are the tiled viewports in model space.&lt;/P&gt;&lt;P&gt;Viewport objects are the floating viewports on a layout.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2011 15:44:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3129960#M59647</guid>
      <dc:creator>cadMeUp</dc:creator>
      <dc:date>2011-08-19T15:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Layouts and Viewports</title>
      <link>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3130098#M59648</link>
      <description>&lt;P&gt;From the ObjectARX Reference Guide -&amp;gt;AcDbViewport::number:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;
&lt;P class="Element10"&gt;This function returns the viewport ID number. This is the number that is reported by the AutoCAD CVPORT system variable when the viewport is the current viewport in the AutoCAD editor. If the viewport is inactive, -1 is returned.&amp;nbsp;&lt;/P&gt;
&lt;P class="Element10"&gt;This value is not saved with the drawing, and changes each time the drawing is opened.&amp;nbsp;&lt;/P&gt;
&lt;P class="Element10"&gt;The viewport ID number is used for DXF group code 69.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;&amp;lt;&amp;lt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2011 17:19:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3130098#M59648</guid>
      <dc:creator>StephenPreston</dc:creator>
      <dc:date>2011-08-19T17:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Layouts and Viewports</title>
      <link>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3130486#M59649</link>
      <description>&lt;P&gt;Thank you.&amp;nbsp; I should have caught that in the documentation.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2011 22:26:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3130486#M59649</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2011-08-19T22:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Layouts and Viewports</title>
      <link>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3144376#M59650</link>
      <description>&lt;P&gt;I have a drawing with 6 layouts with 1 model space viewport on each.&amp;nbsp; 1 of the layouts has a viewport that has not been activated (whoever created the drawing never switched to model space in this layout).&amp;nbsp; Because of this,&amp;nbsp;there is no viewport number &amp;gt; 1 returned by layout.getviewports().&amp;nbsp;&amp;nbsp;If I manually activate model space on that layout, and run my code again, it finds the viewport.&amp;nbsp; This means I have a drawing with a layout with a viewport&amp;nbsp;that my code won't find.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there another way to find all of the viewports and&amp;nbsp;make sure model space has been activated?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2011 17:32:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3144376#M59650</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2011-09-01T17:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: Layouts and Viewports</title>
      <link>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3144436#M59651</link>
      <description>&lt;P&gt;In a layout's viewport collection, the first viewport is actually the screen you are looking at.&amp;nbsp; The other viewports are what you created using Mview command inside of autocad.&amp;nbsp; If you mess with the first viewport object you will get some very funny problems with your cad file (delete one and see!).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;jvj&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2011 18:12:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3144436#M59651</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-01T18:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Layouts and Viewports</title>
      <link>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3144736#M59652</link>
      <description>If a lay</description>
      <pubDate>Thu, 01 Sep 2011 23:44:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3144736#M59652</guid>
      <dc:creator>cadMeUp</dc:creator>
      <dc:date>2011-09-01T23:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Layouts and Viewports</title>
      <link>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3144746#M59653</link>
      <description>&lt;P&gt;My appologies, all my text got trashed when I posted my last.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try the attached code that I posted.&lt;/P&gt;&lt;P&gt;Sounds like the 'Layout' has never been switched to/activated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use the Layout.Initialize() method.&lt;/P&gt;&lt;P&gt;It will work for a layout that has not been initialized, but will throw an exception for one that has been initialized.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what it states in the ObjectARX docs for the AcDbLayout.initialized() method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="Element10"&gt;&lt;P class="Element10"&gt;&lt;FONT color="#666699"&gt;This method will do the behind the scenes work to establish a &lt;/FONT&gt;&lt;FONT color="#666699"&gt;Paper Space viewport for the layout. This allows a layout to be set up and made &lt;/FONT&gt;&lt;FONT color="#666699"&gt;ready for other viewports and entities to be put into the layout as well as to &lt;/FONT&gt;&lt;FONT color="#666699"&gt;set various layout properties.&lt;/FONT&gt;&lt;FONT color="#666699"&gt;﻿&lt;/FONT&gt;&lt;/P&gt;&lt;P class="Element10"&gt;&lt;FONT color="#666699"&gt;Returns &lt;SPAN&gt;Acad::eOk&lt;/SPAN&gt; if &lt;/FONT&gt;&lt;FONT color="#666699"&gt;successful; otherwise, returns an AutoCAD error status.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="Element10"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="Element10"&gt;&lt;FONT color="#000000"&gt;So just calling Initialize() on a Layout object won't completely activate it like manually switching to it would.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="Element10"&gt;&lt;FONT color="#000000"&gt;You shouldn't have to switch to 'model space'&amp;nbsp;thru a Viewport to active the viewport though and have it initialized, hope I understand that part correctly in your post.﻿&lt;/FONT&gt;&lt;/P&gt;&lt;P class="Element10"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="Element10"&gt;&lt;FONT color="#000000"&gt;Hope this helps!﻿&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 01 Sep 2011 23:56:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3144746#M59653</guid>
      <dc:creator>cadMeUp</dc:creator>
      <dc:date>2011-09-01T23:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Layouts and Viewports</title>
      <link>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3145640#M59654</link>
      <description>&lt;P&gt;Thanks to all contributors.&amp;nbsp; I did not notice or consider the initialize method of a layout.&amp;nbsp; I will post my solution when finished.&amp;nbsp; I have to move on for now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Working with the APIs for autocad and autocad map&amp;nbsp;reminds me of playing with a house of cards - be careful of which card you pull and&amp;nbsp;how you put&amp;nbsp;it back.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2011 17:58:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3145640#M59654</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2011-09-02T17:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: Layouts and Viewports</title>
      <link>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3154434#M59655</link>
      <description>&lt;P&gt;Attached is the code and a DWG file that shows some of the problems I am finding.&amp;nbsp; There are 8 layouts (l1-l8).&amp;nbsp; l1 through l3 look normal, except that properties shows&amp;nbsp;1 polyline and 1 viewport when I select all, but there is only 1 object.&amp;nbsp; But, l4 through l8 are causing trouble.&amp;nbsp; The code results in 15 layouts on l4, but I can only see 1 in Autocad.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone explain what I am seeing here and how to work around it?&amp;nbsp; I am going to check viewport centers and sizes to see if they make sense - I haven't tried that yet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TIA&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2011 15:20:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3154434#M59655</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2011-09-12T15:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: Layouts and Viewports</title>
      <link>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3156526#M59656</link>
      <description>&lt;P&gt;Layouts I1 thru I3 each contain a single viewport. Each one of them is not quite rectangular which results in a clipped viewport. When you select a clipped viewport you are selecting 2 objects, the viewport and the clipping object, most cases a polyline.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this, on a blank layout create 2 rectangular viewports. Rotate one of them&amp;nbsp;45 degrees. Select the non-rotated viewport and look at the 'Clipped' property in the properties palette, you will see that it is not clipped. Do the same thing with the rotated viewport you will see that it's 'Clipped' property is 'Yes'. So as soon as a viewport becomes in anyway non-rectangular AutoCAD turns it into a clipped viewport.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, there are some layers frozen in this drawing which is why you are not seeing the other objects&amp;nbsp;on the I4 layout.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2011 21:24:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3156526#M59656</guid>
      <dc:creator>cadMeUp</dc:creator>
      <dc:date>2011-09-13T21:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: Layouts and Viewports</title>
      <link>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3204726#M59657</link>
      <description>&lt;P&gt;Hi Jamie,&lt;/P&gt;&lt;P&gt;I have a program that's finding 2 viewports when I can only see 1.&amp;nbsp; I understand what you're saying about one viewport is actually the layout that your looking at, but how can I tell programatically which is which?&amp;nbsp; I have tried using a "watch" and copying the info to text files, but that is taking way too long.&amp;nbsp; Do you know how I can tell the difference between the two viewports?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thansk,&lt;BR /&gt;Mark&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2011 22:44:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3204726#M59657</guid>
      <dc:creator>mgorecki</dc:creator>
      <dc:date>2011-10-25T22:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: Layouts and Viewports</title>
      <link>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3204730#M59658</link>
      <description>&lt;P&gt;It should always be the first one in the enumerated list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;jvj&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2011 22:48:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3204730#M59658</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-10-25T22:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: Layouts and Viewports</title>
      <link>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3204734#M59659</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2011 22:49:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3204734#M59659</guid>
      <dc:creator>mgorecki</dc:creator>
      <dc:date>2011-10-25T22:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: Layouts and Viewports</title>
      <link>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3204810#M59660</link>
      <description>&lt;P&gt;Quote from &lt;A href="http://www.theswamp.org/index.php?topic=34837.msg400420#msg400420" target="_blank"&gt;here&lt;/A&gt;&amp;nbsp;by kaefer that helped &amp;nbsp;me out a while back&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"there's no need to filter out paperspace viewports or even to obtain ViewportIds if you use &lt;STRONG&gt;Database.GetViewports(false)."&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;From Docs:&lt;/P&gt;&lt;DIV class="quoteheader"&gt;&lt;DIV class="topslice_quote"&gt;Input flag indicating whether to return paperspace viewports associated with layouts.&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 26 Oct 2011 01:07:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layouts-and-viewports/m-p/3204810#M59660</guid>
      <dc:creator>jeff</dc:creator>
      <dc:date>2011-10-26T01:07:05Z</dc:date>
    </item>
  </channel>
</rss>

