public static Rhino.Commands.Result AddCylinder(Rhino.RhinoDoc doc)
 {
     Rhino.Geometry.Point3d center_point = new Rhino.Geometry.Point3d(0, 0, 0);
     Rhino.Geometry.Point3d height_point = new Rhino.Geometry.Point3d(0, 0, 10);
     Rhino.Geometry.Vector3d zaxis = height_point - center_point;
     Rhino.Geometry.Plane plane = new Rhino.Geometry.Plane(center_point, zaxis);
     const double radius = 5;
     Rhino.Geometry.Circle circle = new Rhino.Geometry.Circle(plane, radius);
     Rhino.Geometry.Cylinder cylinder = new Rhino.Geometry.Cylinder(circle, zaxis.Length);
     Rhino.Geometry.Brep brep = cylinder.ToBrep(true, true);
     if (brep != null)
     {
       doc.Objects.AddBrep(brep);
       doc.Views.Redraw();
     }
     return Rhino.Commands.Result.Success;
 }
示例#2
0
    public static Rhino.Commands.Result AddCylinder(Rhino.RhinoDoc doc)
    {
        Rhino.Geometry.Point3d  center_point = new Rhino.Geometry.Point3d(0, 0, 0);
        Rhino.Geometry.Point3d  height_point = new Rhino.Geometry.Point3d(0, 0, 10);
        Rhino.Geometry.Vector3d zaxis        = height_point - center_point;
        Rhino.Geometry.Plane    plane        = new Rhino.Geometry.Plane(center_point, zaxis);
        const double            radius       = 5;

        Rhino.Geometry.Circle   circle   = new Rhino.Geometry.Circle(plane, radius);
        Rhino.Geometry.Cylinder cylinder = new Rhino.Geometry.Cylinder(circle, zaxis.Length);
        Rhino.Geometry.Brep     brep     = cylinder.ToBrep(true, true);
        if (brep != null)
        {
            doc.Objects.AddBrep(brep);
            doc.Views.Redraw();
        }
        return(Rhino.Commands.Result.Success);
    }
示例#3
0
        bool CreateHole(out Rhino.Geometry.Brep outBrep)
        {
            outBrep = null;

            // Make sure the "hole" goes completely through the solid so
            // the Boolean operation will succeed.

            Rhino.Geometry.Point3d origin = new Rhino.Geometry.Point3d(0.0, 0.0, -1.0);
            Rhino.Geometry.Circle  circle = new Rhino.Geometry.Circle(origin, 4.0);

            Rhino.Geometry.Cylinder cylinder = new Rhino.Geometry.Cylinder(circle, 12.0);
            Rhino.Geometry.Brep     brep     = cylinder.ToBrep(true, true);

            bool rc = brep.IsValid;

            if (rc)
            {
                outBrep = brep;
            }

            return(rc);
        }