Class Scene.Selection_
Represents a set of currently selected objects. Can be used to change add/remove objects to selection, to manipulate the selected objects, and to get some additional data about selected objects as a whole.
Inherited Members
Namespace: KD.SDK2
Assembly: KD.SDK2.dll
Syntax
public class Scene.Selection_ : IEnumerable<Scene.Object>, IEnumerable
Remarks
Please be aware that this collection is not cached for enumeration, and you should not try to add/remove objects from the selection while enumerating objects. Otherwise the results are unpredictable. If you need to modify the selection while enumerating, you can make a copy of the collection first. See example below in the text.
IsSelected property, Select(bool) method, Add(Object) method, and Remove(Object) modify this collection.
Examples
The following example shows how to use copied list to remove some objects from selection.
//using System.Collections.Generic;
//using System.Linq
List<Scene.Object> copyOfSelectedObjectsList = scene.Selection.ToList();
foreach (Scene.Object selectedObj in copyOfSelectedObjectsList)
if (selectedObj.CatalogFilename == "@SYSTEM")
scene.Selection.Remove(selectedObj);
// or, shorter, but not so clear to understand
foreach (Scene.Object selectedObj in scene.Selection.ToList())
if (selectedObj.CatalogFilename == "@SYSTEM")
scene.Selection.Remove(selectedObj);</code></pre>
Properties
Name | Description |
---|---|
Count | |
this[int] | Gets an object from the selection by index. |
Methods
Name | Description |
---|---|
Add(Object) | Adds an object to the selection. |
Close() | Sets all the objects in the selection to their closed visual state. |
Delete() | Sets all the selected objects from the scene. |
ExportOutlineImage(string, int, int, int, int, double) | Exports an image showing the outline of the selected objects of the current view. |
ExportPointsImage(string, int, int) | Exports an image showing the selected objects of the current view. |
GetAsString() | Retrieves the global selection status of the current scene as a string. |
GetEnumerator() | Returns an enumerator that iterates through the collection. |
GetOutlineString(int, int, int, int, double) | Gets the polylines composing the outline of the selection. |
GetPointsString(int, int) | Gets the points composing the outline of the selection. |
Hide() | Hides the selected objects from scene views. |
Move(double, double, double, double, double, double, double, double, double, double, double, double, double, bool, bool) | Translates and/or rotates the selected objects. |
Open() | Sets all the objects in the selection to their open visual state. |
PlaceDimensions() | Launches the automatic generation of dimensions for the selected objects. |
Remove(Object) | Removes an object from the selection (which in fact makes it not selected). |
ReplaceWithObject(string, string, HandingType, int, int, int, bool) | Replaces all the selected objects in the scene with newly placed objects from a catalog. |
Reset() | Clears the selection (removes all the objects from it). |
Rotate(double, double, double) | Rotates the selected objects. |
SetFromCollection(IEnumerable<Object>) | Resets selected objects list to a given collection. |
SetFromString(string) | Restores the selection state of the scene from the given string (which should be previously obtained from GetAsString() method). |
Show() | Shows the selected objects on scene views (as opposed to hiding). |