Scripting Using AI Code Generation

You can use the AI-powered autocomplete feature of the Behavior Editor to generate code snippets for your scripts.

You can:

  • Write prompts in natural language to instruct AI to generate code snippets and complete your scripts.
  • Replace selected portions of your code with AI-generated snippets.
  • Generate code snippets for your whole script based on an automatic analysis of your current code.
  • Accept or reject the generated code snippets.

Virtual Companions and Generative Experiences leverage artificial intelligence (AI) technology. You should ensure prior validation of any output created using these solutions before use in production and especially in business-critical systems. Always follow your organization's best practices and data policies when using it. For more information, see https://www.3ds.com/trust/ai.

Important: THIS IS A BETA FEATURE UNDER EVALUATION. Any decision to use it is subject to important terms and conditions that the Customer understands and accepts by using it. Refer to the Offering Specific Terms available at www.3ds.com/terms for these terms and conditions.


Before you begin:
  1. Sign in to the 3DEXPERIENCE Platform.
    Important: If you do not sign in to the 3DEXPERIENCE Platform or if the system cannot establish a connection to the agent, you cannot use AI code generation.
  2. Create a custom script using the Behavior Editor. For more information, see Creating Scripts.
See Also
About AI Code Generation in Scripts
About the Behavior Editor
Creating Scripts

Environment: Cloud only

  1. In the Behavior Editor, do one of the following:
    • Select the portion of your script that you want to complete or modify using AI.
    • Select all the code in your script.
    • Place your cursor anywhere in your script without any selection.



  2. Do one or more of the following:
    ActionDescription
    • At the top of the Behavior Editor, click Ask AURA .
    • Press Ctrl + L.
    From the dialog box that opens, do one of the following:
    • In the text field, write a prompt using natural language to give instructions to AI and guide it to generate code snippets that suit your intent. When done, click Generate.

      For more information, see

      Recommendation: To improve code generation quality, clearly define the task, constraints, and expected model behavior in your prompt. Iteratively refine the prompt based on the AI model results to optimize code quality. For more information, see Prompting Practices.
    • To automatically generate code based on contextual analysis of the script or selected code portion and without any prompt, click Generate or press Enter.
    Press Ctrl + B.

    Automatically generate code based on contextual analysis of your current script.



    Note: When AI contextually analyzes your script, it also takes comments into consideration. If the comments contain instructions, AI can use them to produce code snippets accordingly.

    If an error occurs while generating code, a popup window notifies you that code generation has failed. For example, network connectivity issues might cause errors.

    To reuse the same prompt and generate new code snippets after an error, click Try again.

    AI generates code snippets based on your prompt or contextual analysis of your script. A difference editor appears and highlights in green the generated code snippets to indicate the differences between your current script and the generated code snippets.
  3. To determine whether you want to keep the generated code snippets in your script or not, do one of the following:
    • To accept and include the code snippets, click Accept.
    • To reject the code snippets, click Reject.

    Note: Accepting or rejecting code snippets automatically triggers the sending of analytics to the system to improve code generation quality. The system records only your selection (Accept or Reject) and does not collect or transmit any other information such as the content of your prompt, script, or generated code snippets.



    Generated code snippets appear at the cursor position. If the cursor is inside or adjacent to a word, the snippets appear on a new line to avoid disrupting existing code.
  4. Optional: To revert any AI code generation, perform an Undo operation.

    Note: The default shortcut for Undo is Ctrl + Z.

  5. Optional: To quickly analyze the generated code and localize semantic errors, open the Play Console.



    For more information, see Working with the Play Console.
    Recommendation: To ensure optimal code quality, always review the AI model results.