# The Ham Sandwich Theorem in SOLIDWORKS

Happy spring everyone! It’s finally time to break out those picnic baskets and have some sandwiches! But what if you want to share a sandwich with someone? Cutting a sandwich may sound like the most mundane task, but only if the sandwich was made neatly. What if the sandwich was jumbled around as you carried it in your basket? The parts slide against each other, making it difficult to ensure a cut that gives each person equal parts of each ingredient. But as I will show you, it is not impossible!

The question that follows: Does a cut that divides a sandwich into two equal parts exist? The funny thing is, it depends on the number of ingredients the sandwich has. For sandwiches that have four or more parts that cut *could *exist, but it is not guaranteed to exist, as most people would expect. But for a sandwich with three parts, that solution is *guaranteed *to exist. Even if your ingredients are lopsided and you are the worst sandwich maker in the world, you can still cut your terrible sandwich perfectly in half. Now, let’s prove this true with some geometrical facts and by using the power of SOLIDWORKS!

First things first, we need to make a three-part sandwich in SOLIDWORKS. You can make your own at home, but here is the engineering assembly drawing of my lunch, complete with bill of materials.

The bread was made by extruding a closed sketch, and the ham slice was made as a sheet metal part for reasons that will become clear later. Here’s our assembled sandwich in all its glory. I held all tolerances for cutting the slices of bread and placement to +/- 0.0001 in. Sure, it took a couple thousand out of our manufacturing budget, but look at this beauty:

Every component is perfectly centered and meticulously crafted to ensure regularity of the shapes. In this case, cutting the sandwich in half is easy, just slice it down the middle. However, I have been informed that $3,000 is not a price many people can pay for a sandwich held to those manufacturing tolerances.

So, I will make a sandwich myself to keep the cost down. It may not be perfect, but, rest assured, it will be made with love.

I place the first piece of bread down:

So far so good. Now for that piece of salami:

Erm … well … I seem to have folded my ham. As I said earlier, I’m not prepping for Gordon Ramsay, so this should be close enough.

Now for that last piece of bread. Making sandwiches is hard work, and I can really use a bite so I will take one out of this slice of bread before I place it down.

Well, it is a sandwich, so we’re done here! But now, how do we cut this sandwich in half? This is where it begins to get a little more complicated. A straight cut down the middle isn’t going to cut it (pun intended); we need to be a more clever than that.

Consider this, every component here has a center of mass point with a pretty intuitive property. If you cut the ingredient through that point, it will result in two equal halves. Consider just the regular slice of bread:

The center of mass is shown here as the checkered circle. Any line drawn through it will cut this slice of bread in half, equally dividing the mass into two parts. We can see why the intuitive solution of cutting it down the middle works. The cut goes through the center of mass point, but so will the lines shown in blue.

Now let’s determine the center of mass for all components in the sandwich. In each component, go to **Features > Reference Geometry > Center of mass**. This places a center of mass feature at the top of the tree. If we want to directly select it in other features, we have to sketch a point that coincides with it. Once you have the center of mass feature enabled, open up a new 3D sketch and grab the point tool. Place a point arbitrarily out in space. Then, drag that point on to the checkered circle. They should now be coincident, and we can now easily select this 3D point to refer to the center of mass.

See the above sketch with a point at the center of mass. (Not an ant!)

Repeat that for all three components. Once you’re done, go back to the assembly, and make sure we can see sketches in the view options. We should be able to see all three points.

Now, if recall from your high school geometry class, how many points does it take to define a plane? If you guessed three, then you are correct. If you also guessed that the plane defined by these three points is the cutting plane we should use, then you are very correct!

In the assembly, go to **Assembly > Reference Geometry > Plane** and select the three points representing the center of mass. You should have a fully defined plane that magically cuts our sandwich perfectly if half!

Now let’s see what the two halves look like:

They admittedly look unappetizing, but this is the equal division of the sandwich into two parts! Each person gets the same amount of bread and ham! The interesting thing is that this can be extended to sandwiches with more parts, with a catch. You can place as many components as you want, and the cut will still cut it in half as long as the center of mass point is on the plane. This gives us less freedom to place ingredients but will guarantee the cut.

Now that you know how to cut a sandwich in half, you go can go to the picnic and cut your sandwiches in confidence. Just remember to share!

Thanks for following along!

Check out more blogs like this one __here__. You’ll find helpful articles and educational videos on a wide range of engineering and manufacturing topics to help you maximize efficiency in your job role!

And don’t forget to follow us on __Facebook__, __Twitter__ and __LinkedIn__ to stay up-to-date on our latest blogs, videos, promotions, and more!

*Author: Robert Maldonado, Application Engineer at DesignPoint*