inputlabs / alpakka_case

Other
67 stars 10 forks source link

build123d anchor #30

Open przymi opened 3 weeks ago

przymi commented 3 weeks ago

Anchor re-implemented in build123d

jdegenstein commented 3 weeks ago

OK, spent a bit of time looking at this and here is my reworked version. I believe there may have been a bug with FDM_BRIDGE_THICKNESS but please confirm and see screenshot below. I made quite a few changes, the biggest of which was to completely rework the part positioning. To me the natural part origin was the underside of the top part centered on the hole location (and thus the hexagon and FDM bridge). This allows much better use of symmetry in my opinion through the use of extrude(... both=True). I also leaned harder on the use of Trapezoids which can greatly reduce the number of specified parameters in the form of point lists. Also sorry for making a mess of the parameterization, but I hope it can be fixed easily if any of this is of interest. Feel free to use as much or as little as you wish. The part volume of this version is 428.7 mm^3 versus the PR version of 429.19 mm^3 most of which I believe is in the FDM bridge mentioned above.

with BuildPart() as p:
    with BuildSketch(Plane.YZ.offset(0)) as ss:
        with Locations((-8 / 2, 0)):
            Trapezoid(11, 4.3, 90, 55.1, align=(Align.MIN, Align.MIN))
    extrude(amount=TOP_WIDTH / 2, both=True)

    edge_list = edges().filter_by(Axis.Z)
    chamfer(edge_list, CHAMFER)

    Hole(BOLT_HOLE_RADIUS)

    with BuildSketch(Plane.YZ.offset(0)) as ss2:
        with Locations((6 - 8 / 2, 0)):
            Trapezoid(9, 4, 90, 45, align=(Align.MIN, Align.MAX))
    extrude(amount=BOTTOM_WIDTH / 2, both=True)

    with BuildSketch(Plane.YZ.offset(0)) as ss3:
        with Locations((-4, 0)):
            Trapezoid(10, 4, 90, 45, align=(Align.MIN, Align.MAX))
    extrude(amount=BOTTOM_CUTOUT_WIDTH / 2, both=True, mode=Mode.SUBTRACT)

    with BuildSketch(faces().sort_by(Axis.Z)[-1]) as ss4:
        RegularPolygon(
            (NUT_WIDTH + NUT_TOLERANCE) / 2, 6, rotation=360 / 6 / 2, major_radius=False
        )
    extrude(amount=-NUT_THICKNESS, mode=Mode.SUBTRACT)

    # FDM bridging TODO: add bool
    with BuildSketch(faces().sort_by(Axis.Z)[-1]) as ss5:
        Rectangle(NUT_WIDTH + NUT_TOLERANCE, BOLT_HOLE_RADIUS * 2)
    extrude(amount=-NUT_THICKNESS - FDM_BRIDGE_THICKNESS, mode=Mode.SUBTRACT)

and screenshot: image

Lastly I should mention the pack feature from build123d which is intended to create automatic buildplate packing but can be used for single parts to re-align the bottom (in the z-dir) to the XY plane. I personally believe that parts should usually be designed in the coordinate systems that make the design easier rather than pre-positioning for printing. https://build123d.readthedocs.io/en/latest/assemblies.html#pack