# HG changeset patch # User Trammell Hudson # Date 1329688316 18000 # Node ID 55a98b21ab23337ffbeb330227c5ce057db20984 # Parent 5c431181247fa7b0c86702575fec535ae5e8985b kerf works diff --git a/boxer b/boxer --- a/boxer +++ b/boxer @@ -10,16 +10,17 @@ my \$units = "mm"; # mm = 1, inches = 1000 / 25.4 my \$thickness = 3; -my \$sides = 5; +my \$sides = 4; my \$edge = 30; my \$height = 20; my \$tab_width = 8; +my \$kerf = 0.1; my \$deg2rad = # Compute the height of the interior triangle my \$interior_angle = 360.0 / \$sides; -my \$interior_len = \$edge - \$thickness/2; +my \$interior_len = \$edge - \$thickness; my \$interior_radius = (\$interior_len/2) / tan(deg2rad(\$interior_angle/2)); @@ -32,9 +33,8 @@ # # Draw the top (and bottom piece) # -# print <<""; - + for my \$side (0..\$sides-1) { @@ -42,8 +42,8 @@ my \$hx = \$interior_len / 2; # Put one tab in the middle - my \$tab_x1 = \$hx - \$tab_width/2; - my \$tab_x2 = \$hx + \$tab_width/2; + my \$tab_x1 = \$hx - \$tab_width/2 - \$kerf; + my \$tab_x2 = \$hx + \$tab_width/2 + \$kerf; print <<""; \$side + "/> } @@ -74,19 +74,30 @@ # Draw the edge pieces # print <<""; - + for my \$side (0..\$sides-1) { my \$origin_x = \$side * (\$edge + \$thickness + 2); # Put one tab in the middle of the top and bottom edges - my \$tab_x1 = \$edge/2 - \$tab_width/2; - my \$tab_x2 = \$edge/2 + \$tab_width/2; + # Make it smaller than the kerf for a tighter fit with the + # prodruting tab on the top/bottom pieces + my \$top_tab_x1 = \$edge/2 - \$tab_width/2 + \$kerf - \$thickness/2; + my \$top_tab_x2 = \$edge/2 + \$tab_width/2 - \$kerf - \$thickness/2; - # Put one tab in the middle of the left and right edges - my \$side_tab_x1 = \$height/2 - \$tab_width/2; - my \$side_tab_x2 = \$height/2 + \$tab_width/2; + my \$bottom_tab_x1 = \$edge/2 - \$tab_width/2 + \$kerf + \$thickness/2; + my \$bottom_tab_x2 = \$edge/2 + \$tab_width/2 - \$kerf + \$thickness/2; + + # Put one tab in the middle of the left edge. It goes in, + # so make it smaller than than the kerf. + my \$left_tab_x1 = \$height/2 - \$tab_width/2 + \$kerf; + my \$left_tab_x2 = \$height/2 + \$tab_width/2 - \$kerf; + + # Put one tab in the middle of the right edge. it goes out, + # so make it larger than the kerf. + my \$right_tab_x1 = \$height/2 - \$tab_width/2 - \$kerf; + my \$right_tab_x2 = \$height/2 + \$tab_width/2 + \$kerf; print <<""; @@ -97,13 +108,13 @@ transform="translate(0 0) rotate(0 0 0)" stroke="#ff0000" fill="none" - stroke-width="1px" + stroke-width="0.1px" d="M \$thickness 0 - \$tab_x1 0 - \$tab_x1 -\$thickness - \$tab_x2 -\$thickness - \$tab_x2 0 + @{[\$bottom_tab_x1-\$kerf]} 0 + \$bottom_tab_x1 -\$thickness + \$bottom_tab_x2 -\$thickness + @{[\$bottom_tab_x2+\$kerf]} 0 \$edge 0 " /> @@ -113,14 +124,14 @@ @@ -130,31 +141,31 @@ print <<""; - +