draw.Drawing.merge
draw.Drawing: D = merge (D, D2, …)
Append the entities of one or more drawings to this one.
D = merge (D1, D2) returns a drawing holding
every entity of D1 followed by every entity of D2, each
keeping the layer, line type and colour it was drawn with. Any number of
drawings may be given.
The result takes its name and its current layer, line type and colour from the first drawing. Those are the state a caller would carry on drawing with, and the first drawing is the one being added to.
Merging is what turns separately-built parts into an assembly, or
separately-built views into a sheet. With transform it is the
whole of composition: build once, place as often as needed.
See also: transform, numentities, layers
Source Code: draw.Drawing
transform and merge together are composition: build a part once and place it as often as needed.
part = draw.Drawing ().circle ([0, 0], 8).line ([-12, 0], [12, 0]) ...
.line ([0, -12], [0, 12]);
sheet = draw.Drawing ('assembly');
for k = 0:3
sheet = sheet.merge (part.transform ('translate', [30 * k, 0]));
endfor
big = part.transform ('scale', 2);
sheet = sheet.merge (big.transform ('translate', [50, -45]));
numentities (sheet)
ans = 15
plot (sheet);
title ('one part, five placements');