{ "cells": [ { "cell_type": "markdown", "id": "a0f193450eed0115", "metadata": {}, "source": [ "# Boolean Operations\n", "\n", "Boolean operations in ada-py can be applied to individual object or to any part in the assembly (including the top-level Assembly object). Any boolean applied to a part will automatically be applied to its children. Any primitive can be used as a boolean." ] }, { "cell_type": "code", "execution_count": 1, "id": "7ba1fffdb1e4aa5a", "metadata": { "ExecuteTime": { "end_time": "2025-03-16T13:34:53.228599Z", "start_time": "2025-03-16T13:34:53.222413Z" } }, "outputs": [], "source": [ "import ada" ] }, { "cell_type": "code", "execution_count": 2, "id": "c9bc66364502ae52", "metadata": { "ExecuteTime": { "end_time": "2025-03-16T13:37:18.053239Z", "start_time": "2025-03-16T13:37:17.961517Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Work\\code\\adapy\\.pixi\\envs\\tests\\Lib\\site-packages\\h5py\\__init__.py:36: UserWarning: h5py is running against HDF5 (1, 14, 4) when it was built against (1, 14, 4, 3), this may cause problems\n", " _warn((\"h5py is running against HDF5 {0} when it was built against {1}, \"\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cyl = ada.PrimCyl('cyl', (0,0,0), (0,0,1), 0.2)\n", "pl = ada.Plate('pl', [(0,0), (1,0), (1,1), (0,1)], 0.01, origin=(-0.5,-0.5,0), n=(0,0,1), xdir=(1,0,0))\n", "pl.add_boolean(cyl)\n", "pl.show(embed_glb=True)" ] }, { "cell_type": "code", "execution_count": 3, "id": "9f2a65ce-38d4-4d84-884a-c922995849f5", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pl_and_cyl_p = ada.Part('myPart') / (pl, cyl)\n", "pl_and_cyl_p.show(embed_glb=True)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.9" } }, "nbformat": 4, "nbformat_minor": 5 }