gumyr / build123d

A python CAD programming library
Apache License 2.0
382 stars 72 forks source link

Fix solution ttt-ppp0101.py #626

Closed ABoss closed 1 month ago

ABoss commented 1 month ago

Now generates correct model and calculates correct mass. (note that Trapezoid requires it's width input field to be calculated using angles because it's not given)

gumyr commented 1 month ago

Thanks for pointing this out, there was a change in how Trapezoid works in that now the width is the overall width not the width of the "base" line which results in the problem.

Although your solution is correct, I try to avoid having the user do trig - how is this instead?

        with BuildLine() as bl:
            l1 = Line((0, 0), (18 / 2, 0))
            l2 = PolarLine(l1 @ 1, 8, 60, length_mode=LengthMode.VERTICAL)
            l3 = Line(l2 @ 1, (0, 8))
            mirror(about=Plane.YZ)
        make_face()

i.e. creating a trapezoid from lines - note that no trig is required here.

gumyr commented 1 month ago

Maybe there should be an option in the Trapezoid object to select either the maximum or minimum length (this could be fairly complex as the left and right angles could be different)?

ABoss commented 1 month ago

Ah, much better solution!

Maybe there should be an option in the Trapezoid object to select either the maximum or minimum length (this could be fairly complex as the left and right angles could be different)?

Maybe, it would make working with Trapezoid easier (although maybe doing everything with lines is actually easier)

gumyr commented 1 month ago

Thanks!