CadQuery / cadquery

A python parametric CAD scripting framework based on OCCT
https://cadquery.readthedocs.io
Other
3.26k stars 295 forks source link

STEP export of a swept tube with 90 angles leads to incorrect geometry #1678

Open CasperH2O opened 1 month ago

CasperH2O commented 1 month ago

Hey there, would really like some help with this one, a fix or workaround would be appreciated. When I sweep a tube along a certain polyline path, it shows fine in CQ-Editor and the STL export. However the STEP export is broken. I also tried spline and bezier, those look fine.

Version information: CQ-Editor: 0.3.0dev Python: 3.11 CADquery: 2.4.0

Code to reproduce (I manually export the file from the UI, but a programmatical export is similar):

import cadquery as cq

# Create a circular profile (the inner and outer circles)
diameter_inner = 8
diameter_outer = 10

# Define the points for the spline path
pts = [
    (0, 0, 0),       # Start point
    (0, 15, 0),      
    (0, 15, 15),     
    (0, 25, 15)      
]

# Workplane on the XY plane
circle_profile = (
    cq.Workplane("XZ")
    .circle(diameter_outer / 2)
    .circle(diameter_inner / 2)
)

# Create a path for the sweep
#path = cq.Workplane("XY").spline(pts)
path = cq.Workplane("XY").polyline(pts)
#path = cq.Workplane("XY").bezier(pts)

# Sweep the profile along the path
swept_shape = circle_profile.sweep(path, transition='round')

# Display the results
show_object(circle_profile)
show_object(path)
show_object(swept_shape)

Shows the following in CQ Editor:

image

But a STEP Export leads to this:

image

adam-urbanczyk commented 1 month ago

Confirmed, round-trip in CQ/OCP gives the same result: afbeelding