-
Notifications
You must be signed in to change notification settings - Fork 2
Q&A
How to produce graphical output in pxWorks
-
If you click on the “Graph” icon in the main menu, a new window should appear.
-
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.
-
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”
-
Generate random names for those graphical output files to have a history which you can go through with “arrow” buttons.
-
By default, only 100 latest graphical files are kept. Older files get deleted.
How to write a code block in R
-
Go into the library folder of the software and create a folder. Give the folder the name of the block.
-
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.
-
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.
-
Neither input nor output can have spaces in the name. It is advised that only ASCII names are used in socket names.
-
Create a file “run.meta” and place the executable name on the first line (“Rscript”) and name of the script on the second line.
-
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
-
Go into the library folder of the software and create a folder. Give the folder the name of the block.
-
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.
-
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.
-
Neither input nor output can have spaces in the name. It is advised that only ASCII names are used in socket names.
-
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.
-
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
-
Go into the library folder of the software and create a folder. Give the folder the name of the block.
-
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.
-
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.
-
Neither input nor output can have spaces in the name. It is advised that only ASCII names are used in socket names.
-
Create a file “run.meta” and place the executable name on the first line and name of the script on the second line.
-
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.