{
"cells": [
{
"cell_type": "markdown",
"id": "58b17285",
"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": "e1a91507",
"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": "785fb67f",
"metadata": {
"execution": {
"iopub.execute_input": "2025-01-16T08:14:11.763514Z",
"iopub.status.busy": "2025-01-16T08:14:11.763514Z",
"iopub.status.idle": "2025-01-16T08:14:17.357972Z",
"shell.execute_reply": "2025-01-16T08:14:17.357972Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ansys Geometry Modeler (0x16b534badb0)\n",
"\n",
"Ansys Geometry Modeler Client (0x16b51e9d1c0)\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": "3c6e35ae",
"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": "b087612b",
"metadata": {
"execution": {
"iopub.execute_input": "2025-01-16T08:14:17.364109Z",
"iopub.status.busy": "2025-01-16T08:14:17.362078Z",
"iopub.status.idle": "2025-01-16T08:14:20.818158Z",
"shell.execute_reply": "2025-01-16T08:14:20.818158Z"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "bb500473a914494d96bd0cf33434e890",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"EmbeddableWidget(value='"
}
},
"3f5ea7a746e0482d8bd9101c92d03f12": {
"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_fa50e4ef1f134e8a9a917daab60f2311",
"placeholder": "",
"style": "IPY_MODEL_60d6fd13e5144796a09f308c50fa47f9",
"value": ""
}
},
"60d6fd13e5144796a09f308c50fa47f9": {
"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": ""
}
},
"61695c0ebab746c4bc1d3d3e06f133ad": {
"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
}
},
"7b267c425ba5456399a5cc6ebb3dee82": {
"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": ""
}
},
"89e5b13d052c4592a0827138c9e7c8f3": {
"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
}
},
"8d25b5e63f0a44b682c56f918d96859d": {
"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_89e5b13d052c4592a0827138c9e7c8f3",
"placeholder": "",
"style": "IPY_MODEL_7b267c425ba5456399a5cc6ebb3dee82",
"value": ""
}
},
"93b584206b4c4c23aa20a11165366bbd": {
"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
}
},
"bb500473a914494d96bd0cf33434e890": {
"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_93b584206b4c4c23aa20a11165366bbd",
"placeholder": "",
"style": "IPY_MODEL_ecde284435064de4aa37a9b2fc217759",
"value": ""
}
},
"e70a5e1b6025432dafed2bc9c69dae3c": {
"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": ""
}
},
"ecde284435064de4aa37a9b2fc217759": {
"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": ""
}
},
"fa50e4ef1f134e8a9a917daab60f2311": {
"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
}
}
},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}