Patterns (Linear, Polar & Curve)
LinearPattern(shape, direction, count, spacing) repeats a solid along a
direction; PolarPattern(shape, count, angle=360) repeats it around an axis
(Z through the origin by default — set axis_origin / axis_direction). The
first copy is the original, so add only the pattern to the part.
Patterning a cutting feature patterns the cut: the six bolt holes above are a
single Extrusion(..., cut=True) inside a PolarPattern. With the default
angle=360 the copies are spread evenly; with a smaller angle the first and
last copies sit at 0° and angle.
These are 3D patterns of solids. To repeat 2D shapes inside a sketch, see Sketch operations.
Grids and curve patterns
LinearPattern takes an optional second direction: direction2, count2 and
spacing2 repeat every copy along it too, for a count × count2 grid
(self.linear_pattern(hole, [1, 0, 0], 2, 44, direction2=[0, 1, 0], count2=2, spacing2=44) drills the 2 × 2 corner holes below). Without them the pattern is the
one-direction pattern it always was.
CurvePattern(shape, path, count, align_to_path=False) (shortcut
self.curve_pattern(...)) places copies along a 3D path — a Spline3D (two
points make a straight path) or a Helix3D — evenly spaced by arc length:
- the first copy is the original: draw it at the start of the path. Every copy keeps the seed’s offset from the path point it sits on;
- on an open path the copies run from the start to the end; on a closed one (start = end) they are spread evenly around it;
align_to_path=Truealso turns each copy with the path — the steps below keep pointing at the column. Without it the copies are only moved.
Pattern the whole body
Pass shape=None to repeat the part’s body built so far instead of one feature
(Onshape’s body pattern), e.g. self.linear_pattern(None, [1, 0, 0], 3, 10)
after building a post makes three posts. As with fillet_edges, it works on
every operation before it, and later operations apply on top.