-
Notifications
You must be signed in to change notification settings - Fork 1
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)
- 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.
- 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__.