{
"cells": [
{
"cell_type": "markdown",
"id": "58e1b00b",
"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": "392db752",
"metadata": {},
"source": [
"## Perform required imports\n",
"\n",
"Perform the required imports."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "ab90d0ad",
"metadata": {
"execution": {
"iopub.execute_input": "2025-04-16T10:58:20.990126Z",
"iopub.status.busy": "2025-04-16T10:58:20.989957Z",
"iopub.status.idle": "2025-04-16T10:58:22.484399Z",
"shell.execute_reply": "2025-04-16T10:58:22.483836Z"
}
},
"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": "1eba3b9e",
"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": "607c4e56",
"metadata": {
"execution": {
"iopub.execute_input": "2025-04-16T10:58:22.486599Z",
"iopub.status.busy": "2025-04-16T10:58:22.486152Z",
"iopub.status.idle": "2025-04-16T10:58:23.064644Z",
"shell.execute_reply": "2025-04-16T10:58:23.064162Z"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "0d264d5ca43841c0b8e8b0370473e7fb",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"EmbeddableWidget(value='"
}
},
"0d264d5ca43841c0b8e8b0370473e7fb": {
"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_00329f28da904a1dba80a837ffb0cfc2",
"placeholder": "",
"style": "IPY_MODEL_4e08e947064940718b7d74dea43b43d6",
"value": ""
}
},
"25628a2cf2c248269561430f095df8c5": {
"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
}
},
"4e08e947064940718b7d74dea43b43d6": {
"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": ""
}
},
"4e518599869a45539b229148ca34139c": {
"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_60a88dab328a4cbab2ad02fdd2a7840d",
"placeholder": "",
"style": "IPY_MODEL_68311992fb76461caa248e69be50b033",
"value": ""
}
},
"60a88dab328a4cbab2ad02fdd2a7840d": {
"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
}
},
"68311992fb76461caa248e69be50b033": {
"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": ""
}
},
"7fdde7f912e34ace9118897bd30c4e4a": {
"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
}
},
"98c854838c7041f4a0f8028c05bff87f": {
"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_7fdde7f912e34ace9118897bd30c4e4a",
"placeholder": "",
"style": "IPY_MODEL_079e33d3f96d4d3d87623f2961bacb58",
"value": ""
}
},
"bab113c62a2646b285d44f1aa18ef6d3": {
"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
}