Connection Extension / BaseModule

If you plan to write a general communication protocol integration then this is the correct page for you.

The sp.BaseModule supports events as well as actions. - Receive commands and/or data within Grid. - Send commands and/or data from Grid. - Supports user data

Sample

This are the minimum requirements to register a plugin:

import sp

class IO_Plugin(sp.BaseModule):

    pluginInfo = {}

    def __init__(self):
        sp.BaseModule.__init__(self)

if __name__ == "__main__":
	sp.registerPlugin(IO_Plugin)
This is how it will look within the Project Tree, if not modified with the pluginInfo parameter
This is how it will look within the Inspector when not modified with the pluginInfo parameter

Main Class

The class name IO_Plugin can be customized and should be unique.

class IO_Plugin(sp.BaseModule):

While sp.BaseModule can´t be renamed.

Plugin Info

Each plugin needs a pluginInfo parameter. Within this you can define Icons, search Keywords, custom object names and much more. For more information see here.

Initialization

Within your Main Class it´s necessary to define a function for the initialization:

    def __init__(self):
        sp.BaseModule.__init__(self)

Register

To register the plugin you need the following lines of code outside of your Main Class:

if __name__ == "__main__":
	sp.registerPlugin(IO_Plugin)

Last updated