{ "cells": [ { "cell_type": "markdown", "id": "9e31133a", "metadata": {}, "source": [ "# PyAnsys Geometry 101: Sketching\n", "\n", "With PyAnsys Geometry, you can build powerful dynamic sketches without communicating\n", "with the Geometry service. This example shows how to build some simple sketches." ] }, { "cell_type": "markdown", "id": "6cba9211", "metadata": {}, "source": [ "## Perform required imports\n", "\n", "Perform the required imports." ] }, { "cell_type": "code", "execution_count": 1, "id": "f5e5d388", "metadata": { "execution": { "iopub.execute_input": "2024-10-08T08:36:46.496787Z", "iopub.status.busy": "2024-10-08T08:36:46.496787Z", "iopub.status.idle": "2024-10-08T08:36:50.019499Z", "shell.execute_reply": "2024-10-08T08:36:50.019499Z" } }, "outputs": [], "source": [ "from pint import Quantity\n", "\n", "from ansys.geometry.core.math import Plane, Point2D, Point3D, Vector3D\n", "from ansys.geometry.core.misc import UNITS\n", "from ansys.geometry.core.sketch import Sketch" ] }, { "cell_type": "markdown", "id": "4b32b334", "metadata": {}, "source": [ "## Add a box to sketch\n", "\n", "The ``Sketch`` object is the starting point. Once it is created, you can\n", "dynamically add various curves to the sketch. Here are some of the curves that\n", "are available:\n", "\n", "- ``arc``\n", "- ``box``\n", "- ``circle``\n", "- ``ellipse``\n", "- ``gear``\n", "- ``polygon``\n", "- ``segment``\n", "- ``slot``\n", "- ``trapezoid``\n", "- ``triangle``\n", "\n", "Add a box to the sketch." ] }, { "cell_type": "code", "execution_count": 2, "id": "337e7ed2", "metadata": { "execution": { "iopub.execute_input": "2024-10-08T08:36:50.019499Z", "iopub.status.busy": "2024-10-08T08:36:50.019499Z", "iopub.status.idle": "2024-10-08T08:37:00.758320Z", "shell.execute_reply": "2024-10-08T08:37:00.758320Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "8aca495613504448bd2b499e6f6a2e83", "version_major": 2, "version_minor": 0 }, "text/plain": [ "EmbeddableWidget(value='" } }, "8c1ea4ef795e4e7f9de0f02f089a994d": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HTMLModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_48f953e580ce46a8b2946f54b1bf618d", "placeholder": "​", "style": "IPY_MODEL_9b069198012c43ce9204f8c5fdee0f89", "value": "" } }, "9b069198012c43ce9204f8c5fdee0f89": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "DescriptionStyleModel", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "a226ffc7d28e42c4ab0475b0ff771b13": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": 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, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "f2da0c539a67456181f0b477b7d68387": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HTMLModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_a226ffc7d28e42c4ab0475b0ff771b13", "placeholder": "​", "style": "IPY_MODEL_80f52111975c4dbaa31997e2b68953bf", "value": "" } }, "f709fe18b522415ebac18ee6fb8159da": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "DescriptionStyleModel", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "f88b9c8d06d140ee805589fefc8d82b7": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": 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, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "fe01513fe35e4861a00a0ce747442612": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": 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, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "ff22bbb5ec88492d8c2bee8f0ed94e7d": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HTMLModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_fe01513fe35e4861a00a0ce747442612", "placeholder": "​", "style": "IPY_MODEL_f709fe18b522415ebac18ee6fb8159da", "value": "" } } }, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 5 }