{ "cells": [ { "cell_type": "markdown", "id": "758bc3cc", "metadata": {}, "source": [ "# How to preview a light expert result" ] }, { "cell_type": "markdown", "id": "d5246e90", "metadata": {}, "source": [ "This tutorial demonstrates how to review the light expert simulation result." ] }, { "cell_type": "code", "execution_count": 1, "id": "a3e6c611", "metadata": { "execution": { "iopub.execute_input": "2025-04-17T06:03:04.302677Z", "iopub.status.busy": "2025-04-17T06:03:04.302487Z", "iopub.status.idle": "2025-04-17T06:03:05.039714Z", "shell.execute_reply": "2025-04-17T06:03:05.038964Z" } }, "outputs": [], "source": [ "from pathlib import Path\n", "\n", "from ansys.speos.core import LightPathFinder, Project, Speos\n", "from ansys.speos.core.simulation import SimulationInteractive\n", "\n", "# If using docker container\n", "assets_data_path = Path(\"/app\") / \"assets\"\n", "# If using local server\n", "# assets_data_path = Path().resolve().parent.parent / \"tests\" / \"assets\"\n", "# If using a different path\n", "# assets_data_path = Path(\"path/to/downloaded/example/assets\")" ] }, { "cell_type": "markdown", "id": "64542885", "metadata": {}, "source": [ "## Create connection with speos rpc server" ] }, { "cell_type": "code", "execution_count": 2, "id": "ab24d0c5", "metadata": { "execution": { "iopub.execute_input": "2025-04-17T06:03:05.042457Z", "iopub.status.busy": "2025-04-17T06:03:05.041879Z", "iopub.status.idle": "2025-04-17T06:03:05.048651Z", "shell.execute_reply": "2025-04-17T06:03:05.048021Z" } }, "outputs": [], "source": [ "speos = Speos(host=\"localhost\", port=50098)" ] }, { "cell_type": "markdown", "id": "88695363", "metadata": {}, "source": [ "## Create a new project" ] }, { "cell_type": "markdown", "id": "ada17c64", "metadata": {}, "source": [ "In this example, a project is created via reading a pre-defined .speos file." ] }, { "cell_type": "markdown", "id": "1679577b", "metadata": {}, "source": [ "User can preview the part and mesh information." ] }, { "cell_type": "markdown", "id": "1fbbed90", "metadata": {}, "source": [ "By providing viz_args to the preview function, project part can be viewed in a semi-transparent\n", "way." ] }, { "cell_type": "markdown", "id": "81933c92", "metadata": {}, "source": [ "It can be found there is volume conflict in this project." ] }, { "cell_type": "code", "execution_count": 3, "id": "a2774ceb", "metadata": { "execution": { "iopub.execute_input": "2025-04-17T06:03:05.050768Z", "iopub.status.busy": "2025-04-17T06:03:05.050433Z", "iopub.status.idle": "2025-04-17T06:03:06.314707Z", "shell.execute_reply": "2025-04-17T06:03:06.314129Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "9e7ac2c1128d45778c46e080a98b7f8f", "version_major": 2, "version_minor": 0 }, "text/plain": [ "EmbeddableWidget(value='" } }, "750a97813a074db78123c162f2068144": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLStyleModel", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "background": null, "description_width": "", "font_size": null, "text_color": null } }, "9dd78864a298441ca2ab2e40d244c0f8": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "9e7ac2c1128d45778c46e080a98b7f8f": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HTMLView", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_f8444345d0884b95b804a5c1e522c081", "placeholder": "​", "style": "IPY_MODEL_5a2a606dcdb742b2a6fa4d3bfb158470", "tabbable": null, "tooltip": null, "value": "" } }, "a4e3df21194e44bd8be81842cf3352cd": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HTMLView", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_9dd78864a298441ca2ab2e40d244c0f8", "placeholder": "​", "style": "IPY_MODEL_d5025508c9e64a378a54b0785e91bda5", "tabbable": null, "tooltip": null, "value": "" } }, "c95e5cede1a44451a1422d67b7186d7f": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "d5025508c9e64a378a54b0785e91bda5": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLStyleModel", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "background": null, "description_width": "", "font_size": null, "text_color": null } }, "f8444345d0884b95b804a5c1e522c081": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } } }, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 5 }