/// <summary> /// Contents of the gumball are copied to the base gumball of this class. /// </summary> /// <param name="gumball">The gumball source.</param> /// <param name="appearanceSettings">The gumball appearance and behavior settings.</param> /// <since>5.0</since> public void SetBaseGumball(GumballObject gumball, GumballAppearanceSettings appearanceSettings) { IntPtr pConstGumball = gumball.ConstPointer(); IntPtr pThis = NonConstPointer(); IntPtr pAppearanceSettings = IntPtr.Zero; if (appearanceSettings != null) { pAppearanceSettings = appearanceSettings.CreatePointer(); } UnsafeNativeMethods.CRhinoGumballDisplayConduit_SetBaseGumball(pThis, pConstGumball, pAppearanceSettings); }
/// <summary> /// Contents of the gumball are copied to the base gumball of this class. /// </summary> /// <param name="gumball">The gumball source.</param> /// <param name="appearanceSettings">The gumball appearance and behavior settings.</param> public void SetBaseGumball(GumballObject gumball, GumballAppearanceSettings appearanceSettings) { IntPtr pConstGumball = gumball.ConstPointer(); IntPtr pThis = NonConstPointer(); IntPtr pAppearanceSettings = IntPtr.Zero; if (appearanceSettings != null) pAppearanceSettings = appearanceSettings.CreatePointer(); UnsafeNativeMethods.CRhinoGumballDisplayConduit_SetBaseGumball(pThis, pConstGumball, pAppearanceSettings); }
/// <summary> /// Contents of the gumball are copied to the base gumball of this class. /// </summary> /// <param name="gumball">The gumball source.</param> public void SetBaseGumball(GumballObject gumball) { SetBaseGumball(gumball, null); }
/// <summary> /// Contents of the gumball are copied to the base gumball of this class. /// </summary> /// <param name="gumball">The gumball source.</param> /// <since>5.0</since> public void SetBaseGumball(GumballObject gumball) { SetBaseGumball(gumball, null); }
public static Rhino.Commands.Result Gumball(RhinoDoc doc) { // Select objects to scale var list = new Rhino.Collections.TransformObjectList(); var rc = SelectObjects("Select objects to gumball", list); if (rc != Rhino.Commands.Result.Success) return rc; var bbox = list.GetBoundingBox(true, true); if (!bbox.IsValid) return Rhino.Commands.Result.Failure; Rhino.Commands.Result cmdrc; var base_gumball = new Rhino.UI.Gumball.GumballObject(); base_gumball.SetFromBoundingBox(bbox); var dc = new Rhino.UI.Gumball.GumballDisplayConduit(); var appearance = new Rhino.UI.Gumball.GumballAppearanceSettings(); // turn off some of the scale appearance settings to have a slightly different gumball appearance.ScaleXEnabled = false; appearance.ScaleYEnabled = false; appearance.ScaleZEnabled = false; bool bCopy = false; while (true) { dc.SetBaseGumball(base_gumball, appearance); dc.Enabled = true; doc.Views.Redraw(); GetGumballXform gp = new GetGumballXform(dc); int copy_optindx = gp.AddOption("Copy"); if (dc.PreTransform == Transform.Identity) gp.SetCommandPrompt("Drag gumball"); else { gp.AcceptNothing(true); gp.SetCommandPrompt("Drag gumball. Press Enter when done"); } gp.AddTransformObjects(list); gp.MoveGumball(); dc.Enabled = false; cmdrc = gp.CommandResult(); if (cmdrc != Rhino.Commands.Result.Success) break; var getpoint_result = gp.Result(); if (getpoint_result == Rhino.Input.GetResult.Point) { if (!dc.InRelocate) { Transform xform = dc.TotalTransform; dc.PreTransform = xform; } // update location of base gumball var gbframe = dc.Gumball.Frame; var baseFrame = base_gumball.Frame; baseFrame.Plane = gbframe.Plane; baseFrame.ScaleGripDistance = gbframe.ScaleGripDistance; base_gumball.Frame = baseFrame; continue; } if (getpoint_result == Rhino.Input.GetResult.Option) { if (gp.OptionIndex() == copy_optindx) bCopy = true; continue; } break; } dc.Enabled = false; if (dc.PreTransform != Transform.Identity) { Transform xform = dc.PreTransform; TransformObjects(list, xform, bCopy, bCopy); } doc.Views.Redraw(); return cmdrc; }