SelLast command and adding geometry to Rhino document

Hi @piac,

Whenever a geometry is added to Rhino document from ghpython component, “SelLast” command fails to catch it the first time it is ran. It just outputs: “SelLast selection set is empty.”
It gets caught only when “SelLast” command has been ran the second time.

What is causing this? I perfectly understand that ghpython targets Grasshopper document, however the fact that we can also add geometry to Rhino document, would mean that we should be able to select it with SelLast first call. Or am I wrong?

The issue does not exist with Rhino Python Editor, only with ghpython component on both Rhino 5 and Rhino 6, regardless of the fact if we switch from Grasshopper to Rhino document or not (sc.doc = Rhino.RhinoDoc.ActiveDoc, sc.doc = ghdoc)
Here is a short example.
Any help would be appreciated.

import rhinoscriptsyntax as rs
import Rhino

sph = Rhino.Geometry.Sphere(Rhino.Geometry.Point3d(0,0,0), 5)
id = Rhino.RhinoDoc.ActiveDoc.Objects.AddSphere(sph) 

I don’t know how _SelLast is implemented. Features like this one (I am really thinking of _Undo) usually use some knowledge derived from the state of the command that is running, so this might be the cause. @dale or @lowell might be able to tell more.

I filed this under RH-54558.

@djordje, just for clarity for the next person reading this: do you call the _SelLast command from GhPython itself or from the command line?

Hi @piac,
Thank you for the youtrack.
I call SelLast from the Rhino command line.

Hi @dale, @lowell, @stevebaer,
Is there any chance the bug fix can be implemented in Rhino 6?

@dale, @lowell, @stevebaer
I have just tested Rhino 7 beta ( version 7.0.20301.12003, 10/27/2020) and the issue is still present.
Is there a hope it will be fixed with the first release of Rhino 7?

Hi -

Coming in from the side, but, FWIW, the list for 7.0 is “closed” at this point and, given that this is on the Future list, I’d say that there is no chance of that happening, no.