<?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  Explode  DimStyle  with .Net in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-explode-dimstyle-with-net/m-p/12213648#M7489</link>
    <description>&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE&gt;&lt;FONT color="#1000a0"&gt;public&lt;/FONT&gt; &lt;FONT color="#1000a0"&gt;abstract&lt;/FONT&gt; &lt;FONT color="#1000a0"&gt;class&lt;/FONT&gt; &lt;STRONG&gt;&lt;A href="http://127.0.0.1/roeder/dotnet/Default.aspx?Target=code://Acdbmgd:24.3.0.0/Autodesk.AutoCAD.DatabaseServices.Dimension"&gt;Dimension&lt;/A&gt;&lt;/STRONG&gt; : &lt;A title="" href="http://127.0.0.1/roeder/dotnet/Default.aspx?Target=code://Acdbmgd:24.3.0.0/Autodesk.AutoCAD.DatabaseServices.Entity"&gt;Entity&lt;/A&gt;
&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;10 Dimension types are derived from Dimension.&lt;BR /&gt;&lt;BR /&gt;Entity is explodable&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE&gt;&lt;FONT color="#1000a0"&gt;public&lt;/FONT&gt; &lt;A title="" href="http://127.0.0.1/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.Void"&gt;void&lt;/A&gt; &lt;STRONG&gt;&lt;A href="http://127.0.0.1/roeder/dotnet/Default.aspx?Target=code://Acdbmgd:24.3.0.0/Autodesk.AutoCAD.DatabaseServices.Entity/Explode(Autodesk.AutoCAD.DatabaseServices.DBObjectCollection)"&gt;Explode&lt;/A&gt;&lt;/STRONG&gt;(&lt;A title="" href="http://127.0.0.1/roeder/dotnet/Default.aspx?Target=code://Acdbmgd:24.3.0.0/Autodesk.AutoCAD.DatabaseServices.DBObjectCollection"&gt;DBObjectCollection&lt;/A&gt; &lt;SPAN class=""&gt;entitySet&lt;/SPAN&gt;)
{ }&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Have you tried Explode ??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I haven't tried it, but you should . . . because someone will ask for sure &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
    <pubDate>Sat, 02 Sep 2023 10:14:22 GMT</pubDate>
    <dc:creator>kerry_w_brown</dc:creator>
    <dc:date>2023-09-02T10:14:22Z</dc:date>
    <item>
      <title>How to  Explode  DimStyle  with .Net</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-explode-dimstyle-with-net/m-p/12213503#M7488</link>
      <description>&lt;P&gt;I'm trying to make software that uses .NET(c#) to explode dimension objects only.&lt;/P&gt;&lt;P&gt;&amp;nbsp;but I can't think of a good idea.&lt;/P&gt;&lt;P&gt;Is there anyone help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Sep 2023 07:05:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-explode-dimstyle-with-net/m-p/12213503#M7488</guid>
      <dc:creator>ootsuka109</dc:creator>
      <dc:date>2023-09-02T07:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to  Explode  DimStyle  with .Net</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-explode-dimstyle-with-net/m-p/12213648#M7489</link>
      <description>&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE&gt;&lt;FONT color="#1000a0"&gt;public&lt;/FONT&gt; &lt;FONT color="#1000a0"&gt;abstract&lt;/FONT&gt; &lt;FONT color="#1000a0"&gt;class&lt;/FONT&gt; &lt;STRONG&gt;&lt;A href="http://127.0.0.1/roeder/dotnet/Default.aspx?Target=code://Acdbmgd:24.3.0.0/Autodesk.AutoCAD.DatabaseServices.Dimension"&gt;Dimension&lt;/A&gt;&lt;/STRONG&gt; : &lt;A title="" href="http://127.0.0.1/roeder/dotnet/Default.aspx?Target=code://Acdbmgd:24.3.0.0/Autodesk.AutoCAD.DatabaseServices.Entity"&gt;Entity&lt;/A&gt;
&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;10 Dimension types are derived from Dimension.&lt;BR /&gt;&lt;BR /&gt;Entity is explodable&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE&gt;&lt;FONT color="#1000a0"&gt;public&lt;/FONT&gt; &lt;A title="" href="http://127.0.0.1/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.Void"&gt;void&lt;/A&gt; &lt;STRONG&gt;&lt;A href="http://127.0.0.1/roeder/dotnet/Default.aspx?Target=code://Acdbmgd:24.3.0.0/Autodesk.AutoCAD.DatabaseServices.Entity/Explode(Autodesk.AutoCAD.DatabaseServices.DBObjectCollection)"&gt;Explode&lt;/A&gt;&lt;/STRONG&gt;(&lt;A title="" href="http://127.0.0.1/roeder/dotnet/Default.aspx?Target=code://Acdbmgd:24.3.0.0/Autodesk.AutoCAD.DatabaseServices.DBObjectCollection"&gt;DBObjectCollection&lt;/A&gt; &lt;SPAN class=""&gt;entitySet&lt;/SPAN&gt;)
{ }&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Have you tried Explode ??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I haven't tried it, but you should . . . because someone will ask for sure &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Sat, 02 Sep 2023 10:14:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-explode-dimstyle-with-net/m-p/12213648#M7489</guid>
      <dc:creator>kerry_w_brown</dc:creator>
      <dc:date>2023-09-02T10:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to  Explode  DimStyle  with .Net</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-explode-dimstyle-with-net/m-p/12213696#M7490</link>
      <description>&lt;P&gt;This is worth a read.&lt;BR /&gt;&lt;A href="https://www.keanw.com/2011/02/exploding-autocad-objects-using-net.html" target="_blank"&gt;https://www.keanw.com/2011/02/exploding-autocad-objects-using-net.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Sep 2023 11:03:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-explode-dimstyle-with-net/m-p/12213696#M7490</guid>
      <dc:creator>kerry_w_brown</dc:creator>
      <dc:date>2023-09-02T11:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to  Explode  DimStyle  with .Net</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-explode-dimstyle-with-net/m-p/12214387#M7492</link>
      <description>&lt;P&gt;Perhaps have a play with this.&lt;/P&gt;&lt;P&gt;The&amp;nbsp;&lt;EM&gt;PromptEntityOptions &lt;/EM&gt;will select anything &lt;STRONG&gt;derived from &lt;EM&gt;Dimension&lt;/EM&gt;.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Will be fairly simple to modify if you want to select multiple objects at one time.&lt;BR /&gt;&lt;BR /&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;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;[CommandMethod("EXPDim")]

public void ExplodeDimensions()
{
   Document doc = CadApp.DocumentManager.MdiActiveDocument;
   Database db = doc.Database;
   Editor ed = doc.Editor;

   RXClass rxClass = RXObject.GetClass(typeof(Dimension));
   DBObjectCollection explodedObjects = new DBObjectCollection();

   PromptEntityOptions peo = new PromptEntityOptions(
      "\nSelect a dimension to explode : ");
   peo.SetRejectMessage($"Selected object is not an {rxClass.Name}");
   peo.AddAllowedClass(typeof(Dimension), exactMatch: false);

   bool finished = false;

   while (!finished)
   {
      PromptEntityResult result = ed.GetEntity(peo);

      if (result.Status != PromptStatus.OK)
      {
         finished = true;
         return;
      }
      using (var tr = db.TransactionManager.StartOpenCloseTransaction())
      {
         explodedObjects.Clear();

         Entity ent = (Entity)tr.GetObject(
            result.ObjectId, 
            OpenMode.ForRead);

         ent.Explode(explodedObjects);

         // optional (EraseOriginal(ed))
         // 
         if (explodedObjects.Count &amp;gt; 0 ) 
         {
            ent.UpgradeOpen();
            ent.Erase();
         }

         BlockTableRecord btr = (BlockTableRecord)tr.GetObject(
            db.CurrentSpaceId,
            OpenMode.ForWrite);

         foreach (DBObject obj in explodedObjects)
         {
            Entity explodedEntity = (Entity)obj;
            if(explodedEntity is MText) 
            { 
               // just for giggles, to visually identify dimensions processed.
               explodedEntity.ColorIndex = 211;
            }

            btr.AppendEntity(explodedEntity);
            tr.AddNewlyCreatedDBObject(explodedEntity, true);
         }
         tr.Commit();
      }
   }
}

internal bool EraseOriginal(Editor ed)
{
   PromptKeywordOptions pko = new PromptKeywordOptions("\nErase original objects?")
   {
      AllowNone = true
   };
   pko.Keywords.Add("Yes");
   pko.Keywords.Add("No");
   pko.Keywords.Default = "Yes";

   PromptResult pkr = ed.GetKeywords(pko);
   if (pkr.Status != PromptStatus.OK) return false;

   return (pkr.StringResult == "Yes");
}&lt;/LI-CODE&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;modified note 20230904:&lt;/P&gt;&lt;P&gt;changed variable name&amp;nbsp;@Anonymous to rxClass because the post software here didn't display&amp;nbsp;@Anonymous.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This routine has had minimal testing, so review the code and test.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 02:57:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-explode-dimstyle-with-net/m-p/12214387#M7492</guid>
      <dc:creator>kerry_w_brown</dc:creator>
      <dc:date>2023-09-04T02:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to  Explode  DimStyle  with .Net</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-explode-dimstyle-with-net/m-p/12216205#M7493</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank you&amp;nbsp; for your help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;According your adivise , I could make a code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm sorry for not being able to convey my thanks properly because I'm not good at English.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 09:17:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-explode-dimstyle-with-net/m-p/12216205#M7493</guid>
      <dc:creator>ootsuka109</dc:creator>
      <dc:date>2023-09-04T09:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to  Explode  DimStyle  with .Net</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-explode-dimstyle-with-net/m-p/12218168#M7494</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pleased I could help . . and I learnt something new, so we're both happy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 07:32:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-explode-dimstyle-with-net/m-p/12218168#M7494</guid>
      <dc:creator>kerry_w_brown</dc:creator>
      <dc:date>2023-09-05T07:32:08Z</dc:date>
    </item>
  </channel>
</rss>

