{
"cells": [
{
"cell_type": "markdown",
"id": "31af6d93",
"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": "02510ed9",
"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": "5c360e6a",
"metadata": {
"execution": {
"iopub.execute_input": "2024-10-08T08:37:58.156007Z",
"iopub.status.busy": "2024-10-08T08:37:58.156007Z",
"iopub.status.idle": "2024-10-08T08:38:03.194727Z",
"shell.execute_reply": "2024-10-08T08:38:03.194727Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ansys Geometry Modeler (0x232023b3fb0)\n",
"\n",
"Ansys Geometry Modeler Client (0x2320168f140)\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": "7fcd6cbc",
"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": "377218af",
"metadata": {
"execution": {
"iopub.execute_input": "2024-10-08T08:38:03.194727Z",
"iopub.status.busy": "2024-10-08T08:38:03.194727Z",
"iopub.status.idle": "2024-10-08T08:38:05.353169Z",
"shell.execute_reply": "2024-10-08T08:38:05.353169Z"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c3967753e69849e29f02e2d62eaa8f05",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"EmbeddableWidget(value='"
}
},
"382465264b6342b395c54272f4f8cae5": {
"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_3d5e2328696343978484408f37c0118d",
"placeholder": "",
"style": "IPY_MODEL_5eb812e722e242bd9f92b20c45b72bcb",
"value": ""
}
},
"3d5e2328696343978484408f37c0118d": {
"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
}
},
"59b8eac0bea34c989c715b7c7dd5c027": {
"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": ""
}
},
"5eb812e722e242bd9f92b20c45b72bcb": {
"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": ""
}
},
"9cd1880f29ca48e4b5b6a37a0eaa6d82": {
"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": ""
}
},
"bbf70924b2734342b5e2b7bfb05eff67": {
"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_1ac742af61d94bc2a01bcec3b173e5e3",
"placeholder": "",
"style": "IPY_MODEL_df8610836eed4bbc9dba2c85cd84110c",
"value": ""
}
},
"c3967753e69849e29f02e2d62eaa8f05": {
"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_2b5baf2798aa4a67b4c9fdcd4dd43dff",
"placeholder": "",
"style": "IPY_MODEL_59b8eac0bea34c989c715b7c7dd5c027",
"value": ""
}
},
"d3872305fdc84c42aa07a4de2ede672a": {
"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
}
},
"df8610836eed4bbc9dba2c85cd84110c": {
"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
}