Skip to content
cloudcell edited this page Mar 5, 2023 · 1 revision

How to produce graphical output in pxWorks

  1. If you click on the “Graph” icon in the main menu, a new window should appear.

  2. This window displays graphics files saved in a special sub-folder in your project folder. By default this folder is called “output.graphics” but you can change this name in settings.

  3. To make this window show the graphical output from your code, simply make your code save a “*.png” file into that folder. Basically, your code has to save graphics to this path “../output.graphics/random_filename.png”

  4. Generate random names for those graphical output files to have a history which you can go through with “arrow” buttons.

  5. By default, only 100 latest graphical files are kept. Older files get deleted.

How to write a code block in R

  1. Go into the library folder of the software and create a folder. Give the folder the name of the block.

  2. If a block should have inputs, create a simple text file “sockets_i.meta” and place each input name on a new line. End the file with an empty line.

  3. If a block should have outputs, create a simple text file “sockets_o.meta” and place each output name on a new line. End the file with an empty line.

  4. Neither input nor output can have spaces in the name. It is advised that only ASCII names are used in socket names.

  5. Create a file “run.meta” and place the executable name on the first line (“Rscript”) and name of the script on the second line.

  6. Using existing scripts as templates, write a script for the block and place it inside the folder created in step 1.

Press on the refresh icon in the library deck.

Now you should see have a block in your library. Any folder containing a file “run.meta” is treated as a block folder.

How to write a code block in Python

  1. Go into the library folder of the software and create a folder. Give the folder the name of the block.

  2. If a block should have inputs, create a simple text file “sockets_i.meta” and place each input name on a new line. End the file with an empty line.

  3. If a block should have outputs, create a simple text file “sockets_o.meta” and place each output name on a new line. End the file with an empty line.

  4. Neither input nor output can have spaces in the name. It is advised that only ASCII names are used in socket names.

  5. Create a file “run.meta” and place the executable name on the first line (“python” or “python3”) and name of the script on the second line.

  6. Using existing scripts as templates, write a script for the block and place it inside the folder created in step 1.

The procedure is essentially the same as writing a block in R with the only difference that the file “run.meta” should have “python” or “python3” in the first line.

Press on the refresh icon in the library deck.

Now you should see have a block in your library. Any folder containing a file “run.meta” is treated as a block folder.

How to write a code block in any scripting language

  1. Go into the library folder of the software and create a folder. Give the folder the name of the block.

  2. If a block should have inputs, create a simple text file “sockets_i.meta” and place each input name on a new line. End the file with an empty line.

  3. If a block should have outputs, create a simple text file “sockets_o.meta” and place each output name on a new line. End the file with an empty line.

  4. Neither input nor output can have spaces in the name. It is advised that only ASCII names are used in socket names.

  5. Create a file “run.meta” and place the executable name on the first line and name of the script on the second line.

  6. Using existing scripts as templates, write a script for the block and place it inside the folder created in step 1.

Press on the refresh icon in the library deck.

Now you should see have a block in your library. Any folder containing a file “run.meta” is treated as a block folder.

Clone this wiki locally