Creating text entities in every font¶
Creating text entities in every font¶
1# This example creates text entities using every font
2# available to the impact.system
3
4# Create some useful variables
5fonts = impact.system.fonts
6ad = impact.active_drawing
7ab = ad.active_layer.active_block
8
9# get the first text style sheet
10text_style_sheet = ad.text_style_sheets.item(1)
11
12# Select and delete any visible geometry
13ab.select_all()
14ab.delete_selected()
15
16# define a coordinate to position some text entities
17x = 0
18y = 0
19
20# iterate all the fonts and create a new text entity
21# using that font
22for font in fonts:
23
24 # create the text entity based upon the style sheet
25 new_text_entity = active_block.text_ad(x, y, font.full_name, text_style_sheet.text_style)
26
27 # override the style sheet of the text entity
28 new_text_entity.text_style.font = font
29
30 # change the y coordinate for the next text entity
31 y = y + (new_text_entity.text_style.height * 3)
32
33# view the extents
34impact.gui.active_window.view_extents()
35