Generating code for individual model elements

You can generate code from the Code menu, the browser, or an object model diagram.

About this task

Before you generate code for a class or package, you must set the active configuration, as if you were generating the executable file for the entire model. For more information, see Setting the active configuration.

To generate code for selected elements, using the Code menu

Procedure

  1. Select a class from the browser, or select one or more classes in an object model diagram.
  2. Select Code > Generate > Selected Classes.

    If you have generated code for the entire model at least once, the Generate command generates code only for elements that have been modified since the last code generation.

  3. Select a class from the browser, or select one or more classes in an object model diagram.
  4. Select Code > Re Generate > Selected Classes.

To generate code for selected elements, using the browser

Procedure

  1. In the browser, right-click a package or class.
  2. Depending on your choice:
    • For a package, select Generate Package from the menu to generate code for all classes in the package.
    • For a class, select Generate Class to generate code only for that class.

To generate code for selected elements, using an object model diagram

About this task

Right-click the class and select Generate Class.