Using the component model

You can model the elements manually using the component model.

Procedure

  1. Open an existing model or create a new one.
  2. Add a new component for the external elements (for example, ExternalComponent).
  3. Set the scope of the component to Selected Elements.
  4. Create a package that contain all the external elements, and set its CG::Package::UseAsExternal property to Checked.
    Note: This step is optional; you can also add external elements to existing packages.
  5. Add the package that contains the external elements to the scope of the external component. Make sure that the package is not included in the scope of other components.
  6. Create an element that is referenced in the package.
  7. Provide the following information about the source files of the external elements:
    1. Create a hierarchy of packages as needed for the proper #include path. For example, suppose you want reference class C, which is defined in C:\MyProjects\Project1\MySubsystem\C.h; you would create the package MySubsystem.
    2. Add a file with the necessary name to the folder and map the external element to it. You do not need to add this file if the external element has the same name as the file.
    3. Create a usage dependency to the external component.
  8. Add relations to the external elements (for more information, see External element code access).

Results

In the generated files, the following #include is generated for the example element:

#include <MySubsystem\C.h>

Feedback