draw.Drawing.expand
draw.Drawing: D = expand (D)
Replace every insert with the geometry it refers to.
The result holds no blocks and no inserts, only the entities they stood
for, each transformed to where its reference put it. This is what a
backend with no block of its own needs, and what
draw.Drawing.plot and draw.Drawing.tikz do before
rendering.
Every entity keeps the look the insert gave it, as CAD programs draw a
block. An entity of the block on layer '0' goes on the layer of
the insert, so a symbol drawn on '0' takes the layer it is
placed on; a colour, line type or line weight 'byBlock' becomes
the insert’s. An entity on any other layer stays there, and one drawn
'byLayer' keeps following its layer. Through nested blocks the
rule applies at every level, so an entity on '0' inside a block
on '0' ends on the layer of the outermost insert.
Blocks may contain inserts of other blocks and are expanded through. A block keeps its own definitions and inherits the enclosing drawing’s only for names it does not define itself.
A block cannot come to refer to itself: its drawing is captured by value when the block is defined, so redefining a name later cannot reach back into a definition already taken. The hundred-level limit is therefore a backstop against a construction this class does not permit, not a rule a caller can meet by accident.
See also: draw.Drawing.block, draw.Drawing.insert, draw.Drawing.plot
Source Code: draw.Drawing