“Impossible” Modeling Challenges Part 5: Volume Limit Mate (Keep the Prisoner in Jail)

This is the fifth installment of the SOLIDWORKS Power User Challenges (SWPUC). Check out the other articles in the SWPUC series below:


Sometimes, when I work with assemblies, I forget that I use a mouse and a keyboard to control a CAD software. It feels more akin to being teleported in a parallel universe, where the user has magic powers. It is enough to point my wand at two faces and cast a spell to make them stay connected with an attraction stronger than any magnetic force from our universe. Or, for a more impressive wow factor, I can hex a component to move only between two faces of other components by simply preselecting three or four faces and pointing to an icon that appeared (by magic) next to my mouse (I meant wand).

No serious SOLIDWORKS user would ever get frustrated while doing nothing to solve the problem.

The problem with magic is that the more you use spells, the bigger your need to use them. What happens when you reach its limits? Sometimes (very rarely, but it happens) the SOLIDWORKS Grand Wizard (that would be the Product Definition Manager for Assemblies) has not yet written the spell for the mate a user needs. In such desperate cases, the user has three choices:

  1. Become frustrated and do nothing
  2. Send a New Spell Request to the Grand Wizard
  3. Write his or her own new spell (also called Find a workaround)

The first choice is not really a choice at all. No serious SOLIDWORKS user would ever get frustrated while doing nothing to solve the problem.

The second choice is very powerful, but it could take a long time to be fulfilled, considering that the Grand Wizard of SOLIDWORKS Assemblies reveals his new super spells only once a year.

The third choice is what most of the SOLIDWORKS Power-Wizards would pick. And the good news is that whenever a new complex spell is needed by the SOLIDWORKS Community, the Power-Wizards from the SOLIDWORKS Forum will combine their magical powers to write it, test it and release it to all users.

The Challenge

A good example is the superspell written in the 7th SOLIDWORKS Power User Challenge (SWPUC), where the wizards were attempting to emulate a new Volume Mate for securely keeping you-know-whoin the Glass Prison (see Figure 1).

Figure 1. Keep the Yellow Prisoner in the Cyan Jail.

The parameters of the spell were very simple:

  1. The prisoner can move anywhere inside the jail.
  2. The prisoner can touch the walls of the jail.
  3. No part of the prisoner can move past the jail’s walls.

There were multiple prizes offered for:

  • The first solution to meets these criteria
  • The first solution that would not use limit mates
  • The solution with the smallest number of mates
  • The best solution

There were 95 replies in the 7th SWPUC thread, with multiple solutions. In this article, I will discuss two of the most interesting ones.

Spell #1

The first spell is close to ideal, but it has a hiccup that needs to be concealed by the wizard with a hocus-pocus trick.

This method relies in the spectacular functionality of the Width mate to emulate a geometric Limit mate (see Figure 2).

Figure 2. The space defined by the purple faces can move freely in the space defined by the cyan faces.

Unfortunately, the Width mate does not accept spherical faces for input. And our prisoner is a sphere!

Step 1—Add a New “Dummy” Component as a Cube Inscribing the Sphere

The cube has planar faces that are accepted by the Width mate. The sphere is tangent to all faces of the cube (see Figure 3).

Figure 3. The sphere is inscribed in the cube.

Step 2—Split the Jail into Two Parallelepipeds

The geometry of the jail is too complex for the Width mate. It is time to add two extra dummy components to split the volume into two simple boxes.

Figure 4. The Bottom Cage.

Figure 5. The Top Cage.

Step 3—Apply Free Width Mates to Limit the Dummy Prisoner to the Bottom Cage

Figure 6. Three free Width mates confine the prisoner to the Bottom Box.

Now, the prisoner is limited to moving only in the space defined by the Bottom Cage.

Step 4—Supress the Three Width Mates Created in Step 3

Since we need to add the same mating scheme for the Dummy Prisoner and the Top Cage, we will insert a mate over-definition. This problem will be controlled in a future step. Until then, let’s temporarily supress the first three Width mates.

Step 5—Apply Free Width Mates to Limit the Dummy Prisoner to the Top Cage

Figure 7. Three free Width mates confine the prisoner to the Top Box.

Now, the prisoner is limited to moving only in the space defined by the Top Cage.

Step 6—Add a Sensor to Keep an Eye on the Prisoner’s Location in the Jail’s Space

As you can see in Figure 8, only one of the two sets of Width mates can be active at any time. Otherwise, the mates would contradict each other.

Figure 8. Two sets of mates, with only one able to be active at any given time.

Manually suppressing and unsuppressing mates would not be something that a real wizard would ever consider, so it is time to add a few extra spices to the spell.

What we need is a sensor to determine if the dummy cube touches the top face of the Bottom Cage. Then, based on this signal, the software can activate one set of mates or the other.

Such a sensor can be easily be constructed by adding a reference dimension between the top face of the dummy cube and the bottom face of the jail.

After all, it is important to always know where your prisoners are.

The Bottom Cage is 5 inches tall (I know, it’s a small jail), so when this dimension reaches 5 inches, it is time to switch mates.

Figure 9. Adding a reference dimension to determine where the prisoner is located in the volume of the jail.

Step 7—Control Which of the Width Mates Are Active, Depending on the Prisoner’s Position in the Box.

Activating one set of mates or the other can be achieved by IF statements in SOLIDWORKS equations. Relate the following equations to the mates shown in Figure 8:

“Width5″= IIF ( “RD1@Annotations” > 4.99 , “suppressed” , “unsuppressed” )

“Width6″= IIF ( “RD1@Annotations” > 4.99 , “suppressed” , “unsuppressed” )

“Width7″= IIF ( “RD1@Annotations” > 4.99 , “suppressed” , “unsuppressed” )

“Width8″= IIF ( “RD1@Annotations” < 5 , “suppressed” , “unsuppressed” )

“Width9″= IIF ( “RD1@Annotations” < 5 , “suppressed” , “unsuppressed” )

“Width10″= IIF ( “RD1@Annotations” < 5 , “suppressed” , “unsuppressed” )

The Final Trick—Rebuild the Model When the Sensor is 5 Inches

Unfortunately, at this point, SOLIDWORKS will not recalculate equations automatically based on component position. To trick the audience, the magician will need to briefly pause when the prisoner reaches the top face of the Bottom Cage in order to rebuild the model. That could be easily done by using a shortcut like CTRL+Q for forced regen. Please note that a simple rebuild (CTRL+B) will not work in all cases.

Figure 10. Notice how the mates are suppressed and unsuppressed using CTRL+Q.

Spell #1—Conclusion

While the wizards had a lot of fun with equations, in the end they decided that this spell is not elegant enough for the very sophisticated SOLIDWORKS user. The fact that the model needs to be rebuilt to open the gates between one section of the prison and the next was unacceptable. A better solution was needed.

Fortunately, one of the Magnificent Wizards, Josh Brady, quickly conjured up an excellent spell.

Spell #2 from Josh Brady

Josh was able to solve the problem without adding any new components. He simply created a very ingenious mating scheme.

The first three mates are confining the movements of the prisoner to the Bounding Box of the jail. They are Limit mates between the primary planes of the prisoner and the front, side and top faces of the jail.

Figure 11. Simple Limit mates are used to confine the Prisoner to the Bounding Box of the jail.

Now, the prisoner can move inside a box. We need to further limit the prisoner’s movements to only the “extruded L” volume of the jail.

Josh was able to achieve this by adding only two extra mates.

First, he established a Limit mate between the right plane of the prisoner and the edge of the “L” shape.

Figure 12. Ensure that the prisoner cannot pass through the edge.

The last mate was a stroke of genius! It limits the angle between the right plane of the prisoner and the vertical edge, in effect ensuring that the sphere cannot move in the top right quadrant!

Figure 13. Preventing the prisoner from entering the top right quadrant of the jail’s Bounding Box!

The end result is a thing of beauty. Watch how smoothly the prisoner moves in the confines of the “L” shape. Pay attention to the way the right plane of the prisoner pivots around the edge.

Figure 14. The best solution for simulating a Volume Limit mate.

Other Solutions Received for This Challenge

As Michael Fernando stated, SOLIDWORKS can already achieve this in the Move Component Environment, with the Physical Dynamics turned on.

Figure 15. Physical Dynamics.

Unfortunately, this is a computing intensive tool; therefore, it will stop working once the Move Component tool is turned off.

Muhammad Aamer submitted two different solutions inside the same file. The first one allowed the prisoner some ways of escaping, but the second solution worked. Muhammad built a very interesting mechanism involving a point on rails (path mate), which moved a plane attached to the inner edge of the step plane that was tangent with a cylinder. The center of the jailed sphere was located at the intersection of the cylinder and the plane. Go ahead and open his assembly and see it for yourself. It’s very nice! Also, Muhammad’s solution was the first one that did not have any Limit mates. He used free Width mates for his solution instead.

Ned Hutchinson built the most elaborate prison you can imagine! His assembly has seven guards (reference parts) and no fewer than 35 mates! It is a minimum security jail, though, where prisoners are allowed outside from time to time.

Dan Pihlaja submitted no fewer than three solutions. He designed a maximum security prison, where the prisoners are very scared and jumpy. If you want them to go to a specific place, you will have to be patient, because they like to occasionally teleport to other areas of the prison.

John Stoltzfus built a prison where the sphere is on patrol around the perimeter, but is not allowed inside.

Roland Schwarz submitted an amazing solution, using a 2D Boundary mate on a face located on rails. In his solution, there are very few places where the prisoner cannot go. His original solution has only four mates, which could be reduced to three. Muhammad Aamer tried to reduce the mates even further—to only two.

Kevin Pymm believes in giving prisoners access to fresh air, so his jail allows for quick visits outside the prison walls.

Winners of the 7th SWPUC

Congratulations to Josh Brady for winning three of the four sections of the challenge:

  • The first valid solution
  • The valid solution with the least number of mates
  • The best (most elegant) solution

Congratulations to Muhammad Aamer for winning by submitting the first valid solution that did not use Limit mates.

Special mention to Roland Schwarz for sharing with us a brilliant technique. While his solution was not 100 percent valid, it could be easily refined to open new ways for defining Volume mates.


About the Author

As an Elite AE and Process Improvement Consultant, working for Javelin Technologies, Alin Vargatu is a Problem Hunter and Solver, and an avid contributor to the SOLIDWORKS Community. He has presented 22 times at SOLIDWORKS World and tens of times at SWUG meetings organized by four different user groups in Canada and one in the United States. Alin is also very active on SOLIDWORKS forums, especially on the Surfacing, Mold Design, Sheet Metal, Assembly Modeling and Weldments sub-fora. His blog and YouTube channel are well known in the SOLIDWORKS Community.

Recent Articles

Related Stories

Enews Subscribe