Mechanism Design for a Folding Bike Using SOLIDWORKS

This article shows how to tackle complex mechanism synthesis challenges using SOLIDWORKS, some scripting and data filtering. I use the example of BriefBike, an e-bike I designed to fold as easily as an umbrella. For an introduction to using geometric constraint-based sketching to synthesize mechanisms, check out these articles:

  1. Introduction to using SOLIDWORKS to synthesize mechanisms
  2. Adapting traditional graphical methods
  3. 4-bar linkage motion generation
  4. Optimizing mechanisms for size and smooth motion

This article builds on these previous ones, providing a real-world example of optimizing a mechanism with many different constraints. Where the constraints are too complex to represent in a single sketch, a multi-step approach can be used.

A sketch is set up to solve the mechanism for one configuration of parameter values. A script is then used to solve this sketch for many different configurations and record the values of driven dimensions. Finally, a spreadsheet is used to analyze the results and find the optimum design. In practice some iteration through these steps is required, as shown in the process flowchart below.

A script was created using the SOLIDWORKS API to read in the configurations, solve the model and store the results. It uses three simple text files for inputs and outputs:


This file is created by the user to define the problem to be solved. It has three lines:

  • The file name of the SOLIDWORKS part to open and interact with.
  • A comma separated list of the driving parameters to be updated by the script.
  • A comma separated list of the driven parameters to be recorded by the script.


This file is also created by the user. Each line represents a different configuration as a comma separated list of values with each value corresponding to one of the driving parameters listed on the second line in inputs.txt.


This file is created by the script. It has a similar structure to parameters.txt, with each line also representing a different configuration as a comma separated list of values for each parameter. In this case it is the driven parameters listed on the third line of inputs.txt that are listed.

Understanding the Constraints

The BriefBike design brief was that it needed to unfold, in under half a second, into a stable two-wheeled roller case format. It also needed to have riding geometry comparable to a normal bike and be structurally efficient.

Previously, an early prototype demonstrated the bike can be unfolded in less than half a second. But this design was too wide when folded and the complex relationship between constraints was making further improvement challenging.

BriefBike was designed to have a wide two-wheeled base that can be easily dragged behind you on two smaller castor wheels. This is in contrast to current folding bikes which, when fitted with castor wheels, behave more like the much less stable four-wheeled roller cases. These narrower designs must be pushed in front of you and actively steered rather than simply following along behind. Because the propulsive force comes from a hand quite some distance above the small wheels, they are very prone to tipping over. To be able to move quickly and navigate uneven surfaces, you need two wheels located quite far apart and to be able to pull it along behind you. This then creates a natural trailing link suspension effect.

A key design requirement for BriefBike was that it needed a wide two-wheeled base that could be easily dragged behind the rider.

Before creating the actual mechanism synthesis sketch, a simpler sketch was created to define the basic ride geometry of the bike. This includes parameters such as the wheelbase, trail and head angle. A linear dimension was used to drive the head angle as this was easier to work with in the API.

The RideGeom sketch defined the important parameters affecting the handling of the bike. This was then used as a reference for the LinkSynth sketch which solves for the linkages which enable the bike to fold.

The actual mechanism synthesis is performed by a sketch which shows the four-bar linkage in two positions – folded and riding. Each link is constrained to be the same length in both positions. By adding dimensions and constraints until the sketch is fully constrained, the link lengths and joint positions are determined. Setting up this sketch to robustly solve with a wide range of different parameter values was the most challenging aspect. It was also necessary to change the constraints somewhat as the design evolved.

The main four-bar linkage is represented in this sketch, with the ground link not actually drawn. The three non-grounded links are drawn in the riding position with a thick dotted line and in the folded position in a thick solid line.

Even with this automated approach, it is not possible to solve for every conceivable combination of parameters. The model has a total of 16 driving parameters. If each parameter had just five values, the total combinations would be 150 billion and take hundreds of years for SOLIDWORKS to solve. The method therefore starts with manually testing each parameter, getting a feel for the impact that adjustments make. Only when interactions become difficult to properly explore in this way is the script used to explore an area of the parameter space.

This project went through six iterations, with up to 40,000 configurations tested at a time. Generating a table with all the different combinations is what’s known in design of experiments as a full factorial set. For large parameter sets, an automated approach is needed to create this table. This can be done using Power Query, which comes with Excel.

First, a table is created in Excel for each parameter, listing the values to be tested. Each table is then connected to a query in Power Query which generates a single, much larger table with all the possible combinations. The actual process is a little involved but is explained clearly in this YouTube video. The table of configurations can then be exported into a text file that the script can read.

After the script had solved all the different configurations, I placed all the input driving dimensions and all the output driven dimensions into a single Excel table. This had a column for each parameter and a row for each configuration. I then created additional columns to calculate things like joint forces based on the lengths of frame members. Once all this data was in a single table, configurations could be filtered to find those with the best performance.

This resulted in finding a design with a longer wheelbase, steeper head angle, more direct transmission angles, lower joint forces and a more compact folded package. You can find out more about BriefBike at

Recent Articles

Related Stories

Enews Subscribe