This commit is contained in:
parent
5e92eacb64
commit
a55c551a54
|
@ -24,14 +24,14 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 18,
|
"execution_count": 2,
|
||||||
"id": "68ca929c-7e78-4ce9-bafc-a336328244db",
|
"id": "68ca929c-7e78-4ce9-bafc-a336328244db",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"application/vnd.jupyter.widget-view+json": {
|
"application/vnd.jupyter.widget-view+json": {
|
||||||
"model_id": "d4c2b63ffa7a48cfa7c929f5cb97270f",
|
"model_id": "c3fd5673698d49c7ae097f6ec5deed41",
|
||||||
"version_major": 2,
|
"version_major": 2,
|
||||||
"version_minor": 0
|
"version_minor": 0
|
||||||
},
|
},
|
||||||
|
@ -72,34 +72,103 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 3,
|
||||||
"id": "010eed22-3a06-4d28-bdce-4cc8e593b1aa",
|
"id": "167a8aea-a7cb-4c0a-bd67-11bcf92c4be9",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# -*- coding: utf-8 -*-\n",
|
"grubosc_scianki = 3\n"
|
||||||
"from build123d import *\n",
|
|
||||||
"\n",
|
|
||||||
"# Rozpoczynamy tworzenie nowego szkicu 2D\n",
|
|
||||||
"# Wszystko, co narysujemy wewnątrz tego bloku 'with', będzie częścią 'my_sketch'\n",
|
|
||||||
"with BuildSketch() as my_sketch:\n",
|
|
||||||
" # Używamy Polyline, aby narysować kształt, podając współrzędne kolejnych punktów\n",
|
|
||||||
" Polyline(\n",
|
|
||||||
" (0, 10), # Punkt startowy\n",
|
|
||||||
" (0, 30), # Linia prosto w górę\n",
|
|
||||||
" (30, 30), # Linia w prawo\n",
|
|
||||||
" (60, 15), # Linia ukośna w dół i w prawo\n",
|
|
||||||
" (50, 0), # Linia ukośna w dół i w lewo\n",
|
|
||||||
" (20, 0), # Linia w lewo\n",
|
|
||||||
" close=True # Automatycznie zamykamy kształt, rysując linię do punktu startowego\n",
|
|
||||||
" )\n",
|
|
||||||
" # Tworzymy wypełnioną powierzchnię (Face) z narysowanego, zamkniętego konturu\n",
|
|
||||||
" make_face()\n",
|
|
||||||
"\n",
|
|
||||||
"# Wyświetlamy gotowy szkic\n",
|
|
||||||
"# Możesz też użyć show_all(), jeśli masz więcej obiektów\n",
|
|
||||||
"show(my_sketch)"
|
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 13,
|
||||||
|
"id": "ffefb0fe-56f5-4d89-816c-9a964445e1fb",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"c\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"<cad_viewer_widget.widget.CadViewer at 0x1506d0d3b9b0>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 13,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"with BuildPart() as uchwycik:\n",
|
||||||
|
" with BuildSketch():\n",
|
||||||
|
" with BuildLine() as uch_ln:\n",
|
||||||
|
" l1 = Line((0,0),(10,0))\n",
|
||||||
|
" l5 = PolarLine((10,0),22,-22)\n",
|
||||||
|
" # p2 = l5.end_point()\n",
|
||||||
|
" # print(p2)\n",
|
||||||
|
" l6 = PolarLine(l5.end_point(),10,90)\n",
|
||||||
|
" l4 = PolarLine((10,10),22,-22)\n",
|
||||||
|
" l3 = Line((0,10),(10,10))\n",
|
||||||
|
" l2 = Line((0,0),(0,10))\n",
|
||||||
|
" make_face()\n",
|
||||||
|
" extrude(amount=grubosc_scianki)\n",
|
||||||
|
"\n",
|
||||||
|
"with BuildPart() as filarki:\n",
|
||||||
|
" with GridLocations(0,20,1,2):\n",
|
||||||
|
" Cylinder(7/2,15)\n",
|
||||||
|
" Hole(4/2)\n",
|
||||||
|
" with Locations((2,grubosc_scianki/2,-2.5)):\n",
|
||||||
|
" add(uchwycik,rotation=((90,0,0)))\n",
|
||||||
|
" f1 = filarki.faces().filter_by(Axis.Y)[1]\n",
|
||||||
|
" f2 = filarki.faces().filter_by(Axis.Y)[2]\n",
|
||||||
|
" # with BuildSketch(f1):\n",
|
||||||
|
" # with BuildLine():\n",
|
||||||
|
" # pass\n",
|
||||||
|
" \n",
|
||||||
|
" \n",
|
||||||
|
" \n",
|
||||||
|
"show(filarki,l1)\n",
|
||||||
|
"\n",
|
||||||
|
"# with BuildPart() as test:\n",
|
||||||
|
"# with BuildSketch():\n",
|
||||||
|
"# with BuildLine()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "f309c60a-d31a-4363-b75e-443f85df11d3",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# length, width, thickness = 80.0, 60.0, 10.0\n",
|
||||||
|
"\n",
|
||||||
|
"# with BuildPart() as ex4:\n",
|
||||||
|
"# with BuildSketch() as ex4_sk:\n",
|
||||||
|
"# with BuildLine() as ex4_ln:\n",
|
||||||
|
"# l1 = Line((0, 0), (length, 0))\n",
|
||||||
|
"# l2 = Line((length, 0), (length, width))\n",
|
||||||
|
"# l3 = ThreePointArc((length, width), (width, width * 1.5), (0.0, width))\n",
|
||||||
|
"# l4 = Line((0.0, width), (0, 0))\n",
|
||||||
|
"# # make_face()\n",
|
||||||
|
"# # extrude(amount=thickness)\n",
|
||||||
|
"\n",
|
||||||
|
"# show(ex4_ln)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "e2facbc6-5f0c-45b8-beaf-4a0b3c8f8856",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
|
119
mamba.ipynb
119
mamba.ipynb
File diff suppressed because one or more lines are too long
|
@ -14,6 +14,13 @@ import ipywidgets as widgets''',
|
||||||
model = import_step("element.step")
|
model = import_step("element.step")
|
||||||
show_object(model)''',
|
show_object(model)''',
|
||||||
|
|
||||||
|
"BuildPart-BuildLine":'''
|
||||||
|
|
||||||
|
with BuildPart():
|
||||||
|
with BuildSketch():
|
||||||
|
with BuildLine():
|
||||||
|
'''
|
||||||
|
|
||||||
"🖥️ view": '''
|
"🖥️ view": '''
|
||||||
cv = None # viewer globalny
|
cv = None # viewer globalny
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue