.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_examples/generative_design_ex/01-design_generation.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr__examples_generative_design_ex_01-design_generation.py: .. _ref_design_generation_reuse: Script 2 - Generating new designs with the model ================================================ This example demonstrates how to generate new designs. Before you begin ---------------- - Make sure you performed ":ref:`ref_generative_design_model_build_reuse`". or - | Make sure you: | 1. instantiated a client with GeomAI objects, | 2. created a project and added training data to it, | 3. created a model configuration and built a model. .. GENERATED FROM PYTHON SOURCE LINES 23-25 Import necessary libraries -------------------------- .. GENERATED FROM PYTHON SOURCE LINES 25-29 .. code-block:: Python import ansys.simai.core from ansys.simai.core.data.geomai.predictions import GeomAIPredictionConfiguration .. GENERATED FROM PYTHON SOURCE LINES 30-34 Create the client ----------------- Create a client to use the PySimAI library. This client will be the entrypoint of all "SimAI" and "GeomAI" objects. .. GENERATED FROM PYTHON SOURCE LINES 34-39 .. code-block:: Python simai = ansys.simai.core.SimAIClient(organization="my_organization") client = simai.geomai .. GENERATED FROM PYTHON SOURCE LINES 40-45 Retrieve your workspace ----------------------- Find the workspace your model has been saved to and set it as a current workspace: .. GENERATED FROM PYTHON SOURCE LINES 47-48 Step 1. Set the current project: .. GENERATED FROM PYTHON SOURCE LINES 48-51 .. code-block:: Python client.set_current_project("new-bracket-project") .. GENERATED FROM PYTHON SOURCE LINES 52-53 Step 2. Retrieve all the workspaces of the current project: .. GENERATED FROM PYTHON SOURCE LINES 53-56 .. code-block:: Python print(client.current_project.workspaces()) .. GENERATED FROM PYTHON SOURCE LINES 57-58 Step 3. Setting the current workspace: .. GENERATED FROM PYTHON SOURCE LINES 58-64 .. code-block:: Python client.set_current_workspace("new-bracket-project #1") workspace = client.current_workspace print(workspace) .. GENERATED FROM PYTHON SOURCE LINES 65-67 Set up the parameters and run your prediction --------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 69-70 Configure the prediction: .. GENERATED FROM PYTHON SOURCE LINES 70-73 .. code-block:: Python configuration = GeomAIPredictionConfiguration(latent_params=[1, 1], resolution=(100, 100, 100)) .. GENERATED FROM PYTHON SOURCE LINES 74-75 Run the prediction: .. GENERATED FROM PYTHON SOURCE LINES 75-78 .. code-block:: Python prediction = client.predictions.run(configuration, workspace) .. GENERATED FROM PYTHON SOURCE LINES 79-80 Check the status of your prediction: .. GENERATED FROM PYTHON SOURCE LINES 80-89 .. code-block:: Python if prediction.is_ready: print("✅ Prediction is ready!") else: print("⏳ Prediction is not ready yet.") print(prediction) .. GENERATED FROM PYTHON SOURCE LINES 90-95 Download your prediction for further analysis and visualization --------------------------------------------------------------- To download your file, please indicate the ID of the prediction and the path to the desired storage location. .. GENERATED FROM PYTHON SOURCE LINES 95-100 .. code-block:: Python print(client.predictions.list(client.workspaces.list()[0])) client.predictions.download("your_prediction_id", r"path/to/your/predictions/folder/output1.vtp") .. GENERATED FROM PYTHON SOURCE LINES 101-103 The downloaded geometry can be now used as a SimAI training data or as an input for the SimAI prediction! .. _sphx_glr_download__examples_generative_design_ex_01-design_generation.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 01-design_generation.ipynb <01-design_generation.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 01-design_generation.py <01-design_generation.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 01-design_generation.zip <01-design_generation.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_