From ef59ef8cd1d0d490725c0da7bb86dd10a8d950f7 Mon Sep 17 00:00:00 2001 From: Rafal Date: Thu, 29 May 2025 18:09:40 +0000 Subject: [PATCH] start --- .ipynb_checkpoints/Camper-checkpoint.ipynb | 181 +++++++++++++++ Camper.ipynb | 248 +++++++++++++++++++++ 2 files changed, 429 insertions(+) create mode 100644 .ipynb_checkpoints/Camper-checkpoint.ipynb create mode 100644 Camper.ipynb diff --git a/.ipynb_checkpoints/Camper-checkpoint.ipynb b/.ipynb_checkpoints/Camper-checkpoint.ipynb new file mode 100644 index 0000000..3d3bcda --- /dev/null +++ b/.ipynb_checkpoints/Camper-checkpoint.ipynb @@ -0,0 +1,181 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "0a626b10-f8c1-4fa1-a186-71d6f989e162", + "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", + "\n", + "from jupyter_cadquery import show, show_all,open_viewer" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "67a54d02-2fd4-4f9a-8391-64e8617a5aef", + "metadata": {}, + "outputs": [], + "source": [ + "# cv = open_viewer(\"Build123d\", anchor=\"split-bottom\",aspect_ratio=3/4)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "cd726fcd-9dea-4a0d-9710-519b45a58f88", + "metadata": {}, + "outputs": [], + "source": [ + "cv = open_viewer(\"Build123d\", anchor=\"right\")" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "0859af03-2222-4b9d-b6fe-04bbc2794516", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+cc\n" + ] + }, + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from build123d import *\n", + "from ocp_vscode import show\n", + "\n", + "\n", + "podnies_karnister = False\n", + "otwarta_szuflada = False\n", + "\n", + "\n", + "\n", + "# Wymiary szkieletu boxa (mm)\n", + "dl = 1810.5\n", + "sz = 570.5\n", + "wys = 560\n", + "profil = 40\n", + "profil_8040 = 80 \n", + "sklejka = 15\n", + "\n", + "# Wymiary karnistra\n", + "dl_k = 360\n", + "sz_k = 500\n", + "wys_k = 230\n", + "\n", + "\n", + "# Wymiary Skrzyni\n", + "dl_sz = 1100\n", + "sz_sz = sz - (2*profil)\n", + "wys_sz = wys - profil\n", + "\n", + "\n", + "dl_sklejki = dl-dl_sz\n", + "\n", + "with BuildPart() as szkielet:\n", + " with Locations((0,-sz/2 + profil/2,0)):\n", + " # Poziome\n", + " with Locations((0, 0, 0), (0, sz - profil, 0)):\n", + " Box(dl-(2*profil), profil, profil)\n", + " with Locations((0, 0, wys - profil), (0, sz - profil, wys - profil)):\n", + " Box(dl-(2*profil), profil, profil)\n", + " # Pionowe\n", + " with Locations((dl/2-(profil/2),0,wys/2-(profil/2)),(dl/2-(profil/2),sz-(profil),wys/2-(profil/2))):\n", + " Box(profil,profil,wys)\n", + " with Locations((-dl/2+(profil/2),0,wys/2-(profil/2)),(-dl/2+(profil/2),sz-(profil),wys/2-(profil/2))):\n", + " Box(profil,profil,wys)\n", + " # Boczne\n", + " with Locations((dl/2-(profil/2),sz/2-(profil/2),0),(dl/2-(profil/2),sz/2-(profil/2),wys-(profil))):\n", + " Box(profil,sz-(2*profil),profil)\n", + " # sklejka pod karnister\n", + " with Locations((dl/2-dl_sklejki/2,0,0)):\n", + " Box(dl_sklejki,sz,sklejka)\n", + "\n", + "\n", + "\n", + "if podnies_karnister == True:\n", + " podnies_karnister = 600\n", + "else: \n", + " podnies_karnister = wys_k/2 + profil/2 + sklejka\n", + "\n", + "with BuildPart() as karnister:\n", + " with Locations((dl/2-dl_k/2-profil,0,podnies_karnister)):\n", + " Box(dl_k,sz_k,wys_k)\n", + " \n", + "karnister.part.color = Color(\"Blue\")\n", + "\n", + "\n", + "\n", + "if otwarta_szuflada == True:\n", + " szuflada_stan = (-dl/2+dl_sz/2-dl_sz,0,wys/2-profil+15)\n", + "else:\n", + " szuflada_stan = (-dl/2+dl_sz/2,0,wys/2-profil+15)\n", + " \n", + "\n", + "\n", + "with BuildPart() as szuflada:\n", + " with Locations(szuflada_stan):\n", + " Box(dl_sz,sz_sz,wys_sz)\n", + " offset(amount=-15, openings=szuflada.faces().sort_by(Axis.Z)[-1])\n", + "\n", + " \n", + "show_all()\n", + "# show(szuflada)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f1917c8d-bfa7-4cf4-ad99-541eb07ce594", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "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 +} diff --git a/Camper.ipynb b/Camper.ipynb new file mode 100644 index 0000000..7d39b15 --- /dev/null +++ b/Camper.ipynb @@ -0,0 +1,248 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "0a626b10-f8c1-4fa1-a186-71d6f989e162", + "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", + "\n", + "from jupyter_cadquery import show, show_all,open_viewer, show_clear\n", + "\n", + "from hinge import Hinge\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "67a54d02-2fd4-4f9a-8391-64e8617a5aef", + "metadata": {}, + "outputs": [], + "source": [ + "#cv = open_viewer(\"Build123d\", anchor=\"split-bottom\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "cd726fcd-9dea-4a0d-9710-519b45a58f88", + "metadata": {}, + "outputs": [], + "source": [ + "cv = open_viewer(\"Build123d\", anchor=\"right\")" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "0859af03-2222-4b9d-b6fe-04bbc2794516", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "cc\n" + ] + }, + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "podnies_karnister = False\n", + "otwarta_szuflada = True\n", + "\n", + "\n", + "# Wymiary szkieletu boxa (mm)\n", + "dl = 1810.5\n", + "sz = 570.5\n", + "wys = 560\n", + "profil = 40\n", + "profil_8040 = 80 \n", + "sklejka = 15\n", + "prowadnica = 19\n", + "\n", + "# Wymiary karnistra\n", + "dl_k = 360\n", + "sz_k = 500\n", + "wys_k = 230\n", + "\n", + "\n", + "# Wymiary Skrzyni\n", + "dl_sz = 1100\n", + "sz_sz = sz - (2*profil)\n", + "wys_sz = wys - profil\n", + "\n", + "# wymiary zlewu\n", + "\n", + "dl_z = 320\n", + "sz_z = 260\n", + "wys_z = 150\n", + "odstep_zlewu_od_konca = 260\n", + "\n", + "dl_sklejki = dl-dl_sz\n", + "\n", + "\n", + "with BuildPart() as szkielet:\n", + " with Locations((0,-sz/2 + profil/2,0)):\n", + " # Poziome\n", + " with Locations((0, 0, profil/2), (0, sz - profil, profil/2)):\n", + " Box(dl-(2*profil), profil, profil_8040)\n", + " with Locations((0, 0, wys - profil), (0, sz - profil, wys - profil)):\n", + " Box(dl-(2*profil), profil, profil)\n", + " # Pionowe\n", + " with Locations((dl/2-(profil/2),0,wys/2-(profil/2)),(dl/2-(profil/2),sz-(profil),wys/2-(profil/2))):\n", + " Box(profil,profil,wys)\n", + " with Locations((-dl/2+(profil/2),0,wys/2-(profil/2)),(-dl/2+(profil/2),sz-(profil),wys/2-(profil/2))):\n", + " Box(profil,profil,wys)\n", + " # Boczne\n", + " with Locations((dl/2-(profil/2),sz/2-(profil/2),0),(dl/2-(profil/2),sz/2-(profil/2),wys-(profil))):\n", + " Box(profil,sz-(2*profil),profil)\n", + " # sklejka pod karnister\n", + " with Locations((dl/2-dl_sklejki/2,0,0)):\n", + " Box(dl_sklejki,sz,sklejka)\n", + "\n", + "\n", + "\n", + "if podnies_karnister == True:\n", + " podnies_karnister = 600\n", + "else: \n", + " podnies_karnister = wys_k/2 + profil/2 + sklejka\n", + "\n", + "with BuildPart() as karnister:\n", + " with Locations((dl/2-dl_k/2-profil,0,podnies_karnister)):\n", + " Box(dl_k,sz_k,wys_k)\n", + " \n", + "karnister.part.color = Color(\"Blue\")\n", + "\n", + "\n", + "\n", + "if otwarta_szuflada == True:\n", + " szuflada_stan = (-dl/2+dl_sz/2-dl_sz,0,wys/2-profil+15)\n", + "else:\n", + " szuflada_stan = (-dl/2+dl_sz/2,0,wys/2-profil+15)\n", + " \n", + "\n", + "with BuildPart() as szuflada:\n", + " with Locations(szuflada_stan):\n", + " Box(dl_sz,sz_sz-(2*prowadnica),wys_sz)\n", + " offset(amount=-15, openings=szuflada.faces().filter_by(Axis.Z)[-1])\n", + " with Locations((0,0,wys_sz/2)):\n", + " Box(dl_sz,sz_sz-2*prowadnica,sklejka)\n", + " \n", + "with BuildPart() as wyciecie:\n", + " with Locations(szuflada_stan):\n", + " with Locations((dl_sz/2 - sz_z/2 - odstep_zlewu_od_konca ,0,wys_sz/2-wys_z/2-sklejka/2+1)):\n", + " Box(sz_z,dl_z,wys_z)\n", + " to_edges = wyciecie.edges().filter_by(Axis.Z)\n", + " fillet(to_edges,radius=20)\n", + "\n", + "\n", + "with BuildPart() as zlew:\n", + " with Locations(szuflada_stan):\n", + " with Locations((dl_sz/2 - sz_z/2 - odstep_zlewu_od_konca ,0,wys_sz/2-wys_z/2-sklejka/2+1)):\n", + " Box(sz_z,dl_z,wys_z)\n", + " # with Locations(zlew.faces().last):\n", + " # Hole(10)\n", + " offset(amount=-10,openings=zlew.part.faces().filter_by(Axis.Z)[-1])\n", + " test = zlew.faces().last\n", + " with Locations((0,dl_z/2-50,0)):\n", + " Hole(20)\n", + " to_edges = zlew.edges().filter_by(Axis.Z)\n", + " fillet(to_edges,radius=10)\n", + "\n", + "\n", + "\n", + "\n", + "with BuildPart() as razem:\n", + " add(szkielet)\n", + " add(szuflada)\n", + " add(karnister)\n", + " with Locations((0,0,sklejka)):\n", + " add(wyciecie,mode=Mode.SUBTRACT)\n", + " add(zlew)\n", + "\n", + "\n", + "\n", + "# with BuildPart() as model:\n", + "# add(Hinge(20, 40, 6, 2, 3,False))\n", + "\n", + "# show(model.part)\n", + "\n", + "\n", + "\n", + "# render_part(my_part.part) # jeśli używasz jupyter + ocp_vscode\n", + " \n", + "\n", + "\n", + "# show(szuflada)\n", + "# show_all()\n", + "# show(razem)\n", + "show(zlew,test)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "96345b66-b36c-477d-8929-eebee31d89ed", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a6ee791b-7852-4eda-b268-889766967eb2", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "id": "141cbaf3-fdda-47ad-9409-0a28455c1d13", + "metadata": {}, + "source": [] + } + ], + "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 +}