{
"cells": [
{
"cell_type": "markdown",
"id": "17cd6e75",
"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": "fbbea0a9",
"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": "026cefab",
"metadata": {
"execution": {
"iopub.execute_input": "2025-04-16T10:58:38.689509Z",
"iopub.status.busy": "2025-04-16T10:58:38.689315Z",
"iopub.status.idle": "2025-04-16T10:58:40.351321Z",
"shell.execute_reply": "2025-04-16T10:58:40.350673Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ansys Geometry Modeler (0x7fe0ddaf0fb0)\n",
"\n",
"Ansys Geometry Modeler Client (0x7fe0c7374e30)\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": "49f06e89",
"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": "445eec2c",
"metadata": {
"execution": {
"iopub.execute_input": "2025-04-16T10:58:40.353683Z",
"iopub.status.busy": "2025-04-16T10:58:40.353159Z",
"iopub.status.idle": "2025-04-16T10:58:40.957854Z",
"shell.execute_reply": "2025-04-16T10:58:40.957208Z"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b9d73badbf664d5aa3ee76e2410b8780",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"EmbeddableWidget(value='"
}
},
"986887d26b6c4af08bef2dd8ca4fbfa7": {
"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
}
},
"b30d1ea61782493f98eef92717ce0432": {
"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_986887d26b6c4af08bef2dd8ca4fbfa7",
"placeholder": "",
"style": "IPY_MODEL_87527c6b19d348ee880f5de322165aae",
"value": ""
}
},
"b5ff677286d647d49518809eaf817cfa": {
"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
}
},
"b9d73badbf664d5aa3ee76e2410b8780": {
"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_b5ff677286d647d49518809eaf817cfa",
"placeholder": "",
"style": "IPY_MODEL_03329c816a094b7ca010b83f5ba6a538",
"value": ""
}
},
"d998f8f7171e45aaac82a16c2a348136": {
"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": ""
}
},
"ed1469ec1f79458b974771d1f659cec8": {
"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_002c0dc104de46b58ec3bfa09ab2e9ec",
"placeholder": "",
"style": "IPY_MODEL_60141c23825c4fedb8709727e73e8617",
"value": ""
}
}
},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}