Make a software block in "My Blocks"

new_project_menu

Make sure you are running the current version of Stackbuilder by downloading it from interstacks.com/stackbuilder

To make your own software block to use in Interstacks blueprints, select “New My Blocks Software” from the “Blocks” pull down menu in the Application’s menu bar. (Previous versions of Stackbuilder used an “Action” pull down menu in the “My Blocks" palette.) You will see a new entry in the “My Blocks” palette labeled “Untitled Script”. Click on that text and rename your block. Double click on the new entry to open a new tab in the Stackbuilder interface with the editor for software blocks.

make_software2

Interstacks software blocks are made using the Python scripting language. Every Interstacks block has input terminals that receive messages and output terminals that send messages. You can add an input terminal, and its associated input message handler, by clicking on the “+” icon in the top right, then selecting New Message Handler from the pop up menu that appears. You can add an output terminal by clicking on any of the “+” icons on the right side of any handler. The output terminals are not bound to any message handler in any way i.e. any message handler can send a message out of any output terminal. The “X” icons will delete a respective message handler or output terminal. You can rename any input or output terminal by clicking on the text and editing.

The message received by an input terminal’s message handler is in the variable “message”.

You send a message out of an output terminal by using I.sendmessage.
For example: I.sendmessage(2, ‘hello world’) sends the message ‘hello world’ out of terminal 2.
I.sendmessage(4, mylist[3] ) sends the fourth entry of the list “mylist” out of terminal 4.

Using I.debug, will display its arguments on the console trace. This is useful for testing your software block.
For example: I.debug(“Put this on the console trace”, mylist[3] )

There is another type of handler, called Startup Handler that can also be added to a software block. Its contents are run once, before any other handlers, when the block receives its first message.

When you want to put your new software block in a blueprint, drag and drop its entry from the “My Blocks” palette into the blueprint. You must click in the area to the right of the text name but inside its bounding rectangle.

Refer to other support documents for more information on Python programming and Interstacks.

Refer to documentation on many other topics at interstacks.com/support.
Please email info@interstacks.com with any questions.