The new primitive is open in the Model Editor Window. Model elements that are created in the Model Editor define the interface of the primitive. The function of a primitive is defined in a separate file, the so-called primitive source. To edit the source, click on the Open Source button in the toolbar, select menu option from context menu or use the shortcut S. This will open a new window, the Primitive Source Editor, where you can edit the primitive source code.
The source that is created automatically when you create a new primitive already contains templates for the most important primitive source items.
Some of these items are generated directly from the interface definition developed in the Model Editor window. Changes to these items are lost when you save the primitive model next time.
For this example only the go entry must be changed. Scroll down the source or use the search function to find the go entry. Edit the entry to read as follows:
This implements the adding functionality and makes the primitive work. Click on the Save button to save the source and then on the Compile button (the second rightmost icon on the toolbar) or use the shortcut key F8.
If everything was typed in correctly, the compile will be done without error messages. If the compiler shows errors, they will appear in the Compilation Output frame at the bottom of the screen. Read them carefully to analyze what has gone wrong. Check your source code and make sure the names and properties of the ports and the parameters have been set correctly. Clicking on an error message will position the cursor at the beginning of the line where the error happened. You may close the Primitve Source Editor when the compilation was successful.