gumyr / build123d

A python CAD programming library
Apache License 2.0
512 stars 86 forks source link

sweep over CenterArc does not behave as expected #215

Closed OvisMaximus closed 1 year ago

OvisMaximus commented 1 year ago

Given the following code

from build123d import *

ring_diameter = 110

with BuildPart(Plane.XZ) as part_builder:
    with BuildLine(Plane.XY) as sweep_path:
        a_clamp_width = 12
        CenterArc((-ring_diameter/2, 0), ring_diameter / 2, -a_clamp_width / 2, a_clamp_width)
        #Line((0, -5), (0, 5))

    with BuildSketch(Plane.XZ) as sketch_builder:
        Rectangle(4.0, 8.0, align=(Align.CENTER,Align.MIN))

    sweep()

show_object(part_builder.part.wrapped, name="part")
show_object(sweep_path.line.wrapped, name="sweep_path")
show_object(sketch_builder.sketch.wrapped, name="sketch")

As a reference for my expectation, uncomment the Line statement and disable the CenterArc line. this is the rendered part: image

and that's the sketch it is based upon, also matching my expectation: image

The unmodified code above should create a similar solid with two deltas, first the angle of the arc is not identical to the extruded width with < 5% delta and secondly the solids Y edges should not be straight but slightly bend. Instead we get: image

gumyr commented 1 year ago

This issue is caused by a confusing feature, the ability to relocated the results of the operations. As you have Plane.XZ as the workplane for BuildPart there was a relocation happening which clearly is unexpected. This feature was too difficult to understand and has been removed. The result is now: image