Message 1 of 3
Combine Multiple Objects Programmatically
Not applicable
06-01-2017
02:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am using C#, and I am trying to combine several lines and circles into one object programmatically. 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.
// 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"); }