Block Builder

Use the Block Builder tool to easily construct and customize basic blocks and programmable super blocks.

Benefits of Block Builder

The Block Builder simplifies the process of creating both basic blocks and programmable super blocks, which both share common features within the Block Diagram Editor (BDE). The Block Builder gives you a higher level of customization than a C Custom Block.

Usually, to create a block, you must provide its graphical and structural properties in an XML file. These properties include parameters, numbers of ports of different types, block size, color, and icon. For basic blocks, you also need to list the simulation functions used by the block and provide three OML functions that instantiate the block. In the case of programmable super blocks, only one OML function is required.

Block Builder simplifies the process by taking care of XML file creation and auto-generating most of the code for OML functions. You only need to provide the required information and part of the OML code.

Initiate Block Builder

To open the Block Builder, open the Tools ribbon, and then click the Block Builder button.

There are two ways to initiate the Block Builder: start from scratch or select an existing basic block or masked super block within the current diagram in the Block Diagram Editor.

When you choose the latter option, the properties of the selected block are mirrored in the Block Builder interface. This means that if no changes are made, Block Builder creates a duplicate of the selected block. In the case of a masked super block, the outcome is an equivalent programmable super block. This feature simplifies the process of defining new blocks, as you can begin with an existing block that closely resembles the one you want to create, saving you time and effort.

Interface

The Block Builder interface is organized into seven tabs:

  • Label: Define the default name of the block, its location, and its default visibility settings.
  • Atom: Specify the internal properties of the block. The specific settings vary depending on whether the block is a basic block or a programmable super block.
  • Properties: Document the block.
  • Parameters: Define the number, type, name, and default values of the block's parameters. You can also associate callback functions with these parameters.
  • Graphics: Set the block's shape, size, and color.
  • Ports: Determine the number of ports, their types, and their locations.
  • Icon: Link an image to the block's icon, and optionally, provide a second image for when the block is mirrored.