Modify dimension text attributes (Python)

Modify dimension text attributes (Python)
 1# Find all dimensions in this block and make them use a standard size and font
 2# Note that it's often better to use dimension master tool settings to acheive this.
 3
 4if not impact.active_drawing.isNone():
 5    font = None
 6    try:
 7        font = impact.system.fonts.item("Verdana")
 8    except Exception as exc:
 9        pass
10    impact.gui.output_toolbox.add(f"Failed to create object via impact.system.fonts.item(): {exc}")
11    if not font.isNone():
12        ab = impact.active_drawing.active_layer.active_block
13        for ent in ab.entities:
14            if ent.entity_type == ipEntityType.etDimension:
15                # not all dimensions have a text part, so check which type this is
16                if ent.dimension_type != ipDimensionType.dtCentre:
17                    ent.text_height = 10
18                    ent.text_width = 8
19                    ent.font = font