<?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: error while editing two solids with BoolSubtract in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/error-while-editing-two-solids-with-boolsubtract/m-p/2529508#M69605</link>
    <description>Thank  you very much for your help, this solved my problem.</description>
    <pubDate>Sun, 16 Aug 2009 19:41:19 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-08-16T19:41:19Z</dc:date>
    <item>
      <title>error while editing two solids with BoolSubtract</title>
      <link>https://forums.autodesk.com/t5/net-forum/error-while-editing-two-solids-with-boolsubtract/m-p/2529506#M69603</link>
      <description>Hi All,&lt;BR /&gt;
&lt;BR /&gt;
I have basically the same problem as this post:&lt;BR /&gt;
http://discussion.autodesk.com/forums/thread.jspa?threadID=728378&amp;amp;tstart=30&lt;BR /&gt;
I have tried the to downgrade open the solid but still no result.&lt;BR /&gt;
my code &lt;BR /&gt;
{code}&lt;BR /&gt;
        [CommandMethod("MyGroup", "MyCommand", "MyCommandLocal", CommandFlags.Modal)]&lt;BR /&gt;
        public void MyCommand() // This method can have any name&lt;BR /&gt;
        {&lt;BR /&gt;
            Document doc =  Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;
            Database db = doc.Database;&lt;BR /&gt;
            Transaction tr = doc.TransactionManager.StartTransaction();&lt;BR /&gt;
&lt;BR /&gt;
            using (tr)&lt;BR /&gt;
            {&lt;BR /&gt;
                BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);&lt;BR /&gt;
                BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForWrite);&lt;BR /&gt;
                BlockTableRecord ms =  (BlockTableRecord)tr.GetObject( bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite );                           &lt;BR /&gt;
                            &lt;BR /&gt;
                Solid3d sol = new Solid3d();&lt;BR /&gt;
                Solid3d sol2 = new Solid3d();&lt;BR /&gt;
                sol.RecordHistory = true;      &lt;BR /&gt;
                          &lt;BR /&gt;
                sol.CreateBox(10, 10, 10);&lt;BR /&gt;
                sol2.CreateBox(10, 10, 10);&lt;BR /&gt;
                sol.BooleanOperation(BooleanOperationType.BoolSubtract, sol2);                                &lt;BR /&gt;
                ms.AppendEntity(sol);&lt;BR /&gt;
                tr.AddNewlyCreatedDBObject(sol, true);&lt;BR /&gt;
                &lt;BR /&gt;
                tr.Commit();&lt;BR /&gt;
            }&lt;BR /&gt;
            &lt;BR /&gt;
        }&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance</description>
      <pubDate>Mon, 27 Jul 2009 21:36:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/error-while-editing-two-solids-with-boolsubtract/m-p/2529506#M69603</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-07-27T21:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: error while editing two solids with BoolSubtract</title>
      <link>https://forums.autodesk.com/t5/net-forum/error-while-editing-two-solids-with-boolsubtract/m-p/2529507#M69604</link>
      <description>I was curious about this, since I have code which does boolean operations and I have never had this problem.  So I played around with it a bit, and the difference between your code and mine is the RecordHistory option.  If you remove the RecordHistory line, your code works.  If the record history is important to you (for my purposes it should be false), then I played around and figured out that you must add the solids to the ModelSpace before performing the boolean operation.  So this:&lt;BR /&gt;
{code}&lt;BR /&gt;
Solid3d sol = new Solid3d();&lt;BR /&gt;
Solid3d sol2 = new Solid3d();&lt;BR /&gt;
sol.RecordHistory = true;      &lt;BR /&gt;
                         &lt;BR /&gt;
sol.CreateBox(20, 20, 8);&lt;BR /&gt;
sol2.CreateBox(10, 10, 10);&lt;BR /&gt;
sol.BooleanOperation(BooleanOperationType.BoolSubtract, sol2);                                &lt;BR /&gt;
ms.AppendEntity(sol);&lt;BR /&gt;
tr.AddNewlyCreatedDBObject(sol, true);&lt;BR /&gt;
               &lt;BR /&gt;
tr.Commit();&lt;BR /&gt;
{code}&lt;BR /&gt;
Becomes This:&lt;BR /&gt;
{code}&lt;BR /&gt;
Solid3d sol = new Solid3d();&lt;BR /&gt;
Solid3d sol2 = new Solid3d();&lt;BR /&gt;
sol.RecordHistory = true;      &lt;BR /&gt;
                         &lt;BR /&gt;
sol.CreateBox(20, 20, 8);&lt;BR /&gt;
sol2.CreateBox(10, 10, 10);&lt;BR /&gt;
ms.AppendEntity(sol);&lt;BR /&gt;
ms.AppendEntity(sol2);&lt;BR /&gt;
sol.BooleanOperation(BooleanOperationType.BoolSubtract, sol2);                                &lt;BR /&gt;
tr.AddNewlyCreatedDBObject(sol, true);&lt;BR /&gt;
               &lt;BR /&gt;
tr.Commit();&lt;BR /&gt;
{code}</description>
      <pubDate>Tue, 28 Jul 2009 18:57:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/error-while-editing-two-solids-with-boolsubtract/m-p/2529507#M69604</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2009-07-28T18:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: error while editing two solids with BoolSubtract</title>
      <link>https://forums.autodesk.com/t5/net-forum/error-while-editing-two-solids-with-boolsubtract/m-p/2529508#M69605</link>
      <description>Thank  you very much for your help, this solved my problem.</description>
      <pubDate>Sun, 16 Aug 2009 19:41:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/error-while-editing-two-solids-with-boolsubtract/m-p/2529508#M69605</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-08-16T19:41:19Z</dc:date>
    </item>
  </channel>
</rss>

