Formula version: 1.0.0. This methodology describes a planning estimator, not structural design or installation approval.
Post topology and clear gates
Run lengths use post centrelines. A clear face-to-face gate beginning at clearStart, with clear width gateWidth and post face width postWidth, becomes two fixed gate-post centre nodes:
left centre = clearStart − postWidth ÷ 2
right centre = clearStart + gateWidth + postWidth ÷ 2
The existing MaterialNest fence-post engine divides every uninterrupted centreline interval into equal spans no greater than the user-entered maximum. Shared endpoint IDs are counted once. Clear bay width subtracts half of each adjacent post face from the centre spacing.
Boards and panels
For solid vertical boards, each bay uses ceil(clear bay ÷ board width) boards. A partial final board is reported as a rip and is blocked unless the user allows it.
For spaced pickets, the user chooses either equal gaps only between pickets or equal gaps between pickets and at both post faces. The smallest whole count satisfying the selected gap-slot convention and entered maximum gap is tested. The resulting gap must be nonnegative and no greater than the maximum; the both-edge mode also supports a single-picket bay.
Panels are rounded independently in every bay. A residual panel is permitted only when the user confirms cutting; remnants are not silently reused across runs.
Rail stock and fasteners
Every rail row in every bay creates a distinct cut. The cut is either post-centre to post-centre or clear bay plus the user-entered bearing at both ends. Stock allocation uses the deterministic objective: fewest pieces, least purchased length, least discarded remainder, most reusable remainder, then stable IDs.
A cut shorter than the remaining stock consumes its length plus entered kerf. A cut that exactly reaches the stock end within 0.001 mm consumes no trailing kerf. Large allocations use a deterministic heuristic. When the bounded exact search reaches its complexity limit or an optimization is unavailable, the result falls back conservatively to one shortest fitting stock item per cut and says so explicitly.
Fasteners are the sum of rail-end connections, board-to-rail connections, panel-end connections, and user-entered gate fasteners. Contingency is applied before package division; packages round up. Package surplus is kept separate from contingency and cut loss.
Limitations
The model excludes horizontal, shadowbox, board-on-board, sloped and racked layouts, structural gate design, post/footing selection, wind resistance, permits, and code compliance. Manufacturer examples may explain terminology but do not become hidden defaults.
Primary workflow references: 811 Before You Dig, The Home Depot fence overview, and The Home Depot panel guide.
Last reviewed: August 7, 2026. Corrections can be reported to feedback@materialnest.com.