draw.Drawing

Methods

Method Reference: draw.Drawing.transform

draw.Drawing: D = transform (D, T)
draw.Drawing: D = transform (D, OP, VAL)
draw.Drawing: D = transform (D, OP, VAL, CENTRE)

Apply a planar transformation to every entity of the drawing.

The arguments after the drawing are those of geom.transform, and mean the same: a 3-by-3 homogeneous matrix, or a named operation ('translate', 'rotate', 'scale', 'mirror') with its value and an optional centre.

This is what lets a part be drawn once and placed more than once, a view be mirrored, or a detail be built at the origin and moved onto a sheet.

Entities are transformed, not just their points

A circle keeps its centre and scales its radius; an arc rotates its angles; text moves, rotates and scales its height; a hatch rotates its pattern and scales its spacing. A dimension carries its measured points and scales its offset.

A reflection reverses the sweep of an arc. Arcs run counter-clockwise from the first angle to the second, so mirroring one and keeping the order would silently give the complementary arc — the piece that was not there before. The endpoints are exchanged instead.

What is refused, and why

A non-uniform scaling that would turn a circle into an ellipse raises. There is no ellipse entity to put the result in, and quietly scaling the radius by one of the two factors would move the geometry off the part. A drawing with no arcs or circles scales anisotropically without complaint.

A rotation that would leave an axis-locked dimension off its axis raises, naming the entity. A 'horizontal' dimension measures the horizontal distance between two points; after a rotation of thirty degrees it would still measure a horizontal distance, but not the one the drawing was dimensioned for, and the number on the sheet would change without anyone asking it to. Rotations by a multiple of a quarter turn are fine and exchange horizontal with vertical; so are mirrors about either axis. A dimension made 'aligned' rotates freely.

See also: geom.transform, merge, bbox

Source Code: draw.Drawing