Eyeshot offers a list of methods that allows to programmatically select entities or their sub-items in the scene.
A brief recap of these method follows.
Entities Selection
Visible Selection
A pseudo-color image of the scene is taken into account in order to process the selection.
GetAllEntitiesUnderMouseCursor
Given a point in screen coordinates, it returns all the indexes of the Entities in the scene under this location.Workspace.PickBoxSize
can be used used in order to affect the area to be processed.
When Workspace.AssemblySelectionMode = assemblySelectionType.Leaf
the leaf elements of the scene are retrieved; in such an instance the indexes are organized differently: the Entities in the scene are traversed depth first, for each leaf Entity the index is incremented by one (with the first Entity having a 0 index); when processing a BlockReference of the current scene (i.e. one with no parents) is done, the index is incremented by an additional 1 before stepping to the next Entity in the scene (this doesn't happen for nested BlockReferences and simple Entities). Note that different BlockReferences of the same Block will be processed separately, and their leaf Entities will generate different indexes.
When processing, the value of Workspace.SelectionFilterMode
is ignored.
It is possible to process only the selectable Entities with the selectableOnly
parameter.
GetAllItemsUnderMouseCursor
Given a point in screen coordinates, it returns an array of SelectedItem
under this location.Workspace.PickBoxSize
can be used used in order to affect the area to be processed.
When Workspace.AssemblySelectionMode = assemblySelectionType.Leaf
the leaf elements of the scene are retrieved.
When processing, the value of Workspace.SelectionFilterMode
is used too.
It is possible to process only the selectable Entities with the selectableOnly
parameter.
GetAllVisibileEntities
Given a rectangle in screen coordinates, it returns all the indexes of the visible Entities in the scene that cross it even partially.
When processing, the value of Workspace.AssemblySelectionMode and
Workspace.SelectionFilterMode
are ignored.
It is possible to process only the selectable Entities with the selectableOnly
parameter.
GetAllVisibleItems/GetAllVisibleItemsByPolygon
Given a rectangle in screen coordinates, it returns all the visible Entities that cross it even partially as an array of SelectedItem
.
When Workspace.AssemblySelectionMode = assemblySelectionType.Leaf
the leaf elements of the scene are retrieved.
When processing, the value of Workspace.SelectionFilterMode
is used too.
It is possible to process only the selectable Entities with the selectableOnly
parameter.
The ByPolygon
variant has the same behavior, but you can specify a list of points in order to perform a polygon selection rather than a rectangular one.
GetEntityUnderMouseCursor
Given a point in screen coordinates, it returns the first index of the Entitiy in the scene under this location.Workspace.PickBoxSize
can be used used in order to affect the area to be processed.
When processing, Workspace.AssemblySelectionMode = assemblySelectionType.Leaf
is ignored.
When processing, the value of Workspace.SelectionFilterMode
is ignored.
It is possible to process only the selectable Entities with the selectableOnly
parameter.
GetItemUnderMouseCursor
Given a point in screen coordinates, it returns a single SelectedItem
according to the item under this location.
When Workspace.AssemblySelectionMode = assemblySelectionType.Leaf
the leaf elements of the scene are retrieved.
When processing, the value of Workspace.SelectionFilterMode
is used too.
It is possible to process only the selectable Entities with the selectableOnly
parameter.
Geometric Selection
GetCrossingEntities/GetCrossingEntitiesByPolygon
Given a rectangle in screen coordinates, it returns the visible Entities that cross it even partially as an array of SelectedItem
and it also retrieves an array of indexes of these Entities in the scene as an out parameter.
The actual geometry of the scene is taken into account in order to process the crossing with the given rectangle.
When Workspace.AssemblySelectionMode = assemblySelectionType.Leaf
the leaf elements of the scene are retrieved; in such situation, no index is retrieved by the method.
When processing, the value of Workspace.SelectionFilterMode
is ignored.
It is possible to process only the selectable Entities with the selectableOnly
parameter.
It is also possible to stop the processing when the first entity is found by using the firstOnly
parameter.
The ByPolygon
variant has the same behavior, but you can specify a list of points in order to perform a polygon selection rather than a rectangular one.
GetEnclosedEntities/GetEnclosedEntitiesByPolygon
Given a rectangle in screen coordinates, it returns all the visible Entities that are fully contained in it as an array of SelectedItem
and it also retrieves an array of indexes of these Entities in the scene as an out parameter.
The actual geometry of the scene is taken into account in order to process the enclosure in the given rectangle.
When Workspace.AssemblySelectionMode = assemblySelectionType.Leaf
the leaf elements of the scene are retrieved; in such situation, no index is retrieved by the method.
When processing, the value of Workspace.SelectionFilterMode
is ignored.
It is possible to process only the selectable Entities with the selectableOnly
parameter.
The ByPolygon
variant has the same behavior, but you can specify a list of points in order to perform a polygon selection rather than a rectangular one.
Label Selection
GetAllLabelsUnderMouseCursor
Given a point in screen coordinates, it returns all the indexes of the visible Labels in the scene under this location.Workspace.PickBoxSize
can be used used in order to affect the area to be processed.
When processing, the value of Workspace.AssemblySelectionMode and
Workspace.SelectionFilterMode
are ignored (they have no meaning for Labels).
It is possible to process only the selectable Labels with the selectableOnly
parameter.
GetAllVisibleLabels
Given a rectangle in screen coordinates, it returns all the indexes of the visible Labels in the scene under this location.
When processing, the value of Workspace.AssemblySelectionMode and
Workspace.SelectionFilterMode
are ignored (they have no meaning for Labels).
It is possible to process only the selectable Labels with the selectableOnly
parameter.
GetLabelUnderMouseCursor
Given a point in screen coordinates, it returns the index of the first visible Label in the scene under this location.Workspace.PickBoxSize
can be used used in order to affect the area to be processed.
When processing, the value of Workspace.AssemblySelectionMode and
Workspace.SelectionFilterMode
are ignored (they have no meaning for Labels).
It is possible to process only the selectable Labels with the selectableOnly
parameter.
Comments
Hi all,
A call to GetAllCrossingEntities(aRectangle) within a revision prior to 2024 on a workspace "filtered" with IsolateInstances() did exactly what expected: entities around the specific position were visible inside the code.
Using the new version, 2024.2.342, this is no longer possible. I called the new method GetCrossingEntities(rect, false, out int[] entIndexes, false): it runs correctly in a normal behaivor, but not into an "isolated" one. Is there a reason?
Thank you
Andrea
Hi Andrea,
From build 2024.2 onwards, only currently isolated instances are selectable, and non-active entities are not selectable. If you encounter a different issue, please open a support ticket and include a small sample to reproduce the problem. Thank you.
Please sign in to leave a comment.