-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sweep Path Orientation Issue with Parametric Wave Path #1723
Comments
Same situation I think, sweeping a wire profile along a spline wave does not work properly (or as expected). import cadquery as cq support = cq.Workplane("XY").rect(50, 100).offset2D(5) ref0 = cq.Vector(nodes[0].y , nodes[0].z) profile = cq.Workplane("YZ", origin=(nodes[0].x,0,0)).polyline(points).consolidateWires() show_object(sweptPlane) |
@adam-urbanczyk could this be a potential limitation of the library, at its current stage? |
If you don't like the generated orientation you can always use an aux spine to define one explicitly. |
Did using an aux spine fix your issue @HTeyssedre? because I'm still facing similar problems. |
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 toTrue
orFalse
. 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)
The text was updated successfully, but these errors were encountered: