Skip to content

Block names helper

Dominic Oram edited this page May 13, 2020 · 2 revisions

There is a block name helper which can save you typing block names as strings and potentially making mistakes. This can be imported into your script or console with:

from genie_python import BLOCK_NAMES as b

usually as part of the genie import:

from genie_python import genie as g, BLOCK_NAMES as b

The typing b. will give you a list of current blocks; in the console you need to press tab. This can be used in place of a normal string in something like cget. For example

from genie_python import genie as g, BLOCK_NAMES as b

g.cset(b.TEMP, 10)
g.cget(b.TEMP)
g.show(b.TEMP)

Advanced

  1. If the block asked for is not in the current configuration this will still returns the block name and in addition will print a warning.
  2. Python has a few keywords and these can not be used in the b. syntax. If you have a block called this it will be replaced by the same name suffixed with two underscores. For example a block called while would be referred to be b.while__.
Clone this wiki locally