LineCurve Constructor (Point3d, Point3d) |
Namespace: Rhino.Geometry
using System; using Rhino.Geometry; partial class Examples { public static Rhino.Commands.Result AddTruncatedCone(Rhino.RhinoDoc doc) { Point3d bottom_pt = new Point3d(0,0,0); const double bottom_radius = 2; Circle bottom_circle = new Circle(bottom_pt, bottom_radius); Point3d top_pt = new Point3d(0,0,10); const double top_radius = 6; Circle top_circle = new Circle(top_pt, top_radius); LineCurve shapeCurve = new LineCurve(bottom_circle.PointAt(0), top_circle.PointAt(0)); Line axis = new Line(bottom_circle.Center, top_circle.Center); RevSurface revsrf = RevSurface.Create(shapeCurve, axis); Brep tcone_brep = Brep.CreateFromRevSurface(revsrf, true, true); if( doc.Objects.AddBrep(tcone_brep) != Guid.Empty ) { doc.Views.Redraw(); return Rhino.Commands.Result.Success; } return Rhino.Commands.Result.Failure; } }
import Rhino import scriptcontext import System.Guid def AddTruncatedCone(): bottom_pt = Rhino.Geometry.Point3d(0,0,0) bottom_radius = 2 bottom_circle = Rhino.Geometry.Circle(bottom_pt, bottom_radius) top_pt = Rhino.Geometry.Point3d(0,0,10) top_radius = 6 top_circle = Rhino.Geometry.Circle(top_pt, top_radius) shapeCurve = Rhino.Geometry.LineCurve(bottom_circle.PointAt(0), top_circle.PointAt(0)) axis = Rhino.Geometry.Line(bottom_circle.Center, top_circle.Center) revsrf = Rhino.Geometry.RevSurface.Create(shapeCurve, axis) tcone_brep = Rhino.Geometry.Brep.CreateFromRevSurface(revsrf, True, True) if scriptcontext.doc.Objects.AddBrep(tcone_brep)!=System.Guid.Empty: scriptcontext.doc.Views.Redraw() return Rhino.Commands.Result.Success return Rhino.Commands.Result.Failure if __name__=="__main__": AddTruncatedCone()