Exemplo n.º 1
0
    public static Result DrawMesh(RhinoDoc doc)
    {
        var gs = new GetObject();

        gs.SetCommandPrompt("select sphere");
        gs.GeometryFilter = ObjectType.Surface;
        gs.DisablePreSelect();
        gs.SubObjectSelect = false;
        gs.Get();
        if (gs.CommandResult() != Result.Success)
        {
            return(gs.CommandResult());
        }

        Sphere sphere;

        gs.Object(0).Surface().TryGetSphere(out sphere);
        if (sphere.IsValid)
        {
            var mesh = Mesh.CreateFromSphere(sphere, 10, 10);
            if (mesh == null)
            {
                return(Result.Failure);
            }

            var conduit = new DrawBlueMeshConduit(mesh)
            {
                Enabled = true
            };
            doc.Views.Redraw();

            var in_str = "";
            Rhino.Input.RhinoGet.GetString("press <Enter> to continue", true, ref in_str);

            conduit.Enabled = false;
            doc.Views.Redraw();
            return(Result.Success);
        }
        else
        {
            return(Result.Failure);
        }
    }
Exemplo n.º 2
0
    public static Result DrawMesh(RhinoDoc doc)
    {
        var gs = new GetObject();
        gs.SetCommandPrompt("select sphere");
        gs.GeometryFilter = ObjectType.Surface;
        gs.DisablePreSelect();
        gs.SubObjectSelect = false;
        gs.Get();
        if (gs.CommandResult() != Result.Success)
          return gs.CommandResult();

        Sphere sphere;
        gs.Object(0).Surface().TryGetSphere(out sphere);
        if (sphere.IsValid)
        {
          var mesh = Mesh.CreateFromSphere(sphere, 10, 10);
          if (mesh == null)
        return Result.Failure;

          var conduit = new DrawBlueMeshConduit(mesh) {Enabled = true};
          doc.Views.Redraw();

          var in_str = "";
          Rhino.Input.RhinoGet.GetString("press <Enter> to continue", true, ref in_str);

          conduit.Enabled = false;
          doc.Views.Redraw();
          return Result.Success;
        }
        else
          return Result.Failure;
    }