Modify dimension text attributes

Modify dimension text attributes
 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
 4_DIMENSION_TEXT_CLASS_BY_TYPE = {
 5    ipDimensionType.dtLinear: ILinearDimension,
 6    ipDimensionType.dtAngle: IAngleDimension,
 7    ipDimensionType.dtRadius: IRadiusDimension,
 8    ipDimensionType.dtLeader: ILeaderDimension,
 9    ipDimensionType.dtAnnotation: IAnnotationDimension,
10    ipDimensionType.dtSweep: ISweepDimension,
11}
12
13if not active_drawing.isNone():
14    font = impact.system.fonts.item("Verdana")
15    if not font.isNone():
16        ab = active_drawing.active_layer.active_block
17        for ent in ab.entities:
18            if ent.entity_type == ipEntityType.etDimension:
19                ent_casted = IDimension(ent._com_obj)
20                ent_casted_text = (_DIMENSION_TEXT_CLASS_BY_TYPE.get(ent_casted.dimension_type) or IDimension)(ent._com_obj)
21
22                # not all dimensions have a text part, so check which type this is
23                if ent_casted.dimension_type != ipDimensionType.dtCentre:
24                    ent_casted_text.text_height = 10
25                    ent_casted_text.text_width = 8
26                    ent_casted_text.font = font