<?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: Update AutoCAD Display in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/6963946#M32211</link>
    <description>&lt;P&gt;This is a the other sample: Create a Preview of an altered Document Window&lt;/P&gt;
&lt;P&gt;Attached you'll find screenshots of a sample drawing, wrong bitmap, required bitmap as well as the code used to generate the bitmaps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;using System;
using System.IO;
using System.Threading;
using System.Reflection;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
using frmApp = System.Windows.Forms.Application;

using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;

using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;


[assembly: CommandClass(typeof(TestAcadUpdate.Class1))]

namespace TestAcadUpdate
{
    public class Class1
    {

        /// &amp;lt;summary&amp;gt;
        /// 1. Change Size of Drawing Window
        /// 2. Create Preview (bmp)
        /// &amp;lt;/summary&amp;gt;
        [CommandMethod("TestUDW", CommandFlags.Session)]
        public static void UpdateDocumentWindow()
        {
            Document doc = null;
            Editor ed = null;
            Database db = null;

            string bmPathname = null;
            try
            {
                doc = AcadApp.DocumentManager.MdiActiveDocument;
                ed = doc.Editor;
                db = doc.Database;

                bmPathname = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(doc.Name), System.IO.Path.GetFileNameWithoutExtension(doc.Name) + ".bmp");
                if (!doc.IsNamedDrawing)
                    bmPathname = System.IO.Path.Combine(Path.GetTempPath(), System.IO.Path.GetFileNameWithoutExtension(doc.Name) + ".bmp");


                //Resize Document Window which changes the NrOfPixels off the Bitmap.
                var wSize = new double[] { 400, 400 };
                doc.Window.WindowState = Autodesk.AutoCAD.Windows.Window.State.Normal;

                System.Windows.Size szDoc = new System.Windows.Size(wSize[0], wSize[1]);
                var appWinSize = AcadApp.MainWindow.DeviceIndependentSize;
                System.Windows.Point ptDoc = new System.Windows.Point(0.5 * (appWinSize.Width - szDoc.Width), 0.5 * (appWinSize.Height - szDoc.Height));

                //AutoCAD recalculates the View, but the update is postponed until the end of the command.
                doc.Window.DeviceIndependentLocation = ptDoc;
                doc.Window.DeviceIndependentSize = szDoc;

                doc.Window.WindowState = Autodesk.AutoCAD.Windows.Window.State.Normal;

                dynamic acadApp = AcadApp.AcadApplication;
                acadApp.ZoomExtents();


                //LockDocument because of Session Mode
                var docLck = default(DocumentLock);
                using (docLck = doc.LockDocument())
                {
                    var tr = default(Transaction);
                    using (tr = db.TransactionManager.StartTransaction())
                    {
                        if (!db.TileMode)
                            db.TileMode = true;

                        AcadApp.SetSystemVariable("LWDISPLAY", 1);
                        AcadApp.SetSystemVariable("UCSICON", 0);

                        var bgCol = System.Drawing.Color.White;
                        var fgCol = System.Drawing.Color.Black;
                        var acadPref = (dynamic)AcadApp.Preferences;
                        acadPref.Display.GraphicsWinModelBackgrndColor = bgCol;

                        ed.UpdateTiledViewportsInDatabase();

                        var size = doc.Window.DeviceIndependentSize;
                        using (var bmp = doc.CapturePreviewImage(Convert.ToUInt32(size.Width), Convert.ToUInt32(size.Height)))
                        {
                            var bwBmp = ConvertToBlackWhite(bmp, bgCol, fgCol);

                            if (File.Exists(bmPathname))
                                File.Delete(bmPathname);
                            bwBmp.Save(bmPathname, ImageFormat.Bmp);
                        }
                        tr.Commit();
                    }
                }
             }
            catch (System.Exception ex)
            {
                if (ed != null)
                    ed.WriteMessage("\n Error {0}: {1} ", MethodBase.GetCurrentMethod().Name, ex.Message);
                else
                    MessageBox.Show(ex.Message, MethodBase.GetCurrentMethod().Name, MessageBoxButtons.OK);
            }
        }


        //Developed by: Kean Walmsley: http://through-the-interface.typepad.com/through_the_interface/2009/11/novembers-plugin-of-the-month-screenshot.html
        public static Bitmap ConvertToBlackWhite(Bitmap src, System.Drawing.Color bgcol, System.Drawing.Color fgcol)
        {
            Bitmap bmp = new Bitmap(src.Width, src.Height);
            for (int y = 0; y &amp;lt; bmp.Height; y++)
            {
                for (int x = 0; x &amp;lt; bmp.Width; x++)
                {
                    System.Drawing.Color c = src.GetPixel(x, y);
                    if (!SameColors(c, bgcol))
                        c = fgcol;
                    bmp.SetPixel(x, y, c);
                }
            }
            return bmp;
        }

        //Developed by: Kean Walmsley: http://through-the-interface.typepad.com/through_the_interface/2009/11/novembers-plugin-of-the-month-screenshot.html
        private static bool SameColors(System.Drawing.Color a, System.Drawing.Color b)
        {
            // Ignore Alpha channel, just compare RGB
            return (a.R == b.R &amp;amp;&amp;amp; a.G == b.G &amp;amp;&amp;amp; a.B == b.B);
        }

 }
}

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Mar 2017 10:51:19 GMT</pubDate>
    <dc:creator>SENL1362</dc:creator>
    <dc:date>2017-03-22T10:51:19Z</dc:date>
    <item>
      <title>Update AutoCAD Display</title>
      <link>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/6963660#M32210</link>
      <description>&lt;P&gt;I cannot get the AutoCAD display to get updated during the execution of a command.&lt;/P&gt;
&lt;P&gt;There are two cases for which i like the display to get updated:&lt;/P&gt;
&lt;P&gt;1. When changing the current layer, the&amp;nbsp; ribbon must show the new current while the command is executed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; See the sample below. The command may be called from Palette or WPF controll.&lt;/P&gt;
&lt;P&gt;2. After changing the Document Display Size but before taking a snapshot.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've tried different update calls, document and session context, windows messages etc. but the display always gets updated after the command is finished.&lt;/P&gt;
&lt;P&gt;I've found one sollution and that's issue an other command using SendStringToExecute but this result in an other issue,&amp;nbsp; synchronisation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The update problem occurs in all versions of AutoCAD up to 2017.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any other suggestions or is this simply not possible.&lt;/P&gt;
&lt;P&gt;Thanks in advance for any help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;using System;
using System.Threading;
using System.Reflection;
using System.Drawing;
using System.Windows.Forms;
using frmApp = System.Windows.Forms.Application;

using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;

using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;

[assembly: CommandClass(typeof(TestAcadUpdate.Class1))]

namespace TestAcadUpdate
{
    public class Class1
    {

        /// &amp;lt;summary&amp;gt;
        /// Update Ribbon to display the new Current Layer BEFORE the end of this command,
        ///   without a user interaction (ed.GetXXX),
        ///   and (if possible) without Session mode
        /// &amp;lt;/summary&amp;gt;
        [CommandMethod("TestUCLD", CommandFlags.Session )]
        public static void UpdateCurrentLayerDisplay()
        {
            Document doc = null;
            Editor ed = null;
            Database db = null;

            try
            {
                doc = AcadApp.DocumentManager.MdiActiveDocument;
                ed = doc.Editor;
                db = doc.Database;

                //LockDocument because of Session Mode
                var docLck = default(DocumentLock);
                using (docLck = doc.LockDocument())
                {
                    var tr = default(Transaction);
                    using (tr = db.TransactionManager.StartTransaction())
                    {
                        //Change CurrentLayer to "0"
                        db.Clayer = db.LayerZero;

                        //var lt = (LayerTable)tr.GetObject(db.LayerTableId, OpenMode.ForRead);
                        var layer0 = (LayerTableRecord)tr.GetObject(db.LayerZero, OpenMode.ForWrite);
                        //Force a graphics update
                        layer0.IsOff = layer0.IsOff;
                        ed.ApplyCurDwgLayerTableChanges();

                        tr.Commit();
                    }
                    doc.TransactionManager.EnableGraphicsFlush(true);
                    doc.TransactionManager.QueueForGraphicsFlush();
                }
                //I'll like the Ribbon to display the new CurrentLayer NOW
                ed.UpdateScreen();
                ed.Regen();
                AcadApp.UpdateScreen();
                Autodesk.AutoCAD.Internal.Utils.FlushGraphics();

                //This doesn't work either, and is not what i'll want 
                //string esc = null;
                //esc += '\x03';
                //doc.SendStringToExecute(esc, true, false, false);
                //PromptPointResult ppr = ed.GetPoint("\n Give me a Point: ");
                //if (ppr.Status != PromptStatus.OK)
                //    return;

                var cp = Cursor.Position;
                Cursor.Position = new Point(cp.X, cp.Y);
                frmApp.DoEvents();

                //Simulate other drawing and calculation activities
                for (int i = 0; i &amp;lt; 10; i++)
                    Thread.Sleep(1000);
            }
            catch (System.Exception ex)
            {
                if (ed != null)
                    ed.WriteMessage("\n Error {0}: {1} " , MethodBase.GetCurrentMethod().Name, ex.Message);
                else
                    MessageBox.Show(ex.Message, MethodBase.GetCurrentMethod().Name, MessageBoxButtons.OK);
            }
        }
    }
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 08:48:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/6963660#M32210</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2017-03-22T08:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Update AutoCAD Display</title>
      <link>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/6963946#M32211</link>
      <description>&lt;P&gt;This is a the other sample: Create a Preview of an altered Document Window&lt;/P&gt;
&lt;P&gt;Attached you'll find screenshots of a sample drawing, wrong bitmap, required bitmap as well as the code used to generate the bitmaps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;using System;
using System.IO;
using System.Threading;
using System.Reflection;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
using frmApp = System.Windows.Forms.Application;

using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;

using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;


[assembly: CommandClass(typeof(TestAcadUpdate.Class1))]

namespace TestAcadUpdate
{
    public class Class1
    {

        /// &amp;lt;summary&amp;gt;
        /// 1. Change Size of Drawing Window
        /// 2. Create Preview (bmp)
        /// &amp;lt;/summary&amp;gt;
        [CommandMethod("TestUDW", CommandFlags.Session)]
        public static void UpdateDocumentWindow()
        {
            Document doc = null;
            Editor ed = null;
            Database db = null;

            string bmPathname = null;
            try
            {
                doc = AcadApp.DocumentManager.MdiActiveDocument;
                ed = doc.Editor;
                db = doc.Database;

                bmPathname = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(doc.Name), System.IO.Path.GetFileNameWithoutExtension(doc.Name) + ".bmp");
                if (!doc.IsNamedDrawing)
                    bmPathname = System.IO.Path.Combine(Path.GetTempPath(), System.IO.Path.GetFileNameWithoutExtension(doc.Name) + ".bmp");


                //Resize Document Window which changes the NrOfPixels off the Bitmap.
                var wSize = new double[] { 400, 400 };
                doc.Window.WindowState = Autodesk.AutoCAD.Windows.Window.State.Normal;

                System.Windows.Size szDoc = new System.Windows.Size(wSize[0], wSize[1]);
                var appWinSize = AcadApp.MainWindow.DeviceIndependentSize;
                System.Windows.Point ptDoc = new System.Windows.Point(0.5 * (appWinSize.Width - szDoc.Width), 0.5 * (appWinSize.Height - szDoc.Height));

                //AutoCAD recalculates the View, but the update is postponed until the end of the command.
                doc.Window.DeviceIndependentLocation = ptDoc;
                doc.Window.DeviceIndependentSize = szDoc;

                doc.Window.WindowState = Autodesk.AutoCAD.Windows.Window.State.Normal;

                dynamic acadApp = AcadApp.AcadApplication;
                acadApp.ZoomExtents();


                //LockDocument because of Session Mode
                var docLck = default(DocumentLock);
                using (docLck = doc.LockDocument())
                {
                    var tr = default(Transaction);
                    using (tr = db.TransactionManager.StartTransaction())
                    {
                        if (!db.TileMode)
                            db.TileMode = true;

                        AcadApp.SetSystemVariable("LWDISPLAY", 1);
                        AcadApp.SetSystemVariable("UCSICON", 0);

                        var bgCol = System.Drawing.Color.White;
                        var fgCol = System.Drawing.Color.Black;
                        var acadPref = (dynamic)AcadApp.Preferences;
                        acadPref.Display.GraphicsWinModelBackgrndColor = bgCol;

                        ed.UpdateTiledViewportsInDatabase();

                        var size = doc.Window.DeviceIndependentSize;
                        using (var bmp = doc.CapturePreviewImage(Convert.ToUInt32(size.Width), Convert.ToUInt32(size.Height)))
                        {
                            var bwBmp = ConvertToBlackWhite(bmp, bgCol, fgCol);

                            if (File.Exists(bmPathname))
                                File.Delete(bmPathname);
                            bwBmp.Save(bmPathname, ImageFormat.Bmp);
                        }
                        tr.Commit();
                    }
                }
             }
            catch (System.Exception ex)
            {
                if (ed != null)
                    ed.WriteMessage("\n Error {0}: {1} ", MethodBase.GetCurrentMethod().Name, ex.Message);
                else
                    MessageBox.Show(ex.Message, MethodBase.GetCurrentMethod().Name, MessageBoxButtons.OK);
            }
        }


        //Developed by: Kean Walmsley: http://through-the-interface.typepad.com/through_the_interface/2009/11/novembers-plugin-of-the-month-screenshot.html
        public static Bitmap ConvertToBlackWhite(Bitmap src, System.Drawing.Color bgcol, System.Drawing.Color fgcol)
        {
            Bitmap bmp = new Bitmap(src.Width, src.Height);
            for (int y = 0; y &amp;lt; bmp.Height; y++)
            {
                for (int x = 0; x &amp;lt; bmp.Width; x++)
                {
                    System.Drawing.Color c = src.GetPixel(x, y);
                    if (!SameColors(c, bgcol))
                        c = fgcol;
                    bmp.SetPixel(x, y, c);
                }
            }
            return bmp;
        }

        //Developed by: Kean Walmsley: http://through-the-interface.typepad.com/through_the_interface/2009/11/novembers-plugin-of-the-month-screenshot.html
        private static bool SameColors(System.Drawing.Color a, System.Drawing.Color b)
        {
            // Ignore Alpha channel, just compare RGB
            return (a.R == b.R &amp;amp;&amp;amp; a.G == b.G &amp;amp;&amp;amp; a.B == b.B);
        }

 }
}

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 10:51:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/6963946#M32211</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2017-03-22T10:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: Update AutoCAD Display</title>
      <link>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/6966674#M32212</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;does the blog&amp;nbsp;&lt;A href="http://through-the-interface.typepad.com/through_the_interface/2016/01/locking-and-unlocking-autocad-layers-visibly-using-net.html" target="_blank"&gt;http://through-the-interface.typepad.com/through_the_interface/2016/01/locking-and-unlocking-autocad-layers-visibly-using-net.html&lt;/A&gt; helps?&amp;nbsp;Make sure you call&amp;nbsp;ApplyCurDwgLayerTableChanges&amp;nbsp;after committing the&amp;nbsp;Transaction.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 05:08:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/6966674#M32212</guid>
      <dc:creator>Virupaksha_aithal</dc:creator>
      <dc:date>2017-03-23T05:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: Update AutoCAD Display</title>
      <link>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/6967404#M32213</link>
      <description>&lt;P&gt;Hello Virupaksha,&lt;/P&gt;
&lt;P&gt;Thanks for the reply but this does &lt;STRONG&gt;not&lt;/STRONG&gt; solve this issue.&lt;/P&gt;
&lt;P&gt;The screen (and Ribbon Layer state) gets only updated after the command has finished.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below the updated code(ed.Apply... after the Commit), simmilar like suggested by Kean.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any other suggestions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;                //LockDocument because of Session Mode
                var docLck = default(DocumentLock);
                using (docLck = doc.LockDocument())
                {
                    var tr = default(Transaction);
                    using (tr = db.TransactionManager.StartTransaction())
                    {
                        //Change CurrentLayer to "0"
                        db.Clayer = db.LayerZero;

                        //var lt = (LayerTable)tr.GetObject(db.LayerTableId, OpenMode.ForRead);
                        var layer0 = (LayerTableRecord)tr.GetObject(db.LayerZero, OpenMode.ForWrite);
                        //Force a graphics update
                        layer0.IsLocked = true;
                        layer0.IsLocked = false;
                        layer0.IsOff = layer0.IsOff;

                        tr.Commit();
                    }
                    //I'll like the Ribbon to display the new CurrentLayer NOW
 &lt;STRONG&gt;                   ed.ApplyCurDwgLayerTableChanges();&lt;/STRONG&gt;
                    ed.Regen();
&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Mar 2017 12:21:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/6967404#M32213</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2017-03-23T12:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Update AutoCAD Display</title>
      <link>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/6990579#M32214</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looks like there is no API at present to update the ribbon during command execution&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 04:55:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/6990579#M32214</guid>
      <dc:creator>Virupaksha_aithal</dc:creator>
      <dc:date>2017-04-03T04:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: Update AutoCAD Display</title>
      <link>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/6990628#M32215</link>
      <description>Hello Virupaksha,&lt;BR /&gt;Thank you for youre response. &lt;BR /&gt;What about the second sample, TestUDW, where an update of the Drawing Window is required.&lt;BR /&gt;</description>
      <pubDate>Mon, 03 Apr 2017 06:02:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/6990628#M32215</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2017-04-03T06:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: Update AutoCAD Display</title>
      <link>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/6994128#M32216</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looks like AutoCAD is not updating the size internally till the command end. so you may need to think of splitting your logic to two commands. one to set the size and other command to create image like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; [CommandMethod("TestUDW", CommandFlags.Session)]
        public static void UpdateDocumentWindow()
        {
            Document doc = AcadApp.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;
            try
            {

                dynamic doc1 = doc.GetAcadDocument();
                doc1.Width = 400;
                doc1.Height = 400;

                doc.SendStringToExecute("capImage ", true, false, true);
            }
            catch (System.Exception ex)
            {
                if (ed != null)
                    ed.WriteMessage("\n Error {0}: {1} ", MethodBase.GetCurrentMethod().Name, ex.Message);
                else
                    MessageBox.Show(ex.Message, MethodBase.GetCurrentMethod().Name, MessageBoxButtons.OK);
            }
        }

        [CommandMethod("capImage")]
        public static void capImage()
        {
            dynamic acadApp = AcadApp.AcadApplication;
            acadApp.ZoomExtents();
         
            Document doc = AcadApp.DocumentManager.MdiActiveDocument;

            var bgCol = System.Drawing.Color.White;
            var fgCol = System.Drawing.Color.Black;
            var size = doc.Window.DeviceIndependentSize;

            string bmPathname = null;
            bmPathname = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(doc.Name), System.IO.Path.GetFileNameWithoutExtension(doc.Name) + ".bmp");
            if (!doc.IsNamedDrawing)
                bmPathname = System.IO.Path.Combine(Path.GetTempPath(), System.IO.Path.GetFileNameWithoutExtension(doc.Name) + ".bmp");

            using (var bmp = doc.CapturePreviewImage(Convert.ToUInt32(size.Width), Convert.ToUInt32(size.Height)))
            {
             
                if (File.Exists(bmPathname))
                    File.Delete(bmPathname);

                bmp.Save(bmPathname, ImageFormat.Bmp);
            }
        }&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Apr 2017 12:13:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/6994128#M32216</guid>
      <dc:creator>Virupaksha_aithal</dc:creator>
      <dc:date>2017-04-04T12:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: Update AutoCAD Display</title>
      <link>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/6996363#M32217</link>
      <description>Thank you for youre attention and this solution.&lt;BR /&gt;</description>
      <pubDate>Wed, 05 Apr 2017 05:31:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/6996363#M32217</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2017-04-05T05:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: Update AutoCAD Display</title>
      <link>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/14054372#M86664</link>
      <description>&lt;P&gt;After the test, a problem was discovered.&lt;BR /&gt;It turns out that this function only takes effect in the model space.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I use this command to operate within the layout? It won't read the contents within the layout to update the images. How should I modify it to make it effective for operating on the current space?&lt;BR /&gt;&lt;BR /&gt;Think you!&lt;/P&gt;</description>
      <pubDate>Sat, 14 Mar 2026 06:31:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/update-autocad-display/m-p/14054372#M86664</guid>
      <dc:creator>Medithaibet</dc:creator>
      <dc:date>2026-03-14T06:31:00Z</dc:date>
    </item>
  </channel>
</rss>

