draw.Drawing

Methods

Method Reference: draw.Drawing.bbox

draw.Drawing: B = bbox (D)
draw.Drawing: [B, W, H] = bbox (D)

Axis-aligned extents of the drawing, as [xmin, ymin, xmax, ymax] in millimetres.

[B, W, H] = bbox (D) additionally returns the width and height, matching geom.bbox.

Curved entities contribute their true extent rather than their control points: a circle contributes its centre displaced by the radius in each of the four cardinal directions, and an arc contributes its two endpoints together with whichever of those four points its sweep actually passes through. Taking the centre alone would understate a circle by a radius on every side.

Two things are deliberately not accounted for, because the model does not know them: the rendered width and height of a text entity, of which only the insertion point is counted, and the dimension lines and text a backend will place at a dimension’s offset, of which only the two measured points are counted. A frame drawn to this box therefore needs a margin, which any drawing wants regardless.

An empty drawing has no extent, and returns an empty B.

Source Code: draw.Drawing