OpenSCAD Hex Bolt example

Beginner

Practical parts

Lesson 8 of 22

Encapsulate a dimensioned hex head in a reusable module.

Try changing:

across_flatshead_heightshaft_diametershaft_length

Low compile complexity. Two overlapping cylinders; the head intentionally has six facets.

How this model works

A six-sided cylinder has circumradius equal to across_flats / sqrt(3). The shaft slightly overlaps the head to avoid a face-only union. There are no threads in this lesson, so this blank will not screw into a nut. The advanced threaded-cap lesson builds an actual helical surface separately.

main.scad

Loading draft

Ctrl/Cmd+Enter or F5: preview · F6: render · Ctrl/Cmd+F: search · Ctrl+Space: complete · Tab: leave editor

0 messages

Make it your own

Create a second blank using the same module and different dimensions. Measure the head across opposite flat faces rather than opposite corners.

Change one parameter at a time and inspect the result. Use the workspace reset action to return to this lesson’s original model.

FAQ