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 spline, path or region moves as the exact curve it is; a hatch moves its region, rotates its pattern and scales its spacing. An insert turns and scales the block it places. A dimension carries its measured points and its offset, a diameter or radius dimension its radius and direction, an angular dimension its radius; one with no label of its own is labelled with what it measures whenever it is drawn or written, so its label follows it. A dimension’s ticks and text, a centre mark and a leader keep their size: they are sized only when drawn, by 'DimScale', so they reach the sheet at the same size at any scale, as draw.Drawing.print describes.

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, and for the same reason the bulges of a polyline change sign and the arms of an angular dimension are exchanged.

What is refused, and why

A non-uniform scaling that would turn a circle into an ellipse raises. transform makes no ellipse out of a circle or an arc, and quietly scaling the radius by one of the two factors would move the geometry off the part. An ellipse, a spline, a path, a region or a hatch refuses it too, as do a polyline with arcs, an insert and a diameter, radius or angular dimension. A drawing of lines and polylines without arcs scales anisotropically without complaint.

An insert cannot be mirrored, since it places its block turned and scaled but never reflected; mirroring one raises, naming it. Expand the drawing first with draw.Drawing.expand to mirror what the insert places.

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, draw.Drawing.merge, draw.Drawing.bbox

Source Code: draw.Drawing