From 0f80684c1bf403b1a63d9a0390bf9989c919262f Mon Sep 17 00:00:00 2001 From: Yeicor <4929005+Yeicor@users.noreply.github.com> Date: Fri, 5 Jan 2024 19:19:11 +0100 Subject: [PATCH] Better handle bars --- parts/__pycache__/handle_bars.cpython-311.pyc | Bin 0 -> 4981 bytes parts/__pycache__/stem.cpython-311.pyc | Bin 5191 -> 5524 bytes parts/handle_bars.py | 29 ++++++++++-------- parts/stem.py | 9 +++--- 4 files changed, 21 insertions(+), 17 deletions(-) create mode 100644 parts/__pycache__/handle_bars.cpython-311.pyc diff --git a/parts/__pycache__/handle_bars.cpython-311.pyc b/parts/__pycache__/handle_bars.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4826db9a157dd43e82118aa0770f77d614b6304a GIT binary patch literal 4981 zcmcImU2NOd6(+??iTbf5%CZ#O@n7t?mhD9Tjg#3;V%N@+*2~Y5A+huz$mX>zTYnSf zI>{cY4IAJN0j2~6lI}?xiqu8(kPUqZusy8ZV>^^Ih?(F^4eZHp3Yv$Yz>u9wnYQT0 zMcQH%dG5LAo}cfYdk(1&Yib-6T>tKWfHT1ThfIviwZnY<8;+vxQvxN>Nh(E0Xqxbr zq~#iAuW-yYGBQb&Vk2zI8nMz;I@nHOTL+c%>}Yd4I`%!C87hrdshi9UwMttkOk>+a znxa02r*aKbx-CjNA`StO-$M(m!&A8+inE>Sr$n@Bsd%BO8L$B>HsTbl*fnp7)PQF< zb_!IzVMf8sRyAYi8G$olHUmQ$o`N4yzo>m!1cX$ z0kP^Hg6YSG18SIx1V9>u$GUXL5Sw*Mds{OUV8jhejmFfxD*UD$1odR_mK@IJU(CZXb zNeH)ASN_s24v<%!eewg&<=bDAQHVB%1LkU?Nq3LI^EwVJoi@(#QLS0aJo~QAU{o2Z0njT2Y0*&G%{;OXv=MRSUIoQf^t#KK}; zbL*3AJeQBnWpemp$g({KcH88$yiNY?Y?D72AtpznZ%2USAh*OX8&4({(%b)i@#4ic zJTG>1a>Pj22Ei_`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V#a})P$DGUtuJ@K$cT circle) -# How much to overlap the stem with our model for a stronger connection -stem_clip = (stem_fillet, 2.0) - handlebar_side_xy = (60, 20) # (center, start) handlebar_size = (10, wall) # (width, height) +handlebar_rot = 5 # Rotation of the handlebar (degrees) +handlebar_rad = 16 # Radius of the handlebar # ================== MODELLING ================== handlebar_side_loc = Location( (handlebar_side_xy[0], handlebar_side_xy[1], stem_height), (0, 90, 90)) with BuildSketch(handlebar_side_loc) as handlebar_side: - Rectangle(handlebar_size[0], handlebar_size[1], align=Align.MIN) + Rectangle(handlebar_size[0], handlebar_size[1], + align=Align.MIN, rotation=-handlebar_rot) with BuildPart() as handlebar_side_conn: conn_base = sum(stem_part_core.faces().group_by( Axis.Y)[-3:], ShapeList()) @@ -56,7 +50,7 @@ with BuildLine() as handlebar_side_conn_path: Spline(face_loc.position, handlebar_side_loc.position, - tangents=[(0, 1, 0), (1, 0, 0)], + tangents=[(0, 1, 0), Vector(1, 0, -0.2).normalized()], tangent_scalars=[.5, 1]) sweep(sections=[handlebar_side.sketch, face], path=handlebar_side_conn_path, multisection=True) @@ -64,12 +58,23 @@ del face_loc del handlebar_side_conn_path del handlebar_side_loc - del handlebar_side + +save = handlebar_side_conn.faces().group_by(Axis.X)[-1].face().center_location +with BuildPart() as handle_bar_core: + with BuildSketch(save): + Rectangle(handlebar_size[1], handlebar_size[0], + rotation=-handlebar_rot) + revolve(axis=Axis(save.position - (0, 0, handlebar_rad + + handlebar_size[1]/2), (0, 1, 0))) + del save +handlebar_side_conn.part += handle_bar_core.part # Join a mirrored version of the handlebar side with BuildPart() as handle_bars_part: add(handlebar_side_conn) + add(mirror(objects=handlebar_side_conn.part)) + del handlebar_side_conn if __name__ == "__main__": # While developing this single part ocp_vscode.show_all() diff --git a/parts/stem.py b/parts/stem.py index 662c4bb..50fb111 100644 --- a/parts/stem.py +++ b/parts/stem.py @@ -22,9 +22,6 @@ # How much to overlap the stem with our model for a stronger connection stem_clip = (stem_fillet, 2.0) -handlebar_side_xy = (60, 20) # (center, start) -handlebar_size = (10, wall) # (width, height) - # ================== MODELLING ================== @@ -80,8 +77,10 @@ def unique_ordered(seq): del conn_face_bb # Stem part core is required as is by handle_bars.py - -stem_part = stem_part_core +with BuildPart() as stem_part: + add(deepcopy(stem_part_core)) + to_fillet = edges().group_by(Axis.X)[-1] + fillet(to_fillet, wall) if __name__ == "__main__": # While developing this single part ocp_vscode.show_all()