<?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: Trouble with Transactions in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/trouble-with-transactions/m-p/3737836#M52714</link>
    <description>&lt;P&gt;Could someone point me to some information regarding the difference and different uses of TransactionManager from the &lt;STRONG&gt;Document&lt;/STRONG&gt; rather than the one from the &lt;STRONG&gt;Database&lt;/STRONG&gt;? Thanks, Dale&lt;/P&gt;</description>
    <pubDate>Sun, 16 Dec 2012 07:46:45 GMT</pubDate>
    <dc:creator>Dale.Bartlett</dc:creator>
    <dc:date>2012-12-16T07:46:45Z</dc:date>
    <item>
      <title>Trouble with Transactions</title>
      <link>https://forums.autodesk.com/t5/net-forum/trouble-with-transactions/m-p/3680194#M52711</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greatly appreciate any help. I'm creating a winforms app with a button that lets the user create a boundary from some closed areas in the drawing (via TraceBoundary), and calculates the area of the boundary.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Before calculating the area, I want to add the boundary object (a pline) to the model space via the Using Transaction...AppendEntity...AddNewlyCreatedDBObject strategy (as seen &lt;A href="http://through-the-interface.typepad.com/through_the_interface/2006/11/controlling_int.html" target="_blank"&gt;here&lt;/A&gt;), and have a prompt pop up to ask the user if the correct boundary was created. My problem below is that the boundary doesn't appear before the prompt. It only shows up after the entire transaction commits. Is there a way to have it appear before the prompt?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please see some screenshots of my problem attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;private void Button_Click(object sender, EventArgs e)
        {
            Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;
            Database db = doc.Database;
            db.LineWeightDisplay = true;

            double boundedarea = 0;
            bool keeplooping = true;
            ObjectIdCollection ids = new ObjectIdCollection();

            using (EditorUserInteraction edUserInt = ed.StartUserInteraction(this))
            {
                while (keeplooping)
                {
                    PromptPointOptions ptOptions = new PromptPointOptions("\nSelect point within area ");
                    ptOptions.AllowNone = false;
                    PromptPointResult ptResult = ed.GetPoint(ptOptions);
                    if (ptResult.Status != PromptStatus.OK)
                        return;

                    DBObjectCollection collection = ed.TraceBoundary(ptResult.Value, true);

                    using (Transaction Tx = db.TransactionManager.StartTransaction())
                    {
                        ObjectId ModelSpaceId = SymbolUtilityServices.GetBlockModelSpaceId(db);
                        BlockTableRecord model = Tx.GetObject(ModelSpaceId, OpenMode.ForWrite) as BlockTableRecord;

                        Polyline pline = collection[0] as Polyline;
                        if (pline != null)
                        {
                            pline.ColorIndex = 1;
                            pline.LineWeight = LineWeight.LineWeight050;
                            ids.Add(model.AppendEntity(pline));
                            Tx.AddNewlyCreatedDBObject(pline, true);
                            boundedarea = pline.Area;
                            ed.Regen(); //I'd like the boundary from TraceBoundary to be red and thick at this point
                            //so when kwOptions is run, the user can see if they selected the correct area

                            PromptKeywordOptions kwOptions = new PromptKeywordOptions("\nIs this the correct area? ");
                            kwOptions.Keywords.Add("Yes");
                            kwOptions.Keywords.Add("No");
                            kwOptions.Keywords.Default = "Yes";
                            kwOptions.AllowNone = true;
                            PromptResult pKeyRest = ed.GetKeywords(kwOptions);

                            if (pKeyRest.StringResult == "Yes")
                            {
                                textBox1.Text = boundedarea.ToString();
                                keeplooping = false;
                                Tx.Commit();
                            }
                            else
                                Tx.Abort();
                        }
                    }
                }
                edUserInt.End();
            }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
(this .cs contains a lot of other methods - not all assemblies relevant here)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2012 04:20:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trouble-with-transactions/m-p/3680194#M52711</guid>
      <dc:creator>brian.young</dc:creator>
      <dc:date>2012-10-31T04:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with Transactions</title>
      <link>https://forums.autodesk.com/t5/net-forum/trouble-with-transactions/m-p/3680466#M52712</link>
      <description>&lt;P&gt;Use the TransactionManager from the &lt;STRONG&gt;Document&lt;/STRONG&gt; rather than the one from the Database, and just before you start each transaction, call the TransactionManager's &lt;EM&gt;EnableGraphicsFlush()&lt;/EM&gt; method.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You will also need to refactor your code so that Commit() is called on each Transaction &lt;EM&gt;at the point where you want the newly added object to become visible&lt;/EM&gt;. Also call Editor.UpdateScreen() after each call to Commit(), and with that you should not need to call Editor.Regen().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can prompt for input after the transaction is committed but it is the call to Commit() that should trigger the graphics update.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2012 12:08:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trouble-with-transactions/m-p/3680466#M52712</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2012-10-31T12:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with Transactions</title>
      <link>https://forums.autodesk.com/t5/net-forum/trouble-with-transactions/m-p/3681116#M52713</link>
      <description>&lt;P&gt;Ah, thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;turns out the graphics flush did the trick! More info here:&amp;nbsp;&lt;A target="_blank" href="http://www.theswamp.org/index.php?topic=30185.0"&gt;http://www.theswamp.org/index.php?topic=30185.0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I replaced the ed.Regen() with Tx.TransactionManager.QueueForGraphicsFlush() and it works perfectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2012 16:01:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trouble-with-transactions/m-p/3681116#M52713</guid>
      <dc:creator>brian.young</dc:creator>
      <dc:date>2012-10-31T16:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with Transactions</title>
      <link>https://forums.autodesk.com/t5/net-forum/trouble-with-transactions/m-p/3737836#M52714</link>
      <description>&lt;P&gt;Could someone point me to some information regarding the difference and different uses of TransactionManager from the &lt;STRONG&gt;Document&lt;/STRONG&gt; rather than the one from the &lt;STRONG&gt;Database&lt;/STRONG&gt;? Thanks, Dale&lt;/P&gt;</description>
      <pubDate>Sun, 16 Dec 2012 07:46:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trouble-with-transactions/m-p/3737836#M52714</guid>
      <dc:creator>Dale.Bartlett</dc:creator>
      <dc:date>2012-12-16T07:46:45Z</dc:date>
    </item>
  </channel>
</rss>

