On this page:
The CATIA Software Producer allows you to generate and build code from a SysML model. You can generate code, for example, from the SysML State Machine or SysML Internal Block Definition diagrams. The code generation and building are executed via the 3DEXPERIENCE platform.
For more information about the Software Production Engineering application, see Software Production Engineering.
Prerequisites
- The CATIA Software Producer Client plugin is installed in your modeling tool. Learn more about how to download the installation files.
The 3DEXPERIENCE platform is on the cloud.
You have the Software Production Engineer Role. It will give you permission to use the service.
Working with the code generator
Before starting to work on code generation, first, you have to connect to 3DEXPERIENCE by entering the URL of the Software Producer cloud server. After that, you will be able to log in with your regular identifiers.
For information about how to authenticate with the 3DEXPERIENCE platform, see Authentication with 3DEXPERIENCE platform.
To generate the code in the SysML diagram
In the open SysML diagram, select the element you want to generate.
If you do not select any particular element in the diagram, the entire diagram view is selected as the generation input.
- Do one of the following:
- In the diagram toolbar, click the Code Generation button.
- From the selected element's shortcut menu, select Code Generation and click Run Code Generator.
In the open Operation Details dialog, specify the needed SPO configurations.
Use the Commit section to commit the code to the branch associated with the input element.
- (optional) Specify the download location if you want the results saved on your local file system.
To save the specified properties, click the Apply button.
The properties are saved in the model via the “CATIA – Embedded Software Profile” (EmbeddedSoftwareProfile.mdzip) profile:
- some properties are attached to the input element (commit and download options);
- other properties are attached to the configuration Class element (SPO–related options). The Class elements are created to save the SPO configurations in the model.
- To save the specified properties and initiate the code generation, click the Run button.
All the configuration properties are stored in a Class element, which is created when you click the Apply button in the Generation Details dialog. You can edit the configuration properties when needed.
To edit configuration properties
- In the Containment tree, right-click a Class element of the needed configuration.
- In the shortcut menu, click Software Code Generation and select Edit Configuration.
- In the open Generation Configuration dialog, make your changes.
- Click OK.
You can deactivate the SPO you do not need.
To deactivate the SPO
- In the main menu, click Options > Environment. The Environment Options dialog opens.
- In the dialog, go to CATIA Software Producer Client > Operations.
- Select the needed operation and click the Change activation status button.
You can switch projects (or even shut down your computer, saving your work first) while waiting for the generation result as it is running on the cloud and as the widget keeps the ids of the cloud assets in the record files located in <local workspace path>\etc\operations\spoRecordFile.json (you have access to it if you need it for the debugging purpose for example). When you come back, another dialog will tell you that operations were running while you were away and will propose you inspect the result and download it.
Information
In the Software Producer Log panel, you can see the messages of the running SPO.
This information is saved in the log file next to your project files. To open the log file location quickly, in the Software Producer Logs window, click the Show Log File button. Each project has its own log file.
A log file for general Software Producer messages not related to a specific project is stored next to the modeling tool log file.
At the bottom right corner of the modeling tool, in the progress bar, you can see whether the SPO is running. After the SPO is completed, the notification is displayed showing the status of the generation.
When an SPO produces a report, the plugin reads it and opens it in a Validation Result window if any element has a diagnostic associated.
A diagnostic is associated with a rule consisting of a severity, message, and source.
You can navigate to the source in the Containment tree. If you need to show more details concerning the rule or open the full report, right-click the appropriate lines of the table.
You can turn off the Validation Results window's opening after the SPO produces a report.
To turn the validation report off
- In the modeling tool main menu, click Options and select Project.
- Set the Show Validation Report property to false.
The full set of code you need to generate to cover your target is composed of at least a component and a target-specific part. Component part is relative to the behavior of your application (such as State Machine) whereas the target-specific part is relative to the architecture of your application (such as IBD). In other words, target specific is the binder and the link between the component and the target. As one does not go without the other, this is why at the end of the IBD generation, a dialog will ask you if you want the applicative code to be automatically generated if you have not yet done it (or if it has changed).
Once the full set of code has been generated, you can launch a build SPO by clicking on the Build button.
When you click a Build button, a dialog opens, wherein you need to specify the target and the available parameters (if there are any).
The code is downloaded to your file system following a specific folder hierarchy:
The target name is present only if the related folder is the result of target-specific generation or build.
- esp_workspace1
- <componentA_name>[_<targetX_name>]
- src
- bin2
- <componentB_name>[_<targetX_name>]
- src
- bin
- <componentA_name>[_<targetX_name>]
- etc
- backup3
- logs
- softwareProducer.log4
- You can change the root of the local workspace path in the project options.
- A bin folder is created only if the related component is the main component for the build.
- By default, a backup of your downloaded files is saved in this folder so that in case something wrong happens with the download of new files, you can still reach your previous files. You can disable this option in the Project Options dialog.
- Log files are rotated by size and date so that you might see multiple log files here.
The roundtrip action is a feature available for State Machines and Opaque Behaviors. Using the roundtrip action, you can add the modification you made in the code in between BEG_USER_CODE / END_USER_CODE tags (in files commonly named <ComponentName>_usr.c), back into the model and synchronize the file on the workspace on the cloud.
The following commands are available from the diagrams toolbar or from the shortcut menu of the supported elements in the Containment tree:
Button | Description |
|---|---|
Code Generation | Generates the code for the selected elements in, for example, the State Machine or Internal Block Definition diagrams. If the entire diagram is selected, the code is generated for the whole content. The generation result is downloaded to your machine. |
Build | After the code is generated, launch the SPO build and download the result on your machine. If you launch the SPO build when the code is not been generated yet, the code will be generated automatically in the build process. |
Show in File Explorer | Open a location in your file system wherein the Software Production Operation results file is stored. |
Roundtrip | The changes made in the generated code are applied in the State Machine diagram or Opaque Behavior. |
Associating Source Code Management repository to model
The following features are related to software governance:
- Source Code Management (SCM) repository association with the model.
- Generation results commit to the SCM.
To associate an SCM repository to the model
- In the Containment tree, right-click the appropriate package.
- In the shortcut menu, click Software Code Generation and select Associate SCM Repository.
- In the open Associate SCM Repository dialog, choose the needed repository.
- Click OK.
To commit the generation results to the SCM
- Initiate the code generation.
- In the open Operation Details dialog, Commit area, select the Commit to branch check-box.
- Click the ... button.
- Select the needed branch.
- Click OK.
Sample project
The sample project Flashlight_SOP.mdzip is located in <modeling_tool_installation_directory>\samples\CATIA Software Producer. You can also open the Flashlight_SOP sample project from the modeling tool's Welcome screen, Samples tab.











