def _fuse_nut_ramps_to_bracket(bracket: Part.Solid, thickness: float, set_screw_cutout_length: float, set_screw_cutout_width: float, ramp_height: float) -> Part.Solid: """Fuse nut ramps to bracket so nut doesn't spin when tightening screw. :: |\ | \ |__\ :param bracket: Bracket :param thickness: Thickness :param set_screw_cutout_length: Length of set screw cutout :param set_screw_cutout_width: Width of set screw cutout :param ramp_height: Height of ramp. """ ramp_length = set_screw_cutout_length / 2.0 ramp_angle = (180 - 120) / 2 # Hexagonal nuts have 120 degree angles # opposite = tan(theta) * adjacent (toa in soh-cah-toa rule) height = tan(radians(ramp_angle)) * ramp_length # Right Triangle bottom_left = Vector(0, 0, 0) top_left = Vector(0, 0, height) bottom_right = Vector(ramp_length, 0, 0) vectors = [bottom_left, top_left, bottom_right] face = make_face_from_vectors(vectors) rotation = 45 left_ramp = face.extrude(Vector(0, set_screw_cutout_width, 0)) right_ramp = left_ramp.copy() left_ramp.rotate(Vector(0, 0, 0), Vector(0, 0, -1), rotation) right_ramp.rotate(Vector(0, 0, 0), Vector(0, 0, -1), 180 + rotation) cutout_length_offset = set_screw_cutout_length * cos(radians(rotation)) left_ramp.translate( Vector(thickness * 2, (thickness * 2) + cutout_length_offset, ramp_height)) cutout_width_offset = set_screw_cutout_width * cos(radians(rotation)) right_ramp.translate( Vector((thickness * 2) + cutout_length_offset + cutout_width_offset, (thickness * 2) + cutout_width_offset, ramp_height)) bracket = bracket.fuse(left_ramp) return bracket.fuse(right_ramp)