u/Exact-Yesterday-992

import cadquery as cq

# 1. Create your sphere

result = cq.Workplane("XY").sphere(10)

# 2. Define the scale factors

sx, sy, sz = 1.5, 0.75, 2.0

# 3. Create the 4x4 Matrix

# Note: CadQuery Matrix takes a 16-element flat list or tuple of tuples

mat = cq.Matrix([

(sx, 0, 0, 0),

(0, sy, 0, 0),

(0, 0, sz, 0),

(0, 0, 0, 1)

])

# 4. Use transformGeometry instead of transformShape

# transformGeometry handles non-isometric transformations (non-uniform scaling)

scaled_shape = result.val().transformGeometry(mat)

# 5. Wrap back into Workplane

final_ellipsoid = cq.Workplane("XY").add(scaled_shape)

show_object(final_ellipsoid)

reddit.com
u/Exact-Yesterday-992 — 12 days ago