Beispiel #1
0
    public static Rhino.Commands.Result Maelstrom(Rhino.RhinoDoc doc)
    {
        ObjectType filter = SpaceMorphObjectFilter();

        Rhino.DocObjects.ObjRef objref;
        Rhino.Commands.Result   rc = Rhino.Input.RhinoGet.GetOneObject("Select object to maelstrom", false, filter, out objref);
        if (rc != Rhino.Commands.Result.Success || objref == null)
        {
            return(rc);
        }

        Rhino.Geometry.Plane plane = doc.Views.ActiveView.ActiveViewport.ConstructionPlane();

        double radius0 = Rhino.RhinoMath.UnsetValue;

        rc = Rhino.Input.RhinoGet.GetNumber("Starting radius", false, ref radius0);
        if (rc != Rhino.Commands.Result.Success || !Rhino.RhinoMath.IsValidDouble(radius0))
        {
            return(rc);
        }

        double radius1 = Rhino.RhinoMath.UnsetValue;

        rc = Rhino.Input.RhinoGet.GetNumber("Ending radius", false, ref radius1);
        if (rc != Rhino.Commands.Result.Success || !Rhino.RhinoMath.IsValidDouble(radius1))
        {
            return(rc);
        }

        double angle = Rhino.RhinoMath.UnsetValue;

        rc = Rhino.Input.RhinoGet.GetNumber("Twist angle in degrees", false, ref angle);
        if (rc != Rhino.Commands.Result.Success || !Rhino.RhinoMath.IsValidDouble(angle))
        {
            return(rc);
        }

        Rhino.Geometry.Morphs.MaelstromSpaceMorph morph = new Rhino.Geometry.Morphs.MaelstromSpaceMorph(plane, radius0, radius1, Rhino.RhinoMath.ToRadians(angle));

        Rhino.Geometry.GeometryBase geom = objref.Geometry().Duplicate();
        if (morph.Morph(geom))
        {
            doc.Objects.Add(geom);
            doc.Views.Redraw();
        }

        return(Rhino.Commands.Result.Success);
    }
    public static Rhino.Commands.Result Maelstrom(Rhino.RhinoDoc doc)
    {
        ObjectType filter = SpaceMorphObjectFilter();
        Rhino.DocObjects.ObjRef objref;
        Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetOneObject("Select object to maelstrom", false, filter, out objref);
        if (rc != Rhino.Commands.Result.Success || objref == null)
          return rc;

        Rhino.Geometry.Plane plane = doc.Views.ActiveView.ActiveViewport.ConstructionPlane();

        double radius0 = Rhino.RhinoMath.UnsetValue;
        rc = Rhino.Input.RhinoGet.GetNumber("Starting radius", false, ref radius0);
        if (rc != Rhino.Commands.Result.Success || !Rhino.RhinoMath.IsValidDouble(radius0))
          return rc;

        double radius1 = Rhino.RhinoMath.UnsetValue;
        rc = Rhino.Input.RhinoGet.GetNumber("Ending radius", false, ref radius1);
        if (rc != Rhino.Commands.Result.Success || !Rhino.RhinoMath.IsValidDouble(radius1))
          return rc;

        double angle = Rhino.RhinoMath.UnsetValue;
        rc = Rhino.Input.RhinoGet.GetNumber("Twist angle in degrees", false, ref angle);
        if (rc != Rhino.Commands.Result.Success || !Rhino.RhinoMath.IsValidDouble(angle))
          return rc;

        Rhino.Geometry.Morphs.MaelstromSpaceMorph morph = new Rhino.Geometry.Morphs.MaelstromSpaceMorph(plane, radius0, radius1, Rhino.RhinoMath.ToRadians(angle));

        Rhino.Geometry.GeometryBase geom = objref.Geometry().Duplicate();
        if (morph.Morph(geom))
        {
          doc.Objects.Add(geom);
          doc.Views.Redraw();
        }

        return Rhino.Commands.Result.Success;
    }