gpsMamba/mamba.ipynb

148 lines
25 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "9a610a27-cc42-4311-a288-ad89e86b5b73",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting auto display for cadquery Workplane and Shape\n",
"Overwriting auto display for build123d BuildPart, BuildSketch, BuildLine, ShapeList\n"
]
}
],
"source": [
"from build123d import *\n",
"from jupyter_cadquery import show, show_all,open_viewer,show_clear\n",
"from IPython.display import display\n",
"import ipywidgets as widgets"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "68ca929c-7e78-4ce9-bafc-a336328244db",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "bf5c66caae4c4b81934a1e3b0c25301d",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(Button(description='Viewer dół', style=ButtonStyle()), Button(description='Viewer prawo', style…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
" \n",
"cv = None # viewer globalny\n",
"\n",
"def open_bottom(b):\n",
" global cv\n",
" print(\"Otwieram viewer (split-bottom)\")\n",
" cv = open_viewer(\"Build123d\", anchor=\"split-bottom\")\n",
"\n",
"def open_right(b):\n",
" global cv\n",
" print(\"Otwieram viewer (right)\")\n",
" cv = open_viewer(\"Build123d\", anchor=\"right\")\n",
"\n",
"# Przycisk 1 bottom\n",
"btn_bottom = widgets.Button(description=\"Viewer dół\")\n",
"btn_bottom.on_click(open_bottom)\n",
"\n",
"# Przycisk 2 right\n",
"btn_right = widgets.Button(description=\"Viewer prawo\")\n",
"btn_right.on_click(open_right)\n",
"\n",
"# Wyświetl przyciski\n",
"display(widgets.HBox([btn_bottom, btn_right]))\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "ffefb0fe-56f5-4d89-816c-9a964445e1fb",
"metadata": {},
"outputs": [],
"source": [
"with BuildSketch() as bobo:\n",
" with BuildLine():\n",
" Polyline(\n",
" (0,0),(30,0)\n",
" )\n",
" PolarLine(\n",
" (30,0),\n",
" 20,\n",
" 30\n",
" \n",
" )"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "e2facbc6-5f0c-45b8-beaf-4a0b3c8f8856",
"metadata": {},
"outputs": [
{
"ename": "ValueError",
"evalue": "Unable to repositioned type <class 'NoneType'> with respect to local coordinates",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[19], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mshow\u001b[49m\u001b[43m(\u001b[49m\u001b[43mbobo\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m/usr/local/lib/python3.12/site-packages/jupyter_cadquery/show.py:247\u001b[0m, in \u001b[0;36mshow\u001b[0;34m(names, colors, alphas, viewer, anchor, cad_width, height, theme, pinning, progress, glass, tools, tree_width, axes, axes0, grid, ortho, transparent, default_opacity, black_edges, orbit_control, tab, control, collapse, explode, ticks, center_grid, up, zoom, position, quaternion, target, reset_camera, clip_slider_0, clip_slider_1, clip_slider_2, clip_normal_0, clip_normal_1, clip_normal_2, clip_intersection, clip_planes, clip_object_colors, pan_speed, rotate_speed, zoom_speed, deviation, angular_tolerance, edge_accuracy, default_color, default_edgecolor, default_facecolor, default_thickedgecolor, default_vertexcolor, ambient_intensity, direct_intensity, metalness, roughness, render_edges, render_normals, render_mates, render_joints, show_parent, show_sketch_local, helper_scale, mate_scale, debug, timeit, _force_in_debug, *cad_objs)\u001b[0m\n\u001b[1;32m 148\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Show CAD objects in Visual Studio Code\u001b[39;00m\n\u001b[1;32m 149\u001b[0m \u001b[38;5;124;03mParameters\u001b[39;00m\n\u001b[1;32m 150\u001b[0m \u001b[38;5;124;03m cad_objs: All cad objects that should be shown as positional parameters\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 244\u001b[0m \u001b[38;5;124;03m timeit: Show timing information from level 0-3 (default=False)\u001b[39;00m\n\u001b[1;32m 245\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 246\u001b[0m kwargs \u001b[38;5;241m=\u001b[39m none_filter(\u001b[38;5;28mlocals\u001b[39m(), [\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcad_objs\u001b[39m\u001b[38;5;124m\"\u001b[39m])\n\u001b[0;32m--> 247\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_show\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcad_objs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m/usr/local/lib/python3.12/site-packages/ocp_vscode/show.py:605\u001b[0m, in \u001b[0;36m_show\u001b[0;34m(*cad_objs, **kwargs)\u001b[0m\n\u001b[1;32m 602\u001b[0m progress \u001b[38;5;241m=\u001b[39m Progress([] \u001b[38;5;28;01mif\u001b[39;00m progress \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m [c \u001b[38;5;28;01mfor\u001b[39;00m c \u001b[38;5;129;01min\u001b[39;00m progress])\n\u001b[1;32m 604\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m Timer(timeit, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124moverall\u001b[39m\u001b[38;5;124m\"\u001b[39m):\n\u001b[0;32m--> 605\u001b[0m t, mapping \u001b[38;5;241m=\u001b[39m \u001b[43m_convert\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 606\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcad_objs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 607\u001b[0m \u001b[43m \u001b[49m\u001b[43mnames\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnames\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 608\u001b[0m \u001b[43m \u001b[49m\u001b[43mcolors\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcolors\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 609\u001b[0m \u001b[43m \u001b[49m\u001b[43malphas\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43malphas\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 610\u001b[0m \u001b[43m \u001b[49m\u001b[43mprogress\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mprogress\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 611\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 612\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 614\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m _force_in_debug:\n\u001b[1;32m 615\u001b[0m LAST_CALL \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mshow\u001b[39m\u001b[38;5;124m\"\u001b[39m\n",
"File \u001b[0;32m/usr/local/lib/python3.12/site-packages/ocp_vscode/show.py:283\u001b[0m, in \u001b[0;36m_convert\u001b[0;34m(names, colors, alphas, progress, *cad_objs, **kwargs)\u001b[0m\n\u001b[1;32m 280\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m progress \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 281\u001b[0m progress \u001b[38;5;241m=\u001b[39m Progress([c \u001b[38;5;28;01mfor\u001b[39;00m c \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m-+c\u001b[39m\u001b[38;5;124m\"\u001b[39m])\n\u001b[0;32m--> 283\u001b[0m instances, shapes, config, count_shapes, mapping \u001b[38;5;241m=\u001b[39m \u001b[43m_tessellate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 284\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcad_objs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 285\u001b[0m \u001b[43m \u001b[49m\u001b[43mnames\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnames\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 286\u001b[0m \u001b[43m \u001b[49m\u001b[43mcolors\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcolors\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 287\u001b[0m \u001b[43m \u001b[49m\u001b[43malphas\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43malphas\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 288\u001b[0m \u001b[43m \u001b[49m\u001b[43mprogress\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mprogress\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 289\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 290\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 292\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m config\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdark\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 293\u001b[0m config[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtheme\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdark\u001b[39m\u001b[38;5;124m\"\u001b[39m\n",
"File \u001b[0;32m/usr/local/lib/python3.12/site-packages/ocp_vscode/show.py:175\u001b[0m, in \u001b[0;36m_tessellate\u001b[0;34m(names, colors, alphas, progress, *cad_objs, **kwargs)\u001b[0m\n\u001b[1;32m 173\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m Timer(timeit, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mto_ocpgroup\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;241m1\u001b[39m):\n\u001b[1;32m 174\u001b[0m changed_config \u001b[38;5;241m=\u001b[39m get_changed_config()\n\u001b[0;32m--> 175\u001b[0m part_group, instances \u001b[38;5;241m=\u001b[39m \u001b[43mto_ocpgroup\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 176\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcad_objs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 177\u001b[0m \u001b[43m \u001b[49m\u001b[43mnames\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnames\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 178\u001b[0m \u001b[43m \u001b[49m\u001b[43mcolors\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcolors\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 179\u001b[0m \u001b[43m \u001b[49m\u001b[43malphas\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43malphas\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 180\u001b[0m \u001b[43m \u001b[49m\u001b[43mrender_mates\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mrender_mates\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mchanged_config\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mrender_mates\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 181\u001b[0m \u001b[43m \u001b[49m\u001b[43mrender_joints\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 182\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mrender_joints\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mchanged_config\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mrender_joints\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 183\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 184\u001b[0m \u001b[43m \u001b[49m\u001b[43mhelper_scale\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mhelper_scale\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mchanged_config\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mhelper_scale\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 185\u001b[0m \u001b[43m \u001b[49m\u001b[43mdefault_color\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 186\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mdefault_color\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mchanged_config\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mdefault_color\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 187\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 188\u001b[0m \u001b[43m \u001b[49m\u001b[43mshow_parent\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mshow_parent\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mchanged_config\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mshow_parent\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 189\u001b[0m \u001b[43m \u001b[49m\u001b[43mshow_sketch_local\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 190\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mshow_sketch_local\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mchanged_config\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mshow_sketch_local\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 191\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 192\u001b[0m \u001b[43m \u001b[49m\u001b[43mprogress\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mprogress\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 193\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 195\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(part_group\u001b[38;5;241m.\u001b[39mobjects) \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m1\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(part_group\u001b[38;5;241m.\u001b[39mobjects[\u001b[38;5;241m0\u001b[39m], OcpGroup):\n\u001b[1;32m 196\u001b[0m loc \u001b[38;5;241m=\u001b[39m part_group\u001b[38;5;241m.\u001b[39mloc\n",
"File \u001b[0;32m/usr/local/lib/python3.12/site-packages/ocp_tessellate/convert.py:1552\u001b[0m, in \u001b[0;36mto_ocpgroup\u001b[0;34m(names, colors, alphas, render_mates, render_joints, helper_scale, default_color, show_parent, show_sketch_local, loc, progress, *cad_objs)\u001b[0m\n\u001b[1;32m 1533\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1534\u001b[0m \u001b[38;5;124;03mCentral converter routine to convert a list of objects to an OcpGroup hierarchy.\u001b[39;00m\n\u001b[1;32m 1535\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1549\u001b[0m \u001b[38;5;124;03m@return: The OcpGroup hierarchy\u001b[39;00m\n\u001b[1;32m 1550\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1551\u001b[0m converter \u001b[38;5;241m=\u001b[39m OcpConverter(progress\u001b[38;5;241m=\u001b[39mprogress)\n\u001b[0;32m-> 1552\u001b[0m ocp_group \u001b[38;5;241m=\u001b[39m \u001b[43mconverter\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mto_ocp\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1553\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcad_objs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1554\u001b[0m \u001b[43m \u001b[49m\u001b[43mnames\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnames\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1555\u001b[0m \u001b[43m \u001b[49m\u001b[43mcolors\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcolors\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1556\u001b[0m \u001b[43m \u001b[49m\u001b[43malphas\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43malphas\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1557\u001b[0m \u001b[43m \u001b[49m\u001b[43mloc\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mloc\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1558\u001b[0m \u001b[43m \u001b[49m\u001b[43mrender_mates\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrender_mates\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1559\u001b[0m \u001b[43m \u001b[49m\u001b[43mrender_joints\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrender_joints\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1560\u001b[0m \u001b[43m \u001b[49m\u001b[43mhelper_scale\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mhelper_scale\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1561\u001b[0m \u001b[43m \u001b[49m\u001b[43mdefault_color\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdefault_color\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1562\u001b[0m \u001b[43m \u001b[49m\u001b[43mshow_parent\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mshow_parent\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1563\u001b[0m \u001b[43m \u001b[49m\u001b[43msketch_local\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mshow_sketch_local\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1564\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1566\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m ocp_group, converter\u001b[38;5;241m.\u001b[39minstances\n",
"File \u001b[0;32m/usr/local/lib/python3.12/site-packages/ocp_tessellate/convert.py:1445\u001b[0m, in \u001b[0;36mOcpConverter.to_ocp\u001b[0;34m(self, names, colors, alphas, loc, render_mates, render_joints, helper_scale, default_color, show_parent, sketch_local, unroll_compounds, level, *cad_objs)\u001b[0m\n\u001b[1;32m 1443\u001b[0m \u001b[38;5;66;03m# build123d BuildPart, BuildSketch, BuildLine\u001b[39;00m\n\u001b[1;32m 1444\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m is_build123d(cad_obj):\n\u001b[0;32m-> 1445\u001b[0m ocp_obj \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhandle_build123d_builder\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1446\u001b[0m \u001b[43m \u001b[49m\u001b[43mcad_obj\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mobj_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcolor\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43malpha\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msketch_local\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrender_joints\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mlevel\u001b[49m\n\u001b[1;32m 1447\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1449\u001b[0m \u001b[38;5;66;03m# TopoDS_Shape, TopoDS_Compound, TopoDS_Edge, TopoDS_Face, TopoDS_Shell,\u001b[39;00m\n\u001b[1;32m 1450\u001b[0m \u001b[38;5;66;03m# TopoDS_Solid, TopoDS_Vertex, TopoDS_Wire,\u001b[39;00m\n\u001b[1;32m 1451\u001b[0m \u001b[38;5;66;03m# build123d Shape, Compound, Edge, Face, Shell, Solid, Vertex\u001b[39;00m\n\u001b[1;32m 1452\u001b[0m \u001b[38;5;66;03m# CadQuery shapes Solid, Shell, Face, Wire, Edge, Vertex\u001b[39;00m\n\u001b[1;32m 1453\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m (\n\u001b[1;32m 1454\u001b[0m is_topods_shape(cad_obj)\n\u001b[1;32m 1455\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m is_build123d_shape(cad_obj)\n\u001b[1;32m 1456\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m is_cadquery_shape(cad_obj)\n\u001b[1;32m 1457\u001b[0m ):\n",
"File \u001b[0;32m/usr/local/lib/python3.12/site-packages/ocp_tessellate/convert.py:979\u001b[0m, in \u001b[0;36mOcpConverter.handle_build123d_builder\u001b[0;34m(self, cad_obj, obj_name, color, alpha, sketch_local, render_joints, level)\u001b[0m\n\u001b[1;32m 977\u001b[0m \u001b[38;5;66;03m# build123d BuildSketch().sketch\u001b[39;00m\n\u001b[1;32m 978\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m is_build123d_sketch(cad_obj):\n\u001b[0;32m--> 979\u001b[0m obj \u001b[38;5;241m=\u001b[39m \u001b[43mcad_obj\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msketch\u001b[49m\u001b[38;5;241m.\u001b[39mfaces()\n\u001b[1;32m 980\u001b[0m obj_name \u001b[38;5;241m=\u001b[39m get_name(cad_obj, obj_name, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mFace\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 982\u001b[0m \u001b[38;5;66;03m# build123d BuildLine().line\u001b[39;00m\n",
"File \u001b[0;32m/usr/local/lib/python3.12/site-packages/build123d/build_sketch.py:85\u001b[0m, in \u001b[0;36mBuildSketch.sketch\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 83\u001b[0m global_objs \u001b[38;5;241m=\u001b[39m []\n\u001b[1;32m 84\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m plane \u001b[38;5;129;01min\u001b[39;00m workplanes:\n\u001b[0;32m---> 85\u001b[0m global_objs\u001b[38;5;241m.\u001b[39mappend(\u001b[43mplane\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfrom_local_coords\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_obj\u001b[49m\u001b[43m)\u001b[49m)\n\u001b[1;32m 86\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m Sketch(Compound(global_objs)\u001b[38;5;241m.\u001b[39mwrapped)\n",
"File \u001b[0;32m/usr/local/lib/python3.12/site-packages/build123d/geometry.py:2436\u001b[0m, in \u001b[0;36mPlane.from_local_coords\u001b[0;34m(self, obj)\u001b[0m\n\u001b[1;32m 2425\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mfrom_local_coords\u001b[39m(\u001b[38;5;28mself\u001b[39m, obj: Union[\u001b[38;5;28mtuple\u001b[39m, Vector, Any, BoundBox]):\n\u001b[1;32m 2426\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Reposition the object relative from this plane\u001b[39;00m\n\u001b[1;32m 2427\u001b[0m \n\u001b[1;32m 2428\u001b[0m \u001b[38;5;124;03m Args:\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 2434\u001b[0m \n\u001b[1;32m 2435\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m-> 2436\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_to_from_local_coords\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m/usr/local/lib/python3.12/site-packages/build123d/geometry.py:2407\u001b[0m, in \u001b[0;36mPlane._to_from_local_coords\u001b[0;34m(self, obj, to_from)\u001b[0m\n\u001b[1;32m 2405\u001b[0m return_value \u001b[38;5;241m=\u001b[39m obj\u001b[38;5;241m.\u001b[39mtransform_shape(transform_matrix)\n\u001b[1;32m 2406\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 2407\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[1;32m 2408\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUnable to repositioned type \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mtype\u001b[39m(obj)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m with respect to local coordinates\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 2409\u001b[0m )\n\u001b[1;32m 2410\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m return_value\n",
"\u001b[0;31mValueError\u001b[0m: Unable to repositioned type <class 'NoneType'> with respect to local coordinates"
]
}
],
"source": [
"show(bobo)"
]
}
],
"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.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}