Create Ports and Parameters

You can create an arbitrary number of input and output ports. To create ports either use the appropriate tool buttons Add Input Port and Add Output Port, or use the shortcuts I for input port and O for output port. Alternatively click Edit on the main menu bar and select the appropriate options.

For this example we need two input ports and one output port:

  1. Select the Add Input Port button from the toolbar.

    Your pointer has switched to a different mode. Every time you click in the gray rectangle of your primitive in the Model Editor window which represents the bounding box of your model, a port will be generated.

  2. Click on the side of the gray rectangle (bounding box) in the Model Editor window to create a new input port. It will be put near your cursor location. A second click creates a new input port. You may have to drag the ports to a suitable position if they are on top of each other. The ports Input1 and Input2 have been created.
  3. Switch back to the default pointer mode by right mouse click or by clicking the Select Tool icon.
  4. You can drag the newly created port and move it anywhere in your primitive view using the left mouse. The gray rectangle resizes automatically.
  5. Select the Add Output Port button from the toolbar.
  6. Click on the side of the gray rectangle (bounding box) in the Model Editor window to create a new output port.

Another method to create new ports is to press [ctrl] and then click on an existing port you wish to copy. You can now drag and drop the port you wish to duplicate.

When using the context menu option Add Input/Output Port your mouse pointer will not change and one new port will be placed in the Model Editor window. The Edit menu works in the same way as the context menu.

Your primitive should now look like this:

We now need to change the properties of each port.

  1. Click on the first input port Input1. The Property Editor (in the lower left of your MLDesigner window) now displays the Port Properties of your port Input1.
  2. Next to Data Type click on the anytype entry and change it to float.
  3. You can change the name from Input1 if you like.
  4. Repeat the procedure for Input2 and Output1.

We now need to add a parameter to the primitive. A parameter is used as a fixed value to change the behavior of the primitive without recompiling it.

  1. Make sure no port is selected in the primitive window. If needed, click somewhere in the primitive window, without selecting any elements, to switch the property editor back to the Primitive Properties. The Property Editor should have the first entry named Logical Name with the name of your primitive MySimpleAdder.
  2. Right-click with the mouse somewhere in the Property Editor. Use the New Parameter context menu item. The new parameter (indicated with a P icon) is now listed on the bottom of the list.
  3. Click on the Name row and change the name of the parameter to ScaleFactor.
  4. Change the Data Type row to float.
  5. Change Value to 1.0
  6. Changes to other fields are not necessary.

Before adding functionality to the primitive, save it by clicking on the Save button in the toolbar.