measuretools.overwrite_contents — Abjad v1.1.1 documentation

### Navigation

- index
- modules |
- next |
- previous |
- Project Abjad »
- Abjad v1.1.1 documentation »
- Abjad API »

# measuretools.overwrite_contents

`abjad.tools.measuretools.` `overwrite_contents`(expr, new_contents)

  New in version 1.1.1.

  Iterate measures in expr and replace current measure contents with new_contents.

  Pad extra space at end of measures with spacer skip.

  Return iterated measures.

      abjad> staff = Staff(measuretools.make([(1, 8), (3, 16)]))
      abjad> print staff.format
      \new Staff {
              {
                      \time 1/8
                      s1 * 1/8
              }
              {
                      \time 3/16
                      s1 * 3/16
              }
      }

      abjad> notes = construct.scale(4, Rational(1, 16))
      abjad> measuretools.overwrite_contents(t, notes)
      [RigidMeasure(1/8, [c'16, d'16]), RigidMeasure(3/16, [e'16, f'16, s1 * 1/16])]
      abjad> print staff.format
      \new Staff {
              {
                      \time 1/8
                      c'16
                      d'16
              }
              {
                      \time 3/16
                      e'16
                      f'16
                      s1 * 1/16
              }
      }

  Preserve duration of all measures.

  Skip measures that are too small.

  If not enough measures, raise `StopIteration`.

### Navigation

- index
- modules |
- next |
- previous |
- Project Abjad »
- Abjad v1.1.1 documentation »
- Abjad API »