cadquery
cadquery copied to clipboard
Sweep Path Orientation Issue with Parametric Wave Path
When sweeping a rectangular profile along a parametric wave path, the profile's orientation changes incorrectly as the sweep progresses. This happens regardless of whether isFrenet is set to True or False. The sweep initially aligns with the path correctly but distorts as it continues, making the result inconsistent.
Code Example Below is a minimal, complete example to reproduce the issue. This can be copied and run directly in CQ-Editor:
`import cadquery as cq import math
Parameters for the wave spring
t1 = 0 # Start parameter t2 = 50 # End parameter num_points = 500 # Number of points for smoothness radius = 50 (width, thickness) = (4, 2)
Generate the wave spring path
points = [] delta_t = (t2 - t1) / num_points for i in range(num_points + 1): t = t1 + i * delta_t # Parametric equations for the wave spring x = radius * math.sin(t) y = radius * math.cos(t) z = 7 * math.sin(3.5 * t) + 3 * t points.append((x, y, z))
Create the wave path as a spline
wave_path = cq.Workplane("XY").spline(points)
Define a rectangular profile and sweep along the path
result = ( cq.Workplane("YZ") # Profile aligned to XZ plane .center(radius, 0) # Offset to the radius of the wave spring .rect(width, thickness) # Create a rectangle profile .sweep(wave_path, isFrenet=False) # Sweep along the wave path )`
Observed Behavior The sweep starts with the profile aligned correctly to the path. As the path progresses, the profile's orientation distorts and deviates from the intended alignment.
Expected Behavior The rectangular profile should maintain consistent orientation along the entire wave path, ensuring a uniform sweep.
Screenshots
Sweep with normal=(0,0,1):
Sweep with no normal:
Sweep with a circular profile (for comparison)(best to understand how it changes with the path as the path(black line) goes from outward to inward)