FreeCAD Linear Pattern Tutorial: Space Copies Evenly
▶ Watch on YouTube & subscribe to The Stack Underflow
Five hooks on a 180 mm strip should leave 20 mm at both ends. We typed 180, the strip’s width, in LinearPattern’s Length box. The fifth hook landed 20 mm past the end, floating in mid-air, and FreeCAD only warned. In Extent mode, Length runs from the start of the first hook to the start of the last: 180 - 20 - 20 - 20 = 120.
The one-line version: Length = strip - 2 x margin - 1 hook, written as a formula on the spreadsheet names, then measure both ends.
Last verified in our lab: 16 November 2026 (FreeCAD 1.1.4; freecad-mcp 0.1.28; Claude Code 2.1.308 with Claude Sonnet 5.5; Linux in Docker).
The words first
- LinearPattern: repeats a feature along a direction (Part Design workbench).
- Occurrences: how many copies in total; it counts the first hook too.
- Extent mode: Length is the distance from the first copy’s start to the last copy’s start. (LinearPattern also has a Spacing mode, where you type the step.)
By hand (FreeCAD 1.1.4)
Start file (one hook, Params 180 / 5): rack-start.FCStd
- Params (spreadsheet): rack_width 180, width 20, margin 20, hooks 5. Measure: the strip’s end edge, Ctrl-click the hook’s outer edge: 20.00 mm.
- Select the Hook, Part Design, LinearPattern.
- Direction: Base X-axis (the default, Horizontal sketch axis, sends copies out from the strip).
- Occurrences 5 (it counts the first hook too). Mode: keep Extent.
- Length = strip - 2 margins - 1 hook = 120. OK.
- Better: type
=in Length and use a formula:Params.rack_width - 2 * Params.margin - Params.width. Occurrences:Params.hooks.
What we measured
| Setup | Hooks start at | Left end | Right end | Result |
|---|---|---|---|---|
| Length 180, 5 occurrences | 20, 65, 110, 155, 200 (4 steps of 45) | 20.00 mm | fifth hook floats 20.00 mm past the end (Measure); hook 4 to the end only 5.00 mm | 2 solids |
| Length 120 | - | 20.00 mm (Measure) | 20.0 (by code) | one solid, 96,500 mm³, 10 mm of air between hooks |
| Formula, strip 220, 6 hooks | Length 160 | 20.00 (Measure) | 20.0 (by code) | a typed 120 there leaves 60 at the right end (by code) |
FreeCAD’s only warning for the floating hook: “One transformed shape does not intersect the support (3 times)”. With the Body’s Allow Compound set to false, FreeCAD drops the copy instead (4 hooks), checked by code. “By code” is a script that reads the model. Exporting for printing is lesson 5; we printed nothing.
Then with Claude
Claude Code, freecad-mcp only; one run each, not a general result (amounts are Claude Code’s /cost):
- Run 1, one sentence, “five hooks spread evenly across the 180 millimetre strip” ($0.15): a LinearPattern with Length and Occurrences bound to Params, the same formula. It kept the 20 mm margin without being asked and offered equal 13.3 mm gaps as another option. Our check by code: 5 hooks, 20.0 / 20.0, one solid.
- Run 2, plus “keep 20 mm at each end, use a pattern, measure both ends” ($0.20): the same build. It reported 20.0 / 20.0, worked out in code, not with the Measure tool. Ours agree.
Neither run saved the file.
Your turn, no AI
Open the start file, set the strip to 220 and hooks to 6. What Length gives 20 mm at both ends? Type it, then measure both ends.
The course
- Previous: Lesson 8: assembly, hook on a rail
- Sizes in a spreadsheet: lesson 3 · formulas: lesson 4 · export: lesson 5
- Hooks round a post: lesson 12, polar pattern
- The same rack in SolidCraft: SolidCraft course, lesson 9
- Start of the course: Lesson 1: connect Claude to FreeCAD
- The lab for this lesson: freecad-course-lab/out/fc9
Sources
- The lab: scripts, logs, tests and every measurement above
Change notes
- 20 Nov 2026: first published, from the lesson’s lab results of 15-16 Nov 2026.
Not affiliated with or endorsed by the FreeCAD project, the freecad-mcp project or Anthropic. Found a mistake? Tell us in the video’s comments and we’ll correct this page.
Found this useful? The deep version lives on YouTube — new breakdowns of how AI dev tools actually work, weekly.
Subscribe on YouTube →Prefer email? Get the free newsletter: one failure, traced step by step, about once a week.