{ "cells": [ { "cell_type": "markdown", "id": "25c8b27c", "metadata": {}, "source": [ "# Sketching: Parametric sketching for gears\n", "\n", "This example shows how to use gear sketching shapes from PyAnsys Geometry." ] }, { "cell_type": "markdown", "id": "b9c28bde", "metadata": {}, "source": [ "## Perform required imports and pre-sketching operations\n", "\n", "Perform required imports and instantiate the ``Modeler`` instance and\n", "the basic elements that define a sketch." ] }, { "cell_type": "code", "execution_count": 1, "id": "8d76294c", "metadata": { "execution": { "iopub.execute_input": "2024-10-31T14:34:54.302520Z", "iopub.status.busy": "2024-10-31T14:34:54.302520Z", "iopub.status.idle": "2024-10-31T14:34:57.677182Z", "shell.execute_reply": "2024-10-31T14:34:57.677182Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Ansys Geometry Modeler (0x2c2fb63a930)\n", "\n", "Ansys Geometry Modeler Client (0x2c2fadb2810)\n", " Target: localhost:700\n", " Connection: Healthy\n" ] } ], "source": [ "from pint import Quantity\n", "\n", "from ansys.geometry.core import launch_modeler\n", "from ansys.geometry.core.math import Plane, Point2D, Point3D\n", "from ansys.geometry.core.misc import UNITS, Distance\n", "from ansys.geometry.core.sketch import Sketch\n", "from ansys.geometry.core.plotting import GeometryPlotter\n", "\n", "# Start a modeler session\n", "modeler = launch_modeler()\n", "print(modeler)\n", "\n", "# Define the origin point of the plane\n", "origin = Point3D([1, 1, 1])\n", "\n", "# Create a plane containing the previous point with desired fundamental directions\n", "plane = Plane(\n", " origin, direction_x=[1, 0, 0], direction_y=[0, -1, 1]\n", ")\n" ] }, { "cell_type": "markdown", "id": "55c92dd4", "metadata": {}, "source": [ "## Sketch a dummy gear\n", "\n", "``DummyGear`` sketches are simple gears that have straight teeth. While they do not ensure\n", "actual physical functionality, they might be useful for some simple playground tests.\n", "\n", "Instantiate a new ``Sketch`` object and then define and plot a dummy gear." ] }, { "cell_type": "code", "execution_count": 2, "id": "3408470c", "metadata": { "execution": { "iopub.execute_input": "2024-10-31T14:34:57.677182Z", "iopub.status.busy": "2024-10-31T14:34:57.677182Z", "iopub.status.idle": "2024-10-31T14:34:59.407257Z", "shell.execute_reply": "2024-10-31T14:34:59.407257Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "62c15e446e084f0bb324ae95ebee9342", "version_major": 2, "version_minor": 0 }, "text/plain": [ "EmbeddableWidget(value='" } }, "4394a459db094ec093ef11910bf1bf8a": { "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 } }, "510d21cc1a7f43579b94973f48ae49b5": { "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": "" } }, "62c15e446e084f0bb324ae95ebee9342": { "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_b9881cde943345088c073b4bf4f90777", "placeholder": "​", "style": "IPY_MODEL_510d21cc1a7f43579b94973f48ae49b5", "value": "" } }, "67b2c3545fd14c6388f26f72f387e6fe": { "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": "" } }, "6ae0e3c274c5463494722d239803dd96": { "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": "" } }, "6b4f32aa5da7426586461ac6c6e701aa": { "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_1ec4d94c69e348b98cbdd7a13cb6f544", "placeholder": "​", "style": "IPY_MODEL_6ae0e3c274c5463494722d239803dd96", "value": "" } }, "a3cfc9a2e11b4043bc325275ba168c10": { "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_4394a459db094ec093ef11910bf1bf8a", "placeholder": "​", "style": "IPY_MODEL_fb73d29f64744043989cb85dcdce9353", "value": "" } }, "af24b664de32470294847bf1219ce4fc": { "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 } }, "b9881cde943345088c073b4bf4f90777": { "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 } }, "fb73d29f64744043989cb85dcdce9353": { "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": "" } } }, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 5 }