with BuildPart() as p:
with BuildSketch() as sk:
RectangleRounded(20, 50, 3)
with GridLocations(15, 40, 2, 2) as screw_holes:
Circle(1.3, mode=Mode.SUBTRACT)
extrude(amount=3)
with BuildPart() as screw:
with BuildSketch() as screw_sk:
Circle(1.2)
extrude(amount=8)
screw.part.label = "screw" # <=. bug in viewer, label is needed!
screws = [copy.copy(screw.part) for loc in screw_holes.locations]
for idx, loc in enumerate(screw_holes.locations):
RigidJoint(f"screw_hole{idx}", p.part, loc)
RigidJoint("head", screws[idx])
p.part.joints[f"screw_hole{idx}"].connect_to(screws[idx].joints["head"])
p.part.label = "p" # <=. bug in viewer, label is needed!
show(p, screws, render_joints=True, transparent=True)