<?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 with object in Layout-Viewports in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/zoom-with-object-in-layout-viewports/m-p/8963916#M21591</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SenStringToExecute runs asynchronously (i.e. after the method ended).&lt;/P&gt;
&lt;P&gt;If you target AutoCAD 2015 or later, you can use the &lt;A href="https://help.autodesk.com/view/OARX/2019/ENU/?guid=OREFNET-Autodesk_AutoCAD_EditorInput_Editor_Command_params_object__" target="_blank" rel="noopener"&gt;Editor.Command&lt;/A&gt;() method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ed.Command("._zoom", "_Object", "_Group ", layoutName, "");&lt;/PRE&gt;</description>
    <pubDate>Tue, 13 Aug 2019 17:54:09 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2019-08-13T17:54:09Z</dc:date>
    <item>
      <title>zoom with object in Layout-Viewports</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoom-with-object-in-layout-viewports/m-p/8963677#M21590</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am trying to assign a view in layout-viewport through Zoom--&amp;gt;object--&amp;gt;Single--&amp;gt;Groupname (from modelspace). the command execution is not working properly and also unable switch from modelspace to paperspace in layout&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; [CommandMethod("LayoutsViews")]
        public void LayoutsViews()
        {
            // Get the current document and database
            Document acDoc = Application.DocumentManager.MdiActiveDocument;
            Database acCurDb = acDoc.Database;

            acCurDb.TileMode = false;

            using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
            {
                DBDictionary layoutIDs = acTrans.GetObject(acCurDb.LayoutDictionaryId, OpenMode.ForRead) as DBDictionary;

                // Reference the Layout Manager
                LayoutManager acLayoutMgr = LayoutManager.Current;

                // Step through and list each named layout and Model
                foreach (DBDictionaryEntry layoutID in layoutIDs)
                {
                    
                    Layout CurrentLo = acTrans.GetObject(layoutID.Value, OpenMode.ForRead) as Layout;

                    string layoutName = CurrentLo.LayoutName.ToUpper().ToString();

                    if ((layoutName != "LAYOUT1") &amp;amp;&amp;amp; (layoutName != "LAYOUT2") &amp;amp;&amp;amp; (layoutName != "MODEL"))
                    {
                        //this.viewPort(CurrentLo, layoutName);
                        ObjectIdCollection idCollection = CurrentLo.GetViewports();

                        foreach (ObjectId ID in idCollection)
                        {
                            Viewport VP = acTrans.GetObject(ID, OpenMode.ForRead) as Viewport;

                            if (VP != null)
                            {
                                VP.UpgradeOpen();
                                VP.On = true;
                                VP.SetDatabaseDefaults();
                                VP.Visible = true;

                                // Activate model space in the viewport
                                acDoc.Editor.SwitchToModelSpace();

                                string command = string.Empty;

                                command = "._zoom _Object _SIngle _Group " + layoutName.ToString() + " ";

                                acDoc.SendStringToExecute(command, true, false, true);

                                acDoc.SendStringToExecute("._regen ", true, false, false);

                                VP.UpdateDisplay();

                                break;

                            }
                        }

                    }
                        ////Activate model space in the viewport
                        //acDoc.Editor.SwitchToPaperSpace();
                    }

                    //Activate model space in the viewport
                    // acDoc.Editor.SwitchToPaperSpace();
                    // Abort the changes to the database
                    acTrans.Commit();
                }
            }&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Aug 2019 15:51:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoom-with-object-in-layout-viewports/m-p/8963677#M21590</guid>
      <dc:creator>VallimanalanT</dc:creator>
      <dc:date>2019-08-13T15:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: zoom with object in Layout-Viewports</title>
      <link>https://forums.autodesk.com/t5/net-forum/zoom-with-object-in-layout-viewports/m-p/8963916#M21591</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SenStringToExecute runs asynchronously (i.e. after the method ended).&lt;/P&gt;
&lt;P&gt;If you target AutoCAD 2015 or later, you can use the &lt;A href="https://help.autodesk.com/view/OARX/2019/ENU/?guid=OREFNET-Autodesk_AutoCAD_EditorInput_Editor_Command_params_object__" target="_blank" rel="noopener"&gt;Editor.Command&lt;/A&gt;() method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ed.Command("._zoom", "_Object", "_Group ", layoutName, "");&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Aug 2019 17:54:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/zoom-with-object-in-layout-viewports/m-p/8963916#M21591</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2019-08-13T17:54:09Z</dc:date>
    </item>
  </channel>
</rss>

