///<summary> This gets called when when the user runs this command.</summary>
        public override IRhinoCommand.result RunCommand(IRhinoCommandContext context)
        {
            MRhinoGetObject go = new MRhinoGetObject();
              go.SetCommandPrompt("Select mesh");
              go.SetGeometryFilter(IRhinoGetObject.GEOMETRY_TYPE_FILTER.mesh_object);
              go.GetObjects(1, 1);
              if (go.CommandResult() != IRhinoCommand.result.success)
            return go.CommandResult();

              IRhinoMeshObject mesh_object = MRhinoMeshObject.ConstCast(go.Object(0).Object());
              if (null == mesh_object)
            return IRhinoCommand.result.failure;

              SampleCsColoredMeshConduit conduit = new SampleCsColoredMeshConduit(mesh_object.m_runtime_object_serial_number);
              conduit.Enable();
              context.m_doc.Regen();

              MRhinoGetString gs = new MRhinoGetString();
              gs.SetCommandPrompt("Press <Enter> to continue");
              gs.AcceptNothing();
              gs.GetString();

              conduit.Disable();
              context.m_doc.Regen();

              return IRhinoCommand.result.success;
        }
Beispiel #2
0
        ///<summary> This gets called when when the user runs this command.</summary>
        public override IRhinoCommand.result RunCommand(IRhinoCommandContext context)
        {
            MArgsRhinoGetCircle args   = new MArgsRhinoGetCircle();
            OnCircle            circle = new OnCircle();

            IRhinoCommand.result rc = RhUtil.RhinoGetCircle(args, ref circle);
            if (rc != IRhinoCommand.result.success)
            {
                return(rc);
            }

            SampleCsDrawCircleConduit conduit = new SampleCsDrawCircleConduit(circle);

            conduit.Enable();
            context.m_doc.Redraw();

            MRhinoGetString gs = new MRhinoGetString();

            gs.SetCommandPrompt("Press <Enter> to continue");
            gs.AcceptNothing();
            gs.GetString();

            conduit.Disable();
            context.m_doc.Redraw();

            return(IRhinoCommand.result.success);
        }
        ///<summary> This gets called when when the user runs this command.</summary>
        public override IRhinoCommand.result RunCommand(IRhinoCommandContext context)
        {
            MRhinoGetObject go = new MRhinoGetObject();

            go.SetCommandPrompt("Select mesh");
            go.SetGeometryFilter(IRhinoGetObject.GEOMETRY_TYPE_FILTER.mesh_object);
            go.GetObjects(1, 1);
            if (go.CommandResult() != IRhinoCommand.result.success)
            {
                return(go.CommandResult());
            }

            IRhinoMeshObject mesh_object = MRhinoMeshObject.ConstCast(go.Object(0).Object());

            if (null == mesh_object)
            {
                return(IRhinoCommand.result.failure);
            }

            SampleCsColoredMeshConduit conduit = new SampleCsColoredMeshConduit(mesh_object.m_runtime_object_serial_number);

            conduit.Enable();
            context.m_doc.Regen();

            MRhinoGetString gs = new MRhinoGetString();

            gs.SetCommandPrompt("Press <Enter> to continue");
            gs.AcceptNothing();
            gs.GetString();

            conduit.Disable();
            context.m_doc.Regen();

            return(IRhinoCommand.result.success);
        }
        ///<summary> This gets called when when the user runs this command.</summary>
        public override IRhinoCommand.result RunCommand(IRhinoCommandContext context)
        {
            OnLine  line  = new OnLine();
            OnPlane plane = new OnPlane();

            MRhinoGetPoint gp = new MRhinoGetPoint();

            gp.SetCommandPrompt("Start of line");
            gp.GetPoint();
            if (gp.CommandResult() != IRhinoCommand.result.success)
            {
                return(gp.CommandResult());
            }

            line.from = gp.Point();
            plane     = new OnPlane(RhUtil.RhinoActiveCPlane());
            plane.SetOrigin(line.from);

            gp.SetCommandPrompt("End of line");
            gp.Constrain(plane);
            gp.SetBasePoint(line.from);
            gp.DrawLineFromPoint(line.from, true);
            gp.GetPoint();
            if (gp.CommandResult() != IRhinoCommand.result.success)
            {
                return(gp.CommandResult());
            }

            line.to = plane.ClosestPointTo(gp.Point());
            if (!line.IsValid())
            {
                return(IRhinoCommand.result.nothing);
            }

            SampleCsDrawArrowheadConduit conduit = new SampleCsDrawArrowheadConduit(plane, line, 1.0);

            conduit.Enable();
            context.m_doc.Redraw();

            MRhinoGetString gs = new MRhinoGetString();

            gs.SetCommandPrompt("Press <Enter> to continue");
            gs.AcceptNothing();
            gs.GetString();

            conduit.Disable();
            context.m_doc.Redraw();

            return(IRhinoCommand.result.success);
        }
        ///<summary> This gets called when when the user runs this command.</summary>
        public override IRhinoCommand.result RunCommand(IRhinoCommandContext context)
        {
            On3dPoint center = new On3dPoint(OnUtil.On_origin);
              OnSphere sphere = new OnSphere(center, 5.0);
              OnMesh mesh = RhUtil.RhinoMeshSphere(sphere, 10, 10);
              MRhinoMeshObject mesh_obj = context.m_doc.AddMeshObject(mesh);
              context.m_doc.Redraw();

              MRhinoGetString gs = new MRhinoGetString();
              gs.SetCommandPrompt("Press <Enter> to continue");
              gs.AcceptNothing();
              gs.GetString();

              context.m_doc.DeleteObject(new MRhinoObjRef(mesh_obj));
              context.m_doc.Redraw();

              return IRhinoCommand.result.success;
        }
Beispiel #6
0
        ///<summary> This gets called when when the user runs this command.</summary>
        public override IRhinoCommand.result RunCommand(IRhinoCommandContext context)
        {
            On3dPoint        center   = new On3dPoint(OnUtil.On_origin);
            OnSphere         sphere   = new OnSphere(center, 5.0);
            OnMesh           mesh     = RhUtil.RhinoMeshSphere(sphere, 10, 10);
            MRhinoMeshObject mesh_obj = context.m_doc.AddMeshObject(mesh);

            context.m_doc.Redraw();

            MRhinoGetString gs = new MRhinoGetString();

            gs.SetCommandPrompt("Press <Enter> to continue");
            gs.AcceptNothing();
            gs.GetString();

            context.m_doc.DeleteObject(new MRhinoObjRef(mesh_obj));
            context.m_doc.Redraw();

            return(IRhinoCommand.result.success);
        }
        ///<summary> This gets called when when the user runs this command.</summary>
        public override IRhinoCommand.result RunCommand(IRhinoCommandContext context)
        {
            OnLine line = new OnLine();
              OnPlane plane = new OnPlane();

              MRhinoGetPoint gp = new MRhinoGetPoint();
              gp.SetCommandPrompt("Start of line");
              gp.GetPoint();
              if (gp.CommandResult() != IRhinoCommand.result.success)
            return gp.CommandResult();

              line.from = gp.Point();
              plane = new OnPlane(RhUtil.RhinoActiveCPlane());
              plane.SetOrigin(line.from);

              gp.SetCommandPrompt("End of line");
              gp.Constrain(plane);
              gp.SetBasePoint(line.from);
              gp.DrawLineFromPoint(line.from, true);
              gp.GetPoint();
              if (gp.CommandResult() != IRhinoCommand.result.success)
            return gp.CommandResult();

              line.to = plane.ClosestPointTo(gp.Point());
              if (!line.IsValid())
            return IRhinoCommand.result.nothing;

              SampleCsDrawArrowheadConduit conduit = new SampleCsDrawArrowheadConduit(plane, line, 1.0);
              conduit.Enable();
              context.m_doc.Redraw();

              MRhinoGetString gs = new MRhinoGetString();
              gs.SetCommandPrompt("Press <Enter> to continue");
              gs.AcceptNothing();
              gs.GetString();

              conduit.Disable();
              context.m_doc.Redraw();

              return IRhinoCommand.result.success;
        }
        ///<summary> This gets called when when the user runs this command.</summary>
        public override IRhinoCommand.result RunCommand(IRhinoCommandContext context)
        {
            MArgsRhinoGetCircle args = new MArgsRhinoGetCircle();
              OnCircle circle = new OnCircle();
              IRhinoCommand.result rc = RhUtil.RhinoGetCircle(args, ref circle);
              if (rc != IRhinoCommand.result.success)
            return rc;

              SampleCsDrawCircleConduit conduit = new SampleCsDrawCircleConduit(circle);
              conduit.Enable();
              context.m_doc.Redraw();

              MRhinoGetString gs = new MRhinoGetString();
              gs.SetCommandPrompt("Press <Enter> to continue");
              gs.AcceptNothing();
              gs.GetString();

              conduit.Disable();
              context.m_doc.Redraw();

              return IRhinoCommand.result.success;
        }