Development version.
Forge is under active development and testing. APIs, behaviour, coverage and
verification results may be incomplete or change without notice; published
PASS results are not a support guarantee or production-readiness claim.
Sketch.rectangular_pattern
Repeat a profile or earlier Sketch result with a native rectangular pattern.
Signature
Sketch.rectangular_pattern(self, source, *, count, spacing, direction=<Axis.X: 'X'>, count2=1, spacing2=None, direction2=None, alignment='right', alignment2='right', reversed=False, reversed2=False)Use when
Repeat one Circle, Slot or other supported profile without drawing every copy separately. The returned Sketch result represents the source plus its copies and may be passed to mirror() or another supported Sketch operation.
Limits
The operation must be authored inside the active Sketch. Current native qualification covers attached Sketch(on=…) use. The two counts may create at most 500 instances in total. Per-instance suppression is not supported. SolidCraft 0.42 stores the curves selected by a mirror when that mirror is created. If a pattern later creates extra curves after its count changes, those new curves are not added to that existing mirror automatically.
Parameters
source— A profile already in this Sketch, or a result returned by rectangular_pattern() or mirror() in the same Sketch.count— Number of instances in the first direction, including the original. Use a whole number from 1 to 500; a dimensionless Parameter may remain editable in SolidCraft.spacing— Distance between instances in the first direction, in mm. A length Parameter may remain editable in SolidCraft.direction— First sketch-local direction: Axis.X, Axis.Y or a fixed non-zero (x, y) vector. Defaults to Axis.X.count2— Number of instances in the second direction, including the original. Use a whole number from 1 to 500. Defaults to 1.spacing2— Optional distance between instances in the second direction, in mm. When omitted, SolidCraft uses the first spacing.direction2— Optional second sketch-local direction: Axis.X, Axis.Y or a fixed non-zero (x, y) vector. When omitted, SolidCraft uses the direction perpendicular to the first.alignment— Position of the original along the first direction: “left”, “center” or “right”. Defaults to “right”.alignment2— Position of the original along the second direction: “left”, “center” or “right”. Defaults to “right”.reversed— Reverse placement along the first direction. Defaults to False.reversed2— Reverse placement along the second direction. Defaults to False.
Example
with Sketch(name="Holes", on=board, parent=Anchor.TOP) as sketch:
circle = Circle2D(d=8)
row = sketch.rectangular_pattern(
circle, count=4, spacing=25, direction=Axis.X
)
with Sketch(name="Slots", on=board, parent=Anchor.TOP) as sketch:
slot = SlotCenterToCenter2D((0, 0), (20, 0), 8)
pair = sketch.rectangular_pattern(
slot, count=2, spacing=30, direction=Axis.Y
)