Creating a graphic solid fill¶
Creating a graphic solid fill¶
1# Create a graphic entity with colour fill, using area defined by entities.
2
3# Select all Cut type entities, for example
4ab = impact.active_drawing.active_layer.active_block
5ab.select_none()
6ab.select_expression("(Palette Type == Cut)", ipSelectExpressionMode.smAdd)
7
8# Configure the graphic options to use solid fill
9g_options = impact.creator.graphic_options()
10
11# Colours are specified with long integers, which represent BBGGRR (blue, green and red values).
12# In VBS, a convenient way to create these is via a hex string passed to the CLng function.
13
14g_options.print_face.graphic_type = ipGraphicType.gtSolid
15g_options.print_face.fill_colour = 0x0000FF # red
16
17g_options.die_face.graphic_type = ipGraphicType.gtSolid
18g_options.die_face.fill_colour = 0x00FFFF # yellow
19
20g_options.graphic_fill = ipGraphicFill.gfSelectionPolygon
21
22# Now create the graphic entity
23# Note that the X, Y, Width and Height parameters are not used for solid fill
24g_ent = ab.graphic_ad(0, 0, 0, 0, g_options)