Maybe I’m just blind, but I can’t find a method for creating a truncated cone like this:
The AddCone method always creates a cone to a point, and I’m sure it’s easy enough to chop that point off at a given height, but I thought I’d ask the forum if there is a more elegant way of handling truncated cones.
import Rhino.Geometry as rg
def AddTruncatedCone(plane, height, base_radius, top_radius):
bottom_circle = rg.Circle(plane.Origin, base_radius)
top_circle = rg.Circle(plane.Origin + plane.ZAxis * height, top_radius)
shapeCurve = rg.LineCurve(bottom_circle.PointAt(0), top_circle.PointAt(0))
axis = rg.Line(bottom_circle.Center, top_circle.Center)
revsrf = rg.RevSurface.Create(shapeCurve, axis)
tcone_brep = rg.Brep.CreateFromRevSurface(revsrf, True, True)
a = AddTruncatedCone(Plane, Height, BaseRad, TopRad)
TruncatedCone.gh (7.0 KB)
Thanks. This should be helpful.