ellipsoid?

28 views
Skip to first unread message

D Del Vento

unread,
Jan 18, 2025, 5:47:04 PMJan 18
to CadQuery
I'm struggling to make an ellipsoid, i.e. a "squished" sphere.
If it weren't so difficult it is to scale things, I'd just make a sphere and scale it in one direction, but it ought to be a better way which I'm missing?
Thanks!

D Del Vento

unread,
Jan 18, 2025, 5:49:07 PMJan 18
to CadQuery
I also tried revolve, but it looks like I can only revolve about a center *outside* of the revolved shape and for the ellipsoid I obviously want to do that on an *inside* point, so that doesn't work (assuming I'm interpreting correctly the  cryptic BRep_API: command not done error message)

Lorenz

unread,
Jan 18, 2025, 6:38:19 PMJan 18
to CadQuery
Here is a revolve example:

from cadquery.func import *

ellipse1 = face(ellipse(8, 6))
rect1 = face(rect(20, 20)).moved(x=-10)
res = revolve(ellipse1 - rect1, (0, 0, 0), (0, 1, 0), 360)




import cadquery as cq
from cadquery.func import sphere

sphere1 = sphere(1.0)

a_x = 5.0
a_y = 10.0
a_z = 2.0

transform_mat = cq.Matrix(
    [
        [a_x, 0, 0, 0.0],
        [0, a_y, 0, 0.0],
        [0, 0, a_z, 0.0],
    ]
)

ellipsoid1 = sphere1.transformGeometry(transform_mat)

Adam Urbanczyk

unread,
Jan 19, 2025, 4:14:00 AMJan 19
to CadQuery
You need to trim the ellipse first (using cut like above, or trim):

from cadquery.func import *
from math import pi

res = revolve(ellipse(2, 1).trim(0, pi), (0,0,0), (1,0,0), 360)
Reply all
Reply to author
Forward
0 new messages