The CATIA Software Producer allows you to generate and build code from a UML or SysML model. You can generate code, for example, from the UML Class structure, UML State Machine, or SysML Blocks. The code generation and building are executed via the 3DEXPERIENCE platform. Key concepts and capabilitiesCATIA Software Producer offers the following generation capabilities: - Generating C++ classes from UML structured classes
- Generating C and C++ code from UML behaviors
- Generating target dependent middleware code including AUTOSAR classic and adaptive
- Generating and compiling code for FMU
- Generating code from a model persisted as a file, or in TeamWorkCloud or in the 3DEXPERIENCE Platform.
- Generate code containing traceability information establishing the relation from the model items to the code.
CATIA Software Producer uses the concept of target configuration to guide the user in configuring the code generation process. PrerequisitesBefore 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. If you start working with CATIA Software Producer for the first time in your project, a dialog will open to configure the local workspace path which will host generated resources.  Working with Configuring the code generatorThe principle The generated code is composed of a behavior part and a middleware part. It is identified as a target. The behavior part is relative to the behavior of your application (such as State Machine) whereas the middleware part is target-specific and is generated from the architecture of your application (such as IBD). 
As the code is composed of multiple entities, multiple configurations are required. You will be guided in the configuration through multiple dialogs to create the target configuration.
| Anchor |
|---|
| code_generation |
|---|
| code_generation |
|---|
| To configure the code generation in the generator
- Do one of the following:
- In the open SysML diagram:
- Select the element you want to generate
:- In the open SysML diagram
- . If you do not select any particular element in the diagram, the entire diagram view is selected as the generation input.
- In the
Containment tree. Do one of the following:In the - diagram toolbar, click the Configure Target
Image Modifiedbutton.
- In the Containment tree:
- Select the element you want to generate.
- From the selected element's shortcut menu, select Software Code Generation and click Configure Target.
Image Modified
In the open Generator Details dialog, specify the needed SPO configurations, configure the target of your generation: Select the operation in charge of the target you expect. For example, the target can be C code, C++ code or an FMU.
Image Modified
- (optional)
Specify - Check and specify the download location if you want the results saved on your local file system.
The - The generated files will be downloaded
to the - under this location, in a folder named after the
Configuration - configuration name.
- Click the OK button.
If the operation you selected (for example FMU Target Build) requires some other additional operations to be run beforehand, you will have to configure those operations in the next dialogs that will be opened automatically. The whole will constitute your “Target Configuration”.executed, additional dialogs open to configure them. Once the end of the configuration process is reached, i.e. you have fully configured your target, under the Configuration package you will find: - The Generator Configurations package1: this is where classes are created to save common properties of generators (parameters especially).
- The Target Configurations package1: this is where packages are created to
store - save the flow of a target. Within this package, classes are created to save specific properties for each SPO (download options, input, and generator mapping).
1You can change the default name of those packages in the Environment Options > CATIA Software Producer Client General Properties > Configuration section
| Info |
|---|
The configurations are saved in the model via the “CATIA – Embedded Software Profile” (EmbeddedSoftwareProfile.mdzip) profile. |
Executing the code generatorTo execute the code generator
- Do one of the following:
- In the open SysML diagram:
- Select the element you want to generate
- In the open SysML diagram
- . If you do not select any particular element in the diagram, the entire diagram view is selected as the generation input.
- In the
containment tree. Do one of the following:
- In the
- diagram toolbar, click the
Image ModifiedGenerate Target button and choose Generate Target.
Image Modified
- In the Containment tree:
- Select the element you want to generate.
- From the selected element's shortcut menu, select Software Code Generation and click Generate Target.
All the operations you configured previously will be launched one after the otherThe target will be generated based on your configuration: - If you click Generate Target, the operations will be launched only if it has not yet been launched or if an element has changedgeneration will be performed for the modified elements in the model.
- If you click Full Generate Target, all the operations generation will be launched, regardless of a previous executionfully performed.
Edit or change your configurationTo edit generator configuration properties
- In the Containment tree, right-click a Class element of the needed generator configuration.
- In the shortcut menu, click Software Code Generation and select Edit Configuration.
- In the open Generation Configuration dialog, make your changes.
- Click Apply and then Close.
 
If you have configured multiple targets for the same input, you might want to change the default one (which was created last). To change the default target configuration
- Do one of the following:
- In the diagram toolbar, click the
Change Default Target button. - In the selected element's shortcut menu, click Software Code Generation > Change Default Target.
- Select the target you want to use.
 - 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.| Info | title
|