Ellipse by Circumference


#1

Rhino v4

Any way to draw a 1X by 2X ellipse by inputting a value that would equate to a desired circumference?

Thanks


(Wim Dekeyser) #2

Based on Wikipedia it would appear that your desired circumference would approximately be found when you make the major of your 1x2 ellipse to be C/2,422112 where C is the circumference. Please double check :wink:. And note that this does not give you an exact solution.


#3

This draws the ellipse on your current CPlane origin:

Call Main()
Sub Main()

    Dim c, s, strEllipse
        
    c = Rhino.GetReal("Ellipse 1:2 circumference")
    If IsNull(c) Then Exit Sub
    
    If c < Rhino.UnitAbsoluteTolerance() Then Exit Sub
    
    s = c / Sqr(93 + (0.5 * Sqr(3)))
    
    strEllipse = Rhino.AddEllipse(Rhino.ViewCPlane(), 1.0, 2.0)
    Rhino.ScaleObject strEllipse, Array(0, 0, 0), Array(s, s, s)
    
End Sub

c.


#4

Thanks

That works perfectly.


#5

When using the flow command for text it’s really useful to be able to draw a circle [using the] circumference [command] so you can get stuff to fit easily. It’d be really handy if there was an option for this with regard to an ellipse too.

Sometimes a specific shape and size doesn’t need to be exact so being able to use the ellipse by corners command but with a circumference restraint would be really useful.

Is that’s possible?

Andy


#7


#8

I guess yes. Need to find out how to draw it in realtime once the circumference is entered but i am busy atm.

c.


#9

Hi Andy,

you might try this script: EllipseCornerCircumference.py (3.3 KB)

c.


#10

Wow! That’s really powerful, thanks!!

Andy