{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import cadquery as cq\n", "\n", "# Create a lofted section between a rectangle and a circular section.\n", "# 1. Establishes a workplane that an object can be built on.\n", "# 1a. Uses the named plane orientation \"front\" to define the workplane, meaning\n", "# that the positive Z direction is \"up\", and the negative Z direction\n", "# is \"down\".\n", "# 2. Creates a plain box to base future geometry on with the box() function.\n", "# 3. Selects the top-most Z face of the box.\n", "# 4. Draws a 2D circle at the center of the the top-most face of the box.\n", "# 5. Creates a workplane 3 mm above the face the circle was drawn on.\n", "# 6. Draws a 2D circle on the new, offset workplane.\n", "# 7. Creates a loft between the circle and the rectangle.\n", "result = cq.Workplane(\"front\").box(4.0, 4.0, 0.25).faces(\">Z\") \\\n", " .circle(1.5).workplane(offset=3.0) \\\n", " .rect(0.75, 0.5) \\\n", " .loft(combine=True)\n", "\n", "# Displays the result of this script\n", "show_object(result)\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.14" } }, "nbformat": 4, "nbformat_minor": 1 }