<?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: EXPLODE command by C# in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/explode-command-by-c/m-p/9810229#M18384</link>
    <description>&lt;P&gt;Thanks for the code correction,&lt;/P&gt;&lt;P&gt;I will check and let you know the status..!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Mon, 19 Oct 2020 08:57:55 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-10-19T08:57:55Z</dc:date>
    <item>
      <title>EXPLODE command by C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/explode-command-by-c/m-p/9774112#M18381</link>
      <description>&lt;P&gt;I have a below code that i have wrote based on the copy command ho i performed.&lt;/P&gt;&lt;P&gt;Please find the below code, Its working until the "getSelection" After that this code it not running.&lt;/P&gt;&lt;P&gt;Could anyone have a good suggestion for this would be appreciated. Please correct me where i am getting wrong.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using System;
 
namespace AutoCAD_Libruary
{
    public class Class1
    {
        [CommandMethod("XPLD", CommandFlags.UsePickSet)]
        public void Commands()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;

            using (Transaction transXPLODE = db.TransactionManager.StartTransaction())
            {
                try
                {
                    BlockTable btXPLODE;
                    btXPLODE = transXPLODE.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
                    BlockTableRecord btrXPLODE;
                    btrXPLODE = transXPLODE.GetObject(btXPLODE[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;

                    object tileMode = Application.GetSystemVariable("TILEMODE");
                    if (System.Convert.ToInt16(tileMode) == 0)

                    {
                        Application.SetSystemVariable("TILEMODE", 1);
                    }

                    PromptSelectionResult psrXplode = ed.GetSelection(); /*SelectWindow(new Point3d(113000, 13000, 0), new Point3d(100000, -500, 0));*/
                    if (psrXplode.Status == PromptStatus.OK)
                    {
                        SelectionSet ssXplode = psrXplode.Value;
                        foreach (SelectedObject sObjXplode in ssXplode)
                        {
                            if (sObjXplode != null)
                            {
                                DBObjectCollection dbOBJcolXplode = new DBObjectCollection();
                                if (dbOBJcolXplode != null)
                                {
                                    foreach (Entity entXplode1 in dbOBJcolXplode)
                                    {
                                        Entity entXplode = transXPLODE.GetObject(sObjXplode.ObjectId, OpenMode.ForRead) as Entity;
                                        entXplode.Explode(dbOBJcolXplode);

                                        if (entXplode != null)
                                        {
                                            foreach (DBObject objDB in dbOBJcolXplode)
                                            {
                                                Entity entXplodeAdd = objDB as Entity;
                                                btrXPLODE.AppendEntity(entXplodeAdd);
                                                transXPLODE.AddNewlyCreatedDBObject(entXplodeAdd, true);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch (System.Exception ex)
                {
                    ed.WriteMessage("Error" + ex.Message);
                    transXPLODE.Abort();
                }
                transXPLODE.Commit();
            }
        }
    }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:44:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/explode-command-by-c/m-p/9774112#M18381</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-29T10:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: EXPLODE command by C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/explode-command-by-c/m-p/9791460#M18382</link>
      <description>&lt;P&gt;Hello @Anonymous !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Great to see you on .NET forum. To get more answers on a question you posted here, don't hesitate to post updates so community members will be notified that you still looking for&amp;nbsp; a solution.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 13:30:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/explode-command-by-c/m-p/9791460#M18382</guid>
      <dc:creator>lena.talkhina</dc:creator>
      <dc:date>2020-10-08T13:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: EXPLODE command by C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/explode-command-by-c/m-p/9809640#M18383</link>
      <description>&lt;P&gt;&amp;nbsp;Hello&lt;/P&gt;&lt;P&gt;I've patched this code a bit, but it's not for production purposes. Treat it as bug fixes that prevent the launch. You still have to learn a lot to get it working properly.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using System;

namespace AutoCAD_Libruary
{
	public class Class1
	{
		[CommandMethod( "XPLD", CommandFlags.UsePickSet )]
		public void Commands()
		{
			Document doc = Application.DocumentManager.MdiActiveDocument;
			Database db = doc.Database;
			Editor ed = doc.Editor;

			using( Transaction transXPLODE = db.TransactionManager.StartTransaction() )
			{
				try
				{
					BlockTable btXPLODE;
					btXPLODE = transXPLODE.GetObject( db.BlockTableId, OpenMode.ForRead ) as BlockTable;
					BlockTableRecord btrXPLODE;
					btrXPLODE = transXPLODE.GetObject( btXPLODE[BlockTableRecord.ModelSpace], OpenMode.ForWrite ) as BlockTableRecord;

					object tileMode = Application.GetSystemVariable( "TILEMODE" );
					if( System.Convert.ToInt16( tileMode ) == 0 )

					{
						Application.SetSystemVariable( "TILEMODE", 1 );
					}

					PromptSelectionResult psrXplode = ed.GetSelection(); /*SelectWindow(new Point3d(113000, 13000, 0), new Point3d(100000, -500, 0));*/
					if( psrXplode.Status == PromptStatus.OK )
					{
						ObjectId[] entColl = psrXplode.Value.GetObjectIds();
						foreach( ObjectId entId in entColl )
						{
							Entity entXplode = transXPLODE.GetObject( entId, OpenMode.ForRead ) as Entity;
							using( DBObjectCollection expObjColl = new DBObjectCollection() )
							{
								entXplode.Explode( expObjColl );

								foreach( DBObject objDB in expObjColl )
								{
									Entity entXplodeAdd = objDB as Entity;
									btrXPLODE.AppendEntity( entXplodeAdd );
									transXPLODE.AddNewlyCreatedDBObject( entXplodeAdd, true );
								}
								if( expObjColl.Count &amp;gt; 0 )
								{
									entXplode.UpgradeOpen();
									entXplode.Erase( true );
								}
							}
						}
					}
					transXPLODE.Commit();
				}
				catch( System.Exception ex )
				{
					ed.WriteMessage( "Error" + ex.Message );
					transXPLODE.Abort();
				}
			}
		}
	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Oct 2020 19:46:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/explode-command-by-c/m-p/9809640#M18383</guid>
      <dc:creator>fsztuczny</dc:creator>
      <dc:date>2020-10-18T19:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: EXPLODE command by C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/explode-command-by-c/m-p/9810229#M18384</link>
      <description>&lt;P&gt;Thanks for the code correction,&lt;/P&gt;&lt;P&gt;I will check and let you know the status..!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 08:57:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/explode-command-by-c/m-p/9810229#M18384</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-19T08:57:55Z</dc:date>
    </item>
  </channel>
</rss>

