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

        Rhino.Geometry.Line axis;
        rc = Rhino.Input.RhinoGet.GetLine(out axis);
        if (rc != Rhino.Commands.Result.Success || axis == null)
          return rc;

        Rhino.Geometry.Point3d point;
        rc = Rhino.Input.RhinoGet.GetPoint("Point to bend through", false, out point);
        if (rc != Rhino.Commands.Result.Success || !point.IsValid)
          return rc;

        Rhino.Geometry.Morphs.BendSpaceMorph morph = new Rhino.Geometry.Morphs.BendSpaceMorph(axis.From, axis.To, point, true, false);

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

        return Rhino.Commands.Result.Success;
    }
Exemple #2
0
    public static Rhino.Commands.Result Bend(Rhino.RhinoDoc doc)
    {
        ObjectType filter = SpaceMorphObjectFilter();

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

        Rhino.Geometry.Line axis;
        rc = Rhino.Input.RhinoGet.GetLine(out axis);
        if (rc != Rhino.Commands.Result.Success || axis == null)
        {
            return(rc);
        }

        Rhino.Geometry.Point3d point;
        rc = Rhino.Input.RhinoGet.GetPoint("Point to bend through", false, out point);
        if (rc != Rhino.Commands.Result.Success || !point.IsValid)
        {
            return(rc);
        }

        Rhino.Geometry.Morphs.BendSpaceMorph morph = new Rhino.Geometry.Morphs.BendSpaceMorph(axis.From, axis.To, point, true, false);

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

        return(Rhino.Commands.Result.Success);
    }