Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8688

Objects selection via code is much slower than via viewport

$
0
0

@Yuliya wrote:

Hi everyone,

I have a file that contains 2500 surfaces.
When I select those surfaces in viewport - they are selected immediately.

But when I try to select objects via rhinocommon, the selection takes 16-17 seconds.

This seems a bit confusing to me. Here are the methods I tried:

HashSet<Guid> objectIds - collection of object ids to select;

1:
RhinoDoc.ActiveDoc.Objects.Select(objectIds);

2:
foreach (var id in objectIds)
{
       if (RhinoDoc.ActiveDoc.Objects.Find(id) != null)
               RhinoDoc.ActiveDoc.Objects.Select(id, true, true, true, true, true, true);
}

3:
foreach (var id in objectIds)
{
       var obj = RhinoDoc.ActiveDoc.Objects.Find(id);
       if (obj != null)
              obj.Select(true, true, true, true, true, true);
}

4:
var refs = objectIds.Select(item => new ObjRef(item));
RhinoDoc.ActiveDoc.Objects.Select(refs);

Does anyone know why selection via code takes so long? Is there any way to improve the performance?

Here is the file: No Bueno 2 (3).3dm (9.4 MB)

Thanks,
Julia

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 8688

Latest Images

Trending Articles



Latest Images