Non-rectangular keyguard perimeters

Almost all tablet cases have a rectangular opening for accessing the screen of your tablet.  The opening may have rounded corners and cut-outs for the tablet’s home button and camera – but the opening is still basically rectangular.

What if you encounter a case that isn’t entirely rectangular?  An example of such a case comes with the Accent 1400 communications system:

The Accent 1400 case has several aspects that don’t work well with a rectangular keyguard:

The left and right sides of the case bow outward.  It would be helpful if the keyguard could fill this space to provide a tighter fit and to provide extra plastic for mounting the keyguard. The camera sits well above the keyguard and part of the home button sits below the keyguard.  It would be helpful to extend the keyguard into these regions to prevent access to the camera and home button or to provide extra plastic for mounting the keyguard.

The full version of keyguard.scad provides a way to add this additional plastic to the outside edge of your keyguard.  This picture demonstrates the kind of options you have to add plastic and change the overall shape of your keyguard (it just happens to fit an Accent 1400 device):

Adding Plastic to the Edge of a Keyguard or Keyguard Frame

The following shapes can be added to the outside of your keyguard to better fit your non-rectangular case opening.  Shapes are normally placed along the outside edge of your keyguard but you can attach shapes to other shapes if necessary, as long as a you end up with a single “solid” shape.  You can also use the case_openings data structure to put openings in these additions.

Shapes that anchor to the edge of a keyguard or keyguard frame

To add a rectangle or square to one or more edges of your keyguard, you will need to specify the height and width of the rectangle/square and the x and y coordinates of the center of the edge that will lie against the keyguard. 

You specify a rectangle/square by using the letter “r” followed by a number from 1 to 4 based on where the rectangle/square will attach to the keyguard.

Rounded Rectangles

There are four kinds of rounded rectangles that you can add to your keyguard depending on whether you want to add one to the top, right side, bottom, or left side of your keyguard.   The shape is specified with the abbreviation “rr” followed by a number that represents the side of the keyguard.

Note that the corners of the rectangle nearest the keyguard are not rounded.  To add a rounded rectangle to your keyguard, you need to specify the height and width of the shape as well as the x and y coordinates for the point (red dot) at the back center edge.

Crescent Moons

There are four kinds of crescent moons that you can add to your keyguard depending on whether you want to add one to the top, right side, bottom, or left side of your keyguard.   The shape is specified with the abbreviation “cm” followed by a number that represents the side of the keyguard.

To add a crescent moon to your keyguard, you need to specify the height and width of the shape as well as the x and y coordinates for the point (red dot) at the back center edge.

Shapes that anchor at an arbitrary location

Circles and Rectangles/Squares

As the name implies you can specify that a circle of any size and a rectangle or square of any size be added to the edge of your keyguard.  The only difference between a rectangle and a square is that the height and width of a square are the same size.  You specify the size of the radius of a circle and you specify the height and width of a rectangle/square.  

To add a circle shape to the keyguard, you will need to specify the width (i.e., diameter) of the circle and the x and y coordinates of its center (red dot).  You specify a circle shape using the letter “c”.

You can add a large rectangle or rounded rectangle as the surround for your entire keyguard.  You need to specify the height and width (and corner radius for a rounded rectangle) and set the x & y coordinate for the center of the shape:

Use “r” to indicate a large rectangle and “rr” to indicate a large rectangle.

Triangles

There are four kinds of triangles that you can add to your keyguard.  Each of the four triangles can look like two different forms depending on whether you set the width longer than the height or vice versa.  They are named beginning with a “t”, followed by a number. 

The number relates to the quadrant that the triangle would represent in an x/y plane.

 

To add a triangle shape to the keyguard, you will need to specify the width and height of the triangle and the x and y coordinates of its right angle.  If you want to add an acute triangle shape, just put two of these triangles back-to-back.

Fillets

The time to use a fillet is when you’re fitting your keyguard around a convex part of your case.  A fillet will normally butt-up against another shape that you’ve added to your keyguard.

To add a fillet to your keyguard, you need to specify the width of the shape (the length of either leg of the fillet) as well as the x and y coordinates for the right angle of the fillet.  Note, if the radius of the curved part of the case is “r” then that will also be the width of the fillet.

Using Shapes to Remove Plastic from the Edge of a Keyguard/Frame

Some cases present the opposite problem of the Accent xxx.  Here’s a picture of the NovaChat 5:

There is a crescent moon shape on the left and right, but this time they extend into the case opening.  To complicate matters further, the opening corner radii are different on the left and right.  The radii on the left are larger than those on the right.

Both of these issues can be addressed by removing plastic from the  edge of the case using the same shapes described above – but their polar opposites, “negative” shapes.

You specify that you want a negative shape by putting a minus sign in front of the shape name.  For example “c”, adds a circle to the keyguard. “-c” removes a circle from your keyguard.  This image shows one  “positive” shape (rr1) along with several “negative” shapes added to and removed from the edge of a keyguard:

Where did it go?

Removing plastic can be confusing sometimes – specifically because it’s hard to see something “negative” in the display pane.  Here’s an example.  Let’s suppose that you want to cut out another triangle from the shape above like this:

You insert the following instruction into the openings_and_addtions.txt file (click on the image to expand it). 

[Note in this example, you’ll see two “variables”.  “coh” holds the “case opening height” and “cow” holds the “case opening width”.  You could replace these with the actual values you specified in the customizer pane but this approach is easier and automatically adjusts if you change the values.]

You save the openings_and_addtions.txt file but nothing changes:

You can instruct the designer to highlight the “negative” shape by replacing the value you put in the “ID” column with a pound sign, “#” (be sure to put double quotes around the pound sign):

When you save the file, you now see this:

The shape you specified is now displayed in red (you can do the same thing for “positive” shapes as well).  You need to use the “flipped” version of this shape – a -t2 rather than a -t2. 

Change the shape and replace the “#” with the value you originally had there:

Save the file and now you see what you expected and wanted:

Addressing those different corner radii

To create the various corner radii, we set the corner radius to “0” in the customizer pane and then  put four negative fillet instructions into the openings_and_additions.txt file:

 

 

Replace the “#” ID value with a more appropriate one and save the file again:

Here are the four instructions that produced those rounded corners:

Specifying the Size and Locations of Shapes

Like all case measurements, the 0,0 location for all x and y coordinates is located in the lower left corner of the case opening and all measurements are in millimeters.

Depending on the shape of the case opening, it can be a bit difficult to visualize the lower left corner of the case opening.  For example, in the example below the green case has an opening that is wider at the bottom than at the top.  So where is the lower left corner of the case opening?

The first step is to imagine the largest rectangular keyguard that would it in this opening:

The lower left corner of this blue keyguard is the 0,0 location for all measurements.

Note: If the lower edge of the case opening is wider than the upper edge, as in the picture above, start by printing a purely rectangular keyguard that best fits the opening.  You only need to print the first couple of layers of the keyguard to test the fit.  This starter keyguard will help you visualize the 0,0 location that you will use to size and place all the additions you add to the outside edge of the keyguard.

Trimming a Shape

On occasion you may add a shape that extends too far beyond the edge of the keyguard.  In the image below, the crescent moon shape added to the left side of the keyguard extends too far below the bottom of the keyguard because the center of the crescent moon is located below the middle of the keyguard.

You can trim the top, bottom, left and right sides of any shape.  In this example, you can get rid of the spike extending from the bottom of the crescent moon by trimming all parts of the shape below the bottom of the keyguard ( trim crescent moon below zero mm).

If the crescent moon was placed higher on the keyguard and part of it happened to stick out above the keyguard (and if the keyguard is 100 mm high) you would remove that excess  by trimming the crescent moon above 100 mm.

All trimming is performed relative to the lower left corner of the keyguard.  That is the (0,0) coordinate of the keyguard for both case additions and case openings.

The Case Additions Data Structure

Information about plastic additions to the periphery of the keyguard go into the data structure named case_additions .  This data structure has a very similar layout to the screen_openings and case_openings data structures in the openings_and_additions.txt file.  There is one row for each shape that you add to the periphery of the keyguard.  Each row has a comma at the end (click on image to expand):

The Thickness column is a placeholder for future functionality and the values in that column should remain “0”.  You should leave the value in the “trim…” columns at -999 unless you want to trim a shape.  If you put two forward slashes “//” at the beginning of a row it will be ignored.   All measurements in this file are in millimeters and are measured from the lower-left corner of a “hypothetical” rectangular keyguard.

Caveats

It goes without saying that case designers aren’t limited to simple circles and rectangles.  They can create cases with complex lines and cuts.  By adding plastic to the outside of your keyguard, you’re just trying to get close to matching the outline of the case opening and so create as stable a keyguard as possible.

If you’re using micro-suction tape, a little extra plastic can be the difference between a loose keyguard and one that sticks well to the face of the tablet. 

Straight edges and rounded corners don’t play well if placed exactly against each other:

If you experience something like this change the x and/or y coordinate of the shape to move it closer in contact with the keyguard until the “scar” disappears.

Remember that you can put decimal numbers like: 12.7, 18.99, and 0.005 in any of the .txt files to get exactly the look you want.

Mounting Points

Mounting methods like slide-in tabs and clip-on straps place the tabs and pedestals for the clips on the edge of the basic keyguard.  What can you do if you’ve added additional plastic to the outer edge of your basic keyguard?  What you should do is create new tabs and pedestals that align with the new, larger keyguard.  The program allows you to manually add slide-in tabs and clip-on strap pedestals where ever you want.  You create them by adding lines to the case_additions data in the openings_and_additions.txt file. 

There are four possible slide-in tabs that you can add to your modified keyguard.  Their names depend on which edge of the keyguard they’re going on:

Slide-in tabs are just half-rounded-rectangles except you’ll specify their thickness.  You’ll specify the x and y coordinates, height/width, corner radius, and thickness for each tab you create.  

Similarly, there are four possible clip-on strap pedestals that you can add to your modified keyguard.  Their names depend on the edge that the pedestal will appear on and therefore, the direction of the cut:

These manually created clip-on strap pedestals are special in that you only specify the x and y coordinates for each pedestal in the the case_additions data structure.  You’ll measure for and specify the “horizontal and vertical clip width” and “case to screen depth” measurements in the Clip-on Strap Info section of the customizer as you normally would.

Keep in mind the size of the additional plastic you’ve added to the keyguard when specifying the location of these mounting points.  For example, if the basic case opening is 161 mm high and you add an additional 2 mm of plastic at the top and bottom of the keyguard, like this:

The y coordinate for a tab or pedestal added to the top edge should be 161 mm + 2 mm = 163 mm.  The y coordinate tab or pedestal added to the bottom edge should be 0 mm – 2 mm = -2 mm.

Finally, if you’re using clip-on straps, adding plastic to the out edge of your keyguard and moving the mounting pedestals outward, puts them closer to the edge of the case.  You need to account for this when designing the clips that will go into those pedestals.  You can do this by telling the program that the case is actually smaller than it really is.  For example, in the example above, I’ve added 2 mm to the top edge and 2 mm to the bottom edge of the keyguard.  If I want the clips to be sized correctly for this new keyguard, I just tell the program that my case is actually 2 mm + 2 mm = 4 mm smaller than it actually is  before I create the vertical clips for the case.  If the case is really 187 mm high, then set the “case height” in the Clip-on Straps Info section to 183 mm before generating the vertical clips.

Note: If you’re adding mounting points by hand, you should select “No Mount” as your mounting method.  The program will still respond to the options you select in the “Slide-in Tabs” section and/or the “Clip-on Straps” section.

Note that the openings_and_additions.txt file includes designer variables that may be helpful to you in locating your case additions.  Read more about that topic here.