<?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: How to get access to a layout's model space? in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6923703#M8641</link>
    <description>&lt;P&gt;You are trying to freeze some layers in a viewport. Period.&lt;/P&gt;
&lt;P&gt;There is no seperate "model viewport" in the layout. Viewports are in the paperspace blocktablerecord of your layout.&lt;/P&gt;
&lt;P&gt;Your code is ok - it finds the &lt;FONT face="courier new,courier"&gt;AcDbViewport&lt;/FONT&gt;s within the layout.&lt;/P&gt;
&lt;P&gt;All you have to do is to freeze the layers within the &lt;FONT face="courier new,courier"&gt;AcDbViewport&lt;/FONT&gt;. Just use the methods&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;class AcDbViewport: public AcDbEntity&lt;BR /&gt;{&lt;BR /&gt;public:&lt;BR /&gt;    Acad::ErrorStatus freezeLayersInViewport(const AcDbObjectIdArray&amp;amp;);
    Acad::ErrorStatus thawLayersInViewport(const AcDbObjectIdArray&amp;amp;);
    Acad::ErrorStatus thawAllLayersInViewport();
    bool              isLayerFrozenInViewport(const AcDbObjectId&amp;amp; layerId) const;
    Acad::ErrorStatus getFrozenLayerList(AcDbObjectIdArray&amp;amp; ids) const;&lt;BR /&gt;}
&lt;/PRE&gt;
&lt;P&gt;Or do you plan to freeze Layers when the user changes to MSPACE and thaw them when he changes to PSPACE?&lt;/P&gt;
&lt;P&gt;This would require a reactor.&lt;/P&gt;</description>
    <pubDate>Mon, 06 Mar 2017 15:14:53 GMT</pubDate>
    <dc:creator>tbrammer</dc:creator>
    <dc:date>2017-03-06T15:14:53Z</dc:date>
    <item>
      <title>How to get access to a layout's model space?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6923629#M8640</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Hello everyone,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I am trying to freeze some layers in paper layout's model viewport.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 649px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/329761i9BFB67F4A6D36DB4/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;With the code below, I can get all paper viewports. But I don't how to get access of model space using objectarx.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thank you in advance.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;  static AcDbObjectIdArray GetViewportArray(AcDbLayout *pLayout)
  {
    AcDbObjectIdArray ids;
    AcDbBlockTableRecordPointer pBtr(pLayout-&amp;gt;getBlockTableRecordId(), AcDb::kForRead);

    if (pBtr.openStatus() == Acad::eOk) {
      AcDbBlockTableRecordIterator *pIter = NULL;

      if (pBtr-&amp;gt;newIterator(pIter) == Acad::eOk &amp;amp;&amp;amp; pIter) {
        for (; !pIter-&amp;gt;done(); pIter-&amp;gt;step()) {
          AcDbObjectId id;
	
          if (pIter-&amp;gt;getEntityId(id) == Acad::eOk) {
			  if (id.objectClass() == AcDbViewport::desc())
              ids.append(id);
          }
        }
        delete pIter;
		
      }
    }
    return ids;
  }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 14:53:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6923629#M8640</guid>
      <dc:creator>syx_lemans</dc:creator>
      <dc:date>2017-03-06T14:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to get access to a layout's model space?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6923703#M8641</link>
      <description>&lt;P&gt;You are trying to freeze some layers in a viewport. Period.&lt;/P&gt;
&lt;P&gt;There is no seperate "model viewport" in the layout. Viewports are in the paperspace blocktablerecord of your layout.&lt;/P&gt;
&lt;P&gt;Your code is ok - it finds the &lt;FONT face="courier new,courier"&gt;AcDbViewport&lt;/FONT&gt;s within the layout.&lt;/P&gt;
&lt;P&gt;All you have to do is to freeze the layers within the &lt;FONT face="courier new,courier"&gt;AcDbViewport&lt;/FONT&gt;. Just use the methods&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;class AcDbViewport: public AcDbEntity&lt;BR /&gt;{&lt;BR /&gt;public:&lt;BR /&gt;    Acad::ErrorStatus freezeLayersInViewport(const AcDbObjectIdArray&amp;amp;);
    Acad::ErrorStatus thawLayersInViewport(const AcDbObjectIdArray&amp;amp;);
    Acad::ErrorStatus thawAllLayersInViewport();
    bool              isLayerFrozenInViewport(const AcDbObjectId&amp;amp; layerId) const;
    Acad::ErrorStatus getFrozenLayerList(AcDbObjectIdArray&amp;amp; ids) const;&lt;BR /&gt;}
&lt;/PRE&gt;
&lt;P&gt;Or do you plan to freeze Layers when the user changes to MSPACE and thaw them when he changes to PSPACE?&lt;/P&gt;
&lt;P&gt;This would require a reactor.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 15:14:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6923703#M8641</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2017-03-06T15:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to get access to a layout's model space?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6923809#M8642</link>
      <description>&lt;P&gt;Thank you for your reply. But I am comfused with something&lt;/P&gt;&lt;PRE&gt;AcDbObjectIdArray viewPorts = GetViewportArray(pLayout);
pLayout-&amp;gt;close();
if (viewPorts.length() &amp;gt; 0) {
AcDbObjectPointer&amp;lt;AcDbViewport&amp;gt; pVport(viewPorts[0], AcDb::kForWrite);
 if (pVport.openStatus() == Acad::eOk) {
   pVport-&amp;gt;freezeLayersInViewport(frozenLayers);
   }
}&lt;/PRE&gt;&lt;P&gt;frozenLayers is my object id array of layers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My original layout is like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="orig.JPG" style="width: 570px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/329799iA4B585C1BD646446/image-size/large?v=v2&amp;amp;px=999" role="button" title="orig.JPG" alt="orig.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With my application, I can creat a new layout "presentation2", and freeze the layers I want in paper space&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="result1.JPG" style="width: 702px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/329801i71E4B07DE42AF4C2/image-size/large?v=v2&amp;amp;px=999" role="button" title="result1.JPG" alt="result1.JPG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="result2.JPG" style="width: 232px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/329802i669C319AF904A13A/image-size/large?v=v2&amp;amp;px=999" role="button" title="result2.JPG" alt="result2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I switch to model space of the same layout. I find that nothing is frozen in model space mode. &lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="result3.JPG" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/329805iDAD76C71F816FA53/image-size/large?v=v2&amp;amp;px=999" role="button" title="result3.JPG" alt="result3.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 15:41:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6923809#M8642</guid>
      <dc:creator>syx_lemans</dc:creator>
      <dc:date>2017-03-06T15:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to get access to a layout's model space?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6923892#M8643</link>
      <description>&lt;P&gt;I see what you mean.&lt;/P&gt;
&lt;P&gt;Besides the AcDbViewport entities that you can see in your layout, there is also always the "paperspace viewport", which is an AcDbViewport as well.&lt;/P&gt;
&lt;P&gt;This is the viewport through which you see your layout. If you freeze layers in a viewport while in paperspace you are changing this viewport.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I always recomment to use the great ArxDbg.arx with command SNOOPDB. You find the project in &amp;lt;ARX&amp;gt;samples\database\ARXDBG:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Vport.png" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/329814i96F98234E8B1528D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Vport.png" alt="Vport.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The paperspace viewport has the Number 1 (which is the content of the CVPORT variable).&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 16:04:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6923892#M8643</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2017-03-06T16:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to get access to a layout's model space?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6924130#M8644</link>
      <description>&lt;P&gt;Thank you, I will try it&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 17:06:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6924130#M8644</guid>
      <dc:creator>syx_lemans</dc:creator>
      <dc:date>2017-03-06T17:06:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to get access to a layout's model space?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6931178#M8645</link>
      <description>&lt;P&gt;I've solved it by adding loop for all viewports&lt;/P&gt;&lt;PRE&gt;if (viewPorts.length() &amp;gt; 0) {
				for(int i =0;i&amp;lt;viewPorts.length();i++)
				{
					AcDbObjectPointer&amp;lt;AcDbViewport&amp;gt; pVport(viewPorts[i], AcDb::kForWrite);
					if (pVport.openStatus() == Acad::eOk) {
						pVport-&amp;gt;freezeLayersInViewport(frozenLayers);						
					}
				}
            }&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Mar 2017 17:33:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6931178#M8645</guid>
      <dc:creator>syx_lemans</dc:creator>
      <dc:date>2017-03-08T17:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get access to a layout's model space?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6978657#M8646</link>
      <description>&lt;P&gt;Just one question to make sysvar CVPORT clear:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if in layout, but not in any viewport only in paperspace, CVPORT is 1&lt;/P&gt;&lt;P&gt;if in layout and in viewport modelspace, CVPORT is 2, 3, 4... depending which viewport - they are increased by creation chronologically&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if in model, CVPORT is 2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is this correct? what is CVPORT 1 for model?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 14:15:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6978657#M8646</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-28T14:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to get access to a layout's model space?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6980497#M8647</link>
      <description>&lt;P&gt;Yes, this is correct.&lt;/P&gt;
&lt;P&gt;In "model" (TILEMODE=1)&amp;nbsp; CVPORT=1 is invalid. CVPORT=1 is the "paperspace viewport" which doesn't exist in TILEMODE=1.&lt;/P&gt;
&lt;P&gt;You can split the model view into multiple viewports with the _VPORTS command. If you have created three viewports they will have CVPORT=2, CVPORT=3 and CVPORT=4. You can switch the active viewport by entering "CVPORT 3" or "_setvar CVPORT 3".&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 06:50:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6980497#M8647</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2017-03-29T06:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to get access to a layout's model space?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6989137#M8648</link>
      <description>&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Sat, 01 Apr 2017 14:52:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-access-to-a-layout-s-model-space/m-p/6989137#M8648</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-04-01T14:52:46Z</dc:date>
    </item>
  </channel>
</rss>

