コード例 #1
0
 internal IntPtr NonConstPointer()
 {
     if (m_parent != null)
     {
         IntPtr pConstThis = ConstPointer();
         m_ptr_gumball = UnsafeNativeMethods.CRhinoGumball_New(pConstThis);
         if (m_parent.m_base_gumball == this)
         {
             m_parent.m_base_gumball = null;
         }
         m_parent = null;
     }
     return(m_ptr_gumball);
 }
コード例 #2
0
 internal IntPtr NonConstPointer()
 {
   if (m_parent != null)
   {
     IntPtr pConstThis = ConstPointer();
     m_ptr_gumball = UnsafeNativeMethods.CRhinoGumball_New(pConstThis);
     if (m_parent.m_base_gumball == this)
       m_parent.m_base_gumball = null;
     m_parent = null;
   }
   return m_ptr_gumball;
 }
コード例 #3
0
 internal GumballPickResult(GumballDisplayConduit parent)
 {
   m_parent = parent;
 }
コード例 #4
0
 internal GumballObject(GumballDisplayConduit parent, bool baseGumball)
 {
   m_parent = parent;
   m_base_gumball = baseGumball;
   m_ptr_gumball = IntPtr.Zero;
 }
コード例 #5
0
 internal GumballPickResult(GumballDisplayConduit parent)
 {
     m_parent = parent;
 }
コード例 #6
0
 internal GumballObject(GumballDisplayConduit parent, bool baseGumball)
 {
     m_parent       = parent;
     m_base_gumball = baseGumball;
     m_ptr_gumball  = IntPtr.Zero;
 }
コード例 #7
0
    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;
    }
コード例 #8
0
 public GetGumballXform(Rhino.UI.Gumball.GumballDisplayConduit dc)
 {
     m_dc = dc;
 }