gumyr / build123d

A python CAD programming library
Apache License 2.0
521 stars 89 forks source link

BuildLine not rellocating line relative to workplane #295

Closed gumyr closed 1 year ago

gumyr commented 1 year ago
from build123d import *
from ocp_vscode import *

box_width = 100
box_height = 80
box_depth = 90
wall_thick = 2.24

clearance_tight = 0.1
clearance_fit = 0.25

module_height = 38.8
module_width = 71
module_width_clip = 75.25

with BuildPart() as plate_front:
    with Locations((0, -box_depth / 2, 0)):
        # DovetailPlate(
        Box(
            box_width,
            box_height,
            wall_thick,
            # (True, True, False, True),
            rotation=(90, 0, 0),
        )

    faces = plate_front.faces().sort_by(Axis.Y)
    with BuildSketch(Plane(faces[0])) as s1:
        clip_height = (module_width_clip - module_width) / 2

        with BuildLine(Plane(Location((0, box_height / 2 - wall_thick - 6)))):
            Polyline(
                (0, module_height / 2),
                (module_width / 2, module_height / 2),
                (module_width / 2, -module_height / 2),
                (0, -module_height / 2),
            )
            mirror(about=Plane.YZ)
        make_face()

        with Locations(
            (-10, -20),
            (10, -20),
        ):
            Circle((7.5 + clearance_fit) / 2)

    extrude(amount=-wall_thick, mode=Mode.SUBTRACT)

show_all()

The Polyline isn't moved as it should be. This issue https://github.com/gumyr/build123d/issues/240 shows up if Plane isn't used as the workplane parameter.

gumyr commented 1 year ago

Removed a duplicate relocation in BuildLine that was undoing the work of the BuildLine's workplane. image