One of the features I’ve found handy within Cad packages such as Solidworks is the use of something called Variant Parts or part configurations.
What this amounts to is having a single part but where you can select multiple options from a drop down configuration entry to change the diameter or length.
It turns out you can do this with FreeCad, although it’s not that obvious so I’ve detailed the steps below.
Creating the Part
For this example I’m going to create an OpenBuilds Aluminum Spacer part
This comes in a range of lengths including
- Metric: 3mm, 6mm, 9mm, 10mm, 20mm, 13.2mm, 20mm, 35mm, 40mm
- Imperial: 0.125inch, 0.25inch, 1.5inch
Openbuilds have made they’re STEP files for they’re parts available over here Link
Setting up the Part configuration
Next we’re going to setup the Pad or thickness / height of the object as a predefined list of options we can pick from.
Within the spreadsheet we’re going to create three columns.
- The first will be named
Variant
This is the name of the drop down configuration option you will pick. - The second will be named
Length mm
This is what will be fed into the Padding of the part. - The third will be named
Length inch
This value will be calculated into mm using a cell forumlae
Creating a Configuration Table
- Make sure there is an empty row between the heading and the values underneath.
- The first column needs to only contain string values for the drop down selection.
so if entering in3 mm
for example this will evaluate to=3 mm
, make sure to change this to'3mm
instead (putting a single quote in front) so that it’s seen as a string. - For the second column this should be recognised as a number which is what we want.
For the calculation from inches to mm this will be something like=C13 * 25.4 mm
for the forumlae
Right click in the spreadsheet and select Configuration Table
.
For the range we want to select the empty space above as the starting row
and the bottom of the list as the end. So in this example I’m using:
- Range: A2-B13
- Property: Body.ConfigLength
Next we’re going to use that Alias (which will change based on which option is picked) in the Pad settings to alter the length of the part. We can also do this for sketch dimensions as well.
- Open up the Pad settings on the part.
- For the Length click the small button to open up the forumlae window.
- Enter in
Spreadsheet.PartLength
, this should match up with the alias we created before.
It also auto completes as we’re typing it in
Changing the Part Configuration
If we select the Body of the part we can now change it’s length using the drop down configuration option.
(Note you have to click away from the setting for the change to take affect).
Using the Part within an Assembly
In some cases you may want to use multiple instances of the same part within a single Assembly but with different instances having different lengths or configuations.
Creating an Assembly
First lets create a new Assembly.
I’d recommend using the Assembly3 Addon for something similar to Solidworks in terms of using constraints to join parts together
- Select the Assembly3 workbench
- Select the
File -> New
menu option - Select the
Assembly3 -> Create Assembly
menu option - Save the assembly under a new name
- Select the
Body
of the spacer and drag it to theParts
section of the Assembly - This should result in multiple instances of the part being added
Next we want to move one of the instances away from the first
- Select one of the instances
- Select
Assembly3 -> Axial Move Part
- Drag the first instance away from the second
Setting the Link Copy on Change Option
If we try and change the config option to a different length it will change the length on all the attached parts within the assembly. To prevent this from happening we can change an option called Link Copy on Change
.
- Set this option to
Owned
for all attached parts within the assembly
You should now be able to assign a different option to each part
- For an explanation of each option Link