Sample Files
Introducing sample Python script files.
The Python Panel consists of a Script Box for entering scripts and a Console Box to display script execution results.
Installation of any version of Python 3.6 through 3.13 and specification to LD_LIBRARY_PATH is required to execute Python scripts. If it is not installed, please download it from the Python official website or use your OS package manager to install it.
If you cannot install Python in your environment, you can also use a Python package dedicated to neoEBV to run Python scripts. Download the Python package dedicated to neoEBV, and install the package with the following command.
$ nebv --python-package-add=/path/to/libpython-for-neoEBV.3.6.tar.gz
Icon | Item | Action |
---|---|---|
Run | Executes the script entered in the Script Box. | |
Clear Console Before Run | If it is ON, clears the Console Box before executing Run. | |
Clear Console | Clears the content of the Console Box. | |
Load Script File | Opens a dialog to load a script from a file into the Script Box. | |
Save Script File | Opens a dialog to save the content of the Script Box to a file. | |
Python | Displays the Python Panel menu. |
Specifies arguments to be passed to the script at script runtime. The input string is interpreted as a space-separated list of runtime arguments. A space enclosed in ""
is not interpreted as a delimiter.
Arguments specified in the Argument Box can be used in scripts by importing the sys
module.
argv[0]
contains the string “ScriptBox”. The specified arguments can be accessed from argv[1]
and more in the order specified.
import sys
# "ScriptBox"
print(sys.argv[0])
# The first argument specified
print(sys.argv[1])
Menu | Action |
---|---|
Run | Executes the script entered in the Script Box. |
Clear Console Before Run | If it is ON, clears the Console Box before executing Run. |
Clear Console | Clears the content of the Console Box. |
Load Script File | Opens a dialog to load a script from a file into the Script Box. |
Save Script File | Opens a dialog to save the content of the Script Box to a file. |
Float Panel | Floats the panel. |
Close Panel | Closes the panel. |
Access to the neoEBV process is enabled through the pynebv module. Since the pynebv module is already imported, ‘import pynebv’ is not needed to be written.
# Open a file and set the display state for each layer
chip = pynebv.file.open('/path/to/file.oas')
# Operations for multiple layers together
layers = chip.layers()
layers.color = 'Red'
# Operations specifying the layer number
chip.layer(1).color = 'Blue'
chip.layer(2).bold = True
chip.layer(3).fade = False
chip.layer(4).outline = False
# Operations at the chip level
chip.hatch = 'vertical'
# Create a mark called 'Mark1' and use the middle-sized thumbnail
mark = pynebv.mark.add((100,100), "Mark1")
mark.thumbnail_image_size = "Middle"
# Change the screen's display area
pynebv.screen.area((90,90,110,100))
# Make file names containing the string 'error' red and bold
errorChips = pynebv.file.items('*error*')
if len(errorChips) > 0:
errorChips.color = 'Red'
errorChips.bold = True
# Traverse Marks and save images
marks = pynebv.mark.items()
index = 0
for mark in marks:
index = index + 1
pos = mark.pos
pynebv.screen.area((pos[0] - 10, pos[1] - 10,pos[0] + 10,pos[1] + 10))
pynebv.screen.save_image('~/' + str(index) + '.png')
Please refer to the pynebv Reference page.
Introducing sample Python script files.