The selection runs fine but the Gumball does not display after the Redraw. When I turn the Gumball off then back on in the UI the Gumball appears. When I change the layout of the view ports the Gumball appears. When I change the active view in code the Gumball does not appear.
So, it appears the Redraw or view change is only showing the selection of the objects but does not display the Gumball. I must be missing a step so please let me know how I go about making sure the Gumball comes back on after the selection if the user has set it to be on in the UI?
I have been struggling with this trying to understand why the Gumball is not displaying after annotation objects have been selected in code. One of the ways that I have tried to approach it is to create another instance of the Gumball:
var transformObjects = new Rhino.Collections.TransformObjectList();
var selectedObjects = doc.Objects.GetSelectedObjects(false, false).Where(ot => ot.ObjectType == ObjectType.Annotation || ot.ObjectType == ObjectType.Point);
foreach (var a in selectedObjects)
{
transformObjects.Add(a);
}
var boundingBox = transformObjects.GetBoundingBox(true, true);
var baseGumball = new Rhino.UI.Gumball.GumballObject();
baseGumball.SetFromBoundingBox(boundingBox);
var displayConduit = new Rhino.UI.Gumball.GumballDisplayConduit();
var appearanceSettings = new Rhino.UI.Gumball.GumballAppearanceSettings();
///???
displayConduit.SetBaseGumball(baseGumball, appearanceSettings);
displayConduit.Enabled = true;
doc.Views.Redraw();
This does create a Gumball but with the default appearance settings it seams to be unstable. If anybody knows how to set this up or has be better approach it would be appreciated.
If the gumball is turned on - _Gumball _On then it will appears is no Rhino command is running and it one or more objects are selected. There may be other cases where it appears (too).
The GumballObject in RhinoCommon is useful if you want to define your own gumball and it’s behavior. It is not for accessing Rhino’s internal gumball.
Is what I am seeing when selecting objects in code and the Gumball not activating like it would if you selected the objects via the UI a behavior or bug?
I think you confirmed that the UI Gumball can not be accessed and redrawing does not redraw the gumball. Please let me know if this is not the case. Even when I was trying to create a gumball for the selected Items I was able to but the one created by default was a bit wonky. If you have a code fragment that simulates the UI Gumball please point me to it so a can play around with it.
I have to think that I am not the only one in this boat or others have solved it or don’t think the behavior is a big deal.
If possible can you provide me a code sample, that I can run here, that reproduces what you are seeing? This is about the only I’m going to be able to assist.