Parametric modeling for beginners: build a resizable shelf

parametric_modeling_for_beginners-1757918842352

Parametric modeling means building a model from named values and relationships, such as shelf_width and shelf_count, instead of fixed dimensions, so changing one value rebuilds the whole part. The recipe in this guide: define five user parameters, add one derived value for the shelf spacing, constrain every sketch to those names, then pattern a single shelf with a count and a spacing taken from the parameters.

The steps work in Autodesk Fusion, Onshape and FreeCAD. Their menu names are checked against each vendor’s current documentation and listed side by side below. The example is a small open-front shelf unit sized for a desktop printer (180 x 150 x 100 mm, 3 mm walls, two shelves). Those numbers are examples, not recommendations: check them against your own bed and nozzle.

Affiliate · Featured hardware Snapmaker U1 5X More Speed. 5X Less Waste.

The consumer toolchanger 3D printer: the SnapSwap 4-toolhead system swaps heads in 5 seconds for true multi-color and multi-material printing, with smart calibration and auto filament loading.

  • 4 toolheads · 5 s swap
  • Up to 500 mm/s · 20,000 mm/s²
  • 270 mm cube build volume
  • Multi-color & multi-material
See the Snapmaker U1 →
Snapmaker U1

Resizable shelf in 7 steps

  1. Choose your parameters: width, height, depth, wall thickness and shelf count.
  2. Create them as user parameters (Fusion), variables (Onshape) or spreadsheet aliases (FreeCAD).
  3. Add one derived parameter for the spacing between shelves.
  4. Sketch the outer rectangle and extrude it. Constrain the dimensions with parameter names.
  5. Cut the cavity, leaving the walls.
  6. Add one shelf, then pattern it using the count and the spacing.
  7. Change each parameter and watch the model rebuild.

Plan the parameters first

Computer monitor showing a wireframe of a shelf unit with several compartments, with digital calipers on the desk

Decide what must be adjustable and what follows from it. Five inputs are enough for the shelf; the spacing is calculated.

ParameterExample valueTypeRole
shelf_width180 mmLengthOverall outside width
shelf_height150 mmLengthOverall outside height
shelf_depth100 mmLengthFront-to-back depth
wall3 mmLengthThickness of sides, top, bottom and every shelf
shelf_count2Plain number, no unitInternal shelves, not counting top and bottom
shelf_pitch(shelf_height – wall) / (shelf_count + 1) = 49 mmLength, calculatedDistance from one shelf’s bottom face to the next

Where does the pitch formula come from? The unit has shelf_count + 2 panels of thickness wall and shelf_count + 1 equal openings. Each opening is (shelf_height – (shelf_count + 2) x wall) / (shelf_count + 1). Add one panel thickness and you get the pitch, which simplifies to (shelf_height – wall) / (shelf_count + 1). With the example values, openings are 46 mm and the pitch is 49 mm. Shelf number k then has its bottom face k x shelf_pitch above the bottom of the unit.

Use descriptive names. Short names can collide with units or cell addresses: FreeCAD rejects an alias such as W because it is the unit for watts, and a name like AB123 because it looks like a cell address.

Where each program keeps its parameters

TaskFusionOnshapeFreeCAD
Store the valuesModify > Change Parameters, then Add User Parameter: Name, Expression, UnitVariable feature in a Part Studio: name, type (Length, Angle, Number, Any), valueSpreadsheet workbench: values in cells, each given an alias (Ctrl+Shift+A)
Use a value in a fieldType the name; Fusion suggests matching parametersType # and the name, for example #wallType = to open the expression editor, then Spreadsheet.wall
Derived valueExpression such as (shelf_height – wall) / (shelf_count + 1)Same expression in the variable’s value fieldCell formula starting with =, using the aliases
Pattern toolRectangular Pattern: Axis, Distribution (Spacing or Extent), Quantity, DistanceLinear pattern: Direction, Distance between instances, Instance countPartDesign LinearPattern: Mode Offset (v1.0) or Overall Length, Occurrences
Order matters?Parameters follow the timeline orderOnly variables earlier in the Feature list appear in autofillDependencies follow document objects, not just properties

Names in Onshape may use English letters, digits and underscores, are case-sensitive and cannot start with a number. FreeCAD spreadsheet values should carry units, such as 180 mm; the shelf count is a plain number. Fusion requires a unique name for each parameter, and its reference advises against commas in expressions because they conflict with the decimal separator in some locales.

Step by step: building the shelf

  1. Create the parameters from the table above, in millimetres. Enter shelf_pitch last, with its formula, so it can reference the others.
  2. Outer block. Sketch a rectangle on the front plane. Constrain its width to shelf_width and its height to shelf_height, typing the names into the dimension fields. Extrude it by shelf_depth.
  3. Cavity. Sketch on the front face, centred. Constrain the inner rectangle to shelf_width – 2 * wall wide and shelf_height – 2 * wall high. Cut it through the full shelf_depth to leave an open frame. For a back panel, cut shelf_depth – wall instead.
  4. One shelf. On the same front plane, sketch a rectangle shelf_width – 2 * wall wide and wall high, with its bottom edge shelf_pitch above the bottom edge of the unit. Extrude it by shelf_depth and join it to the frame.
  5. Pattern. Pattern the shelf feature along the vertical direction. Set the count to shelf_count and the distance to shelf_pitch. In Fusion use the Spacing distribution; in Onshape the distance is the gap between instances; in FreeCAD use Mode Offset with Occurrences, or on older versions Overall Length = (shelf_count – 1) * shelf_pitch.
  6. Test. Change shelf_count to 3, then shelf_width to 240 mm, then wall to 2 mm. Check the result with a measure tool each time.

Because the pattern’s count and spacing come from the parameters, the model should adapt without you touching a sketch. Onshape’s own tech tip shows a linear pattern with distance and instance count both driven by variables. If a value does not update, type the name again instead of a number (see the pitfalls table below).

Check the numbers

shelf_countshelf_pitchClear opening (pitch – wall)Shelf bottoms from the base
173.5 mm70.5 mm73.5
249 mm46 mm49, 98
336.75 mm33.75 mm36.75, 73.5, 110.25
429.4 mm26.4 mm29.4, 58.8, 88.2, 117.6

All rows use shelf_height = 150 mm and wall = 3 mm. If your model’s openings differ from the third column, the pattern spacing is probably being read as a different distance than you assumed.

Let formulas do the thinking

Equations are the reason to bother with parameters. Fusion’s expression field accepts +, -, *, /, ^ and %, plus functions such as sqrt, min, max, round, floor and ceil. FreeCAD supports the same family of functions and units-aware arithmetic. A formula can make the count follow a rule instead of a number you type:

  • Count from a minimum opening: if you want openings of at least 40 mm, use shelf_count = floor((shelf_height – wall) / (40 mm + wall)) – 1. With the example values that gives floor(3.42) – 1 = 2.
  • Ratios: a depth that is always half the width is a depth parameter set to shelf_width / 2. Fusion’s help shows the form Length=Width*2.
  • Limits: use min() and max() to stop a value going below a printable or sensible size.

Keep formulas short and keep each one in one place. A value defined twice will disagree with itself the day you change one of them.

Why parametric models break

SymptomCauseFix
Pattern ignores a new count or spacingA plain number was typed in the pattern field instead of the parameter name. Onshape forum users report a similar effect with sketch patterns when the offset is not bound before the pattern is completedEdit the field and enter the parameter name again; then change the parameter to confirm
Parameter missing from the listIn Onshape only variables earlier in the Feature list are offeredMove the variable up the feature list, before the features that use it
Feature fails at extreme valuesA wall wider than half the width gives a negative cavityTest the largest and smallest values you expect; add min() and max() limits
Expression rejected for unitsFreeCAD does not add a plain number to a length, so 2mm + 4 is invalid; and 1/2mm means 1/(2mm)Give every dimension a unit: use 4mm, and write 0.5 * 1mm instead of 1/2mm
Circular dependency error in FreeCADAn object gets its size from a spreadsheet that also reports that object’s volumeUse one spreadsheet to drive the model and a second one to report results
Rename broke referencesOther features still use the old nameIn Onshape tick Update all references when renaming; elsewhere rename before building on the parameter
Sketch will not solveOver-constrained (conflicting) or under-constrained (loose) sketchDelete the dimension that duplicates another; fully define the sketch from the origin
Geometry jumps after an early editLater sketches reference faces or edges that changedAttach sketches to origin planes and datum geometry rather than to faces of earlier features

Save a version before changing an early feature. Prusa’s modelling guide recommends saving versions before merging or subtracting geometry, and the same habit protects a parametric history.

Keeping the model fast

  • In Fusion, the Change Parameters dialog has an Automatic Compute checkbox. Untick it to pause updates while you edit several parameters, then click OK to recompute once.
  • Pattern one feature rather than copying it by hand, as the shelf does.
  • Keep a handful of parameters in one place and avoid chains of formulas that depend on each other for no reason.
  • Split a large design into separate parts and combine them later. The same advice applies to the Boolean operations you use to merge parts.

From the model to a print

A parametric file is the source; the STL is just one output. Export a fresh STL after each change, then follow the export and slicing checklist. For the shelf, printing it on its back, with the depth axis vertical, keeps the walls and shelves as vertical plates, so there are no horizontal spans to bridge. The support-free design rules explain why, and the wall thickness guide helps you choose the wall value.

Already have a static model you would like to edit this way? Converting static models covers the rebuild. For choosing a program, see the free software comparison.

Frequently asked questions

What is a user parameter in CAD?

A user parameter is a named value you create yourself, such as wall = 3 mm, which you then type into sketch dimensions and feature dialogs. In Fusion it is added under Modify > Change Parameters; in Onshape it is a variable created in a Part Studio. Editing the value updates every feature that uses it.

Is there a free way to follow this tutorial?

Yes, but check the terms. Onshape’s Free plan is for non-commercial designs that are open-source and public online. FreeCAD is open-source software. Autodesk has personal-use licensing for Fusion with limits, so read its current terms before relying on it.

Why does my pattern not change when I change the shelf count?

The count field is usually holding a typed number instead of the parameter. Re-enter the parameter name in the pattern’s count and distance fields. Onshape forum threads describe this behaviour for patterns whose values were not bound at creation.

How many shelves can I add before the model fails?

The formula still works for any count, but the clear opening shrinks as pitch minus wall. When it falls below what you want to store, or below what your printer can bridge or print cleanly, stop. Compute the limit with a floor() formula on a minimum opening as shown above.

Sources