<?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 Combine Multiple Objects Programmatically in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/combine-multiple-objects-programmatically/m-p/7123820#M31186</link>
    <description>&lt;P&gt;I am using C#, and I am trying to combine several lines and circles into one object programmatically. &amp;nbsp;When I run this code, I am able to see that 6 different objects were selected, but when I go to the drawing, they are still all separate.&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;&lt;BR /&gt;            // Get the current document editor
            Editor acDocEd = Application.DocumentManager.MdiActiveDocument.Editor;

            // Create a crossing window from (0,0,0) to (10,10,0) and select all objects within it
            PromptSelectionResult acSSPrompt;
            acSSPrompt = acDocEd.SelectCrossingWindow(new Point3d(0, 0, 0),
                                                      new Point3d(10, 10, 0));



            // If the prompt status is OK, objects were selected
            if (acSSPrompt.Status == PromptStatus.OK)
            {
                SelectionSet acSSet = acSSPrompt.Value;
                //create an object collection
                ObjectIdCollection acObjIdColl = new ObjectIdCollection();
                //combine objects
                foreach (ObjectId acObjId in acSSet.GetObjectIds())
                {
                    // Add each object id to the ObjectIdCollection
                    acObjIdColl.Add(acObjId);
                }

                    Application.ShowAlertDialog("Number of objects selected: " +
                                            acSSet.Count.ToString());
            }
            else
            {
                Application.ShowAlertDialog("Number of objects selected: 0");
            }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Jun 2017 21:42:53 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-06-01T21:42:53Z</dc:date>
    <item>
      <title>Combine Multiple Objects Programmatically</title>
      <link>https://forums.autodesk.com/t5/net-forum/combine-multiple-objects-programmatically/m-p/7123820#M31186</link>
      <description>&lt;P&gt;I am using C#, and I am trying to combine several lines and circles into one object programmatically. &amp;nbsp;When I run this code, I am able to see that 6 different objects were selected, but when I go to the drawing, they are still all separate.&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;&lt;BR /&gt;            // Get the current document editor
            Editor acDocEd = Application.DocumentManager.MdiActiveDocument.Editor;

            // Create a crossing window from (0,0,0) to (10,10,0) and select all objects within it
            PromptSelectionResult acSSPrompt;
            acSSPrompt = acDocEd.SelectCrossingWindow(new Point3d(0, 0, 0),
                                                      new Point3d(10, 10, 0));



            // If the prompt status is OK, objects were selected
            if (acSSPrompt.Status == PromptStatus.OK)
            {
                SelectionSet acSSet = acSSPrompt.Value;
                //create an object collection
                ObjectIdCollection acObjIdColl = new ObjectIdCollection();
                //combine objects
                foreach (ObjectId acObjId in acSSet.GetObjectIds())
                {
                    // Add each object id to the ObjectIdCollection
                    acObjIdColl.Add(acObjId);
                }

                    Application.ShowAlertDialog("Number of objects selected: " +
                                            acSSet.Count.ToString());
            }
            else
            {
                Application.ShowAlertDialog("Number of objects selected: 0");
            }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 21:42:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/combine-multiple-objects-programmatically/m-p/7123820#M31186</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-06-01T21:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: Combine Multiple Objects Programmatically</title>
      <link>https://forums.autodesk.com/t5/net-forum/combine-multiple-objects-programmatically/m-p/7123895#M31187</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;&lt;P&gt;I am using C#, and I am trying to combine several lines and circles into one object programmatically. &amp;nbsp;When I run this code, I am able to see that 6 different objects were selected, but when I go to the drawing, they are still all separate.&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;&lt;BR /&gt;            // Get the current document editor
            Editor acDocEd = Application.DocumentManager.MdiActiveDocument.Editor;

            // Create a crossing window from (0,0,0) to (10,10,0) and select all objects within it
            PromptSelectionResult acSSPrompt;
            acSSPrompt = acDocEd.SelectCrossingWindow(new Point3d(0, 0, 0),
                                                      new Point3d(10, 10, 0));



            // If the prompt status is OK, objects were selected
            if (acSSPrompt.Status == PromptStatus.OK)
            {
                SelectionSet acSSet = acSSPrompt.Value;
                //create an object collection
                ObjectIdCollection acObjIdColl = new ObjectIdCollection();
                //combine objects
                foreach (ObjectId acObjId in acSSet.GetObjectIds())
                {
                    // Add each object id to the ObjectIdCollection
                    acObjIdColl.Add(acObjId);
                }

                    Application.ShowAlertDialog("Number of objects selected: " +
                                            acSSet.Count.ToString());
            }
            else
            {
                Application.ShowAlertDialog("Number of objects selected: 0");
            }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Your code merely adds the ObjectIds of the objects in a selection set to an ObjectIdCollection. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I'm not sure I understand what you mean by '&lt;SPAN&gt;combine several lines and circles into one object&lt;/SPAN&gt;'. You can combine multiple lines, arcs, and polylines that have coincident endpoints into a single polyline (as the JOIN command does), but circles cannot be included in that. &amp;nbsp;You can combine multiple objects to form a REGION (including circles). Or, you can create a BLOCK that contains multiple objects, and then insert it to replace the original objects (which you would erase) and the block insertion would be one object. That's the closest you will get to combining multiple objects into one object.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 22:17:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/combine-multiple-objects-programmatically/m-p/7123895#M31187</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2017-06-01T22:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: Combine Multiple Objects Programmatically</title>
      <link>https://forums.autodesk.com/t5/net-forum/combine-multiple-objects-programmatically/m-p/7123920#M31188</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An ObjectIdCollection is only a kind of list of objectIds (quite close to a List&amp;lt;ObjectId&amp;gt;).&lt;BR /&gt;An ObjectId is simply a container for the address of a database-resident object.&lt;BR /&gt;&lt;BR /&gt;So creating a ObjectIdCollection has absolutely none effect on the drawing entities.&lt;BR /&gt;If you want to group entities, you have to use a &lt;A href="https://forums.autodesk.com/t5/net/groups-in-autocad/m-p/7119893#U7119893" target="_blank"&gt;Group instance&lt;/A&gt; or create a block definition and insert a block reference.&lt;BR /&gt;&lt;BR /&gt;It looks like you do not know much about AutoCAD and in my opinion you cannot pretend programming AutoCAD without knowing some AutoCAD basic practices.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 22:27:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/combine-multiple-objects-programmatically/m-p/7123920#M31188</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2017-06-01T22:27:20Z</dc:date>
    </item>
  </channel>
</rss>

