Back to the journal

Pattern Commands

7 minutes read

Patterns add repeating surface markings to shapes. They're for things like drawing bricks, corrugated siding, stones and similar patterns to your models. Following our "batteries included" philosophy, they are clever about common needs, such as drawing the side of bricks, following arches for e.g. bridges, and dealing with cuts in the shapes. Paper output shows lines, laser output uses engraving paths, and 3D output will recess the markings as grooves.

You can easily try any of these on makeacut - just create a new design and paste these in.

lines

Draws parallel lines for hatching, siding, or simple surface texture. Use spacing for the distance between lines and angle to rotate them.

units mm

group:
    rect 40 30
    pattern lines:
        spacing 3
        angle 45
        margin 1

crosshatch

Draws two perpendicular sets of lines. Use spacing for a square grid, or size width height for different spacing in each direction.

units mm

group:
    rect 40 30
    pattern crosshatch:
        spacing 4
        angle 45
        margin 1

tiles

Draws a rectangular grid with aligned joints. Use equal width and height for square tiles, or different values for rectangular tiles.

units mm

group:
    rect 40 30
    pattern tiles:
        size 8 6
        margin 1

bricks

Draws brick courses with alternate rows offset by stagger.

The default stagger 0.5 gives a half-brick offset; stagger 0 aligns all joints. This example also shows how the pattern stops at a window opening.

units mm

group wall:
    subtract:
        rect 60 36
        move 22 9
        rect 16 18

    pattern bricks:
        size 8 3
        stagger 0.5
        margin 1

floorboards

Draws long boards with staggered end joints. size sets board length and width. Each successive row advances its joints by the stagger fraction of the board length, rather than alternating between two row positions.

units mm

group floor:
    rect 50 30
    pattern floorboards:
        size 15 3
        stagger (1 / 3)
        margin 1

stones

Draws irregular adjoining stone shapes with straight joints. size controls their average width and height. A fixed seed keeps the arrangement repeatable; change it to try another layout. Resizing the panel reveals more of the same arrangement.

units mm

group wall:
    rect 40 30
    pattern stones:
        size 5 4
        seed 42
        margin 1

Shared appearance defaults

Set appearance once with defaults pattern: before drawing geometry. Individual patterns can override these settings. Explicit mm suffixes keep stroke and groove dimensions fixed even when the drawing uses a modeling scale. For 3D grooves, keep depth shallower than the material thickness.

units mm

defaults:
    thickness 3

defaults pattern:
    color "#777777"
    line-width 0.15 mm
    groove-width 0.4 mm
    depth 0.3 mm

group:
    rect 40 30
    pattern bricks:
        size 8 3

Reusable presets

This lets you declare a "named pattern", which you can then reuse amongst many different parts.

Apply it with --pattern name on a group, part, add, or subtract block. Patterns attached to a part move and rotate with each placement.

You can also customize a specific use of a named pattern: put pattern --use name: inside its block and list the settings to override.

units mm

pattern bricks --name wall_bricks:
    size 8 3
    stagger 0.5

part wall --pattern wall_bricks:
    rect 40 30

place wall
move 45 0

group:
    rect 40 30
    pattern --use wall_bricks:
        at 4 0

Following a curve

Use follow name to bend any pattern along a previously drawn named line, arc, Bézier, or band. size measures along and outward from the guide. This example makes radial brick joints around an arch. 

units mm

group arch:
    arc 20 -180 --angle 90 --name inner_arch
    line 5 0
    angle 90
    arc 25 180
    line 5 0

    pattern bricks:
        follow inner_arch
        size 5 5
        stagger 0.5

Continuing joints down the sides

Use sides aligned to continue top joints vertically down outside edges in 3D. Closed hole walls are excluded. Keep margin 0 so joints reach the edges; a positive margin prevents side continuation. Use sides none to disable an inherited setting.

units mm

cut --thickness 3:
    rect 40 30
    pattern bricks:
        size 8 3
        sides aligned
        groove-width 0.4 mm
        depth 0.3 mm

More from the notebook