Last active
July 23, 2023 09:29
-
-
Save medicationforall/55211ef5d10f685bbf5a15a4c6903d52 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| import cadquery as cq | |
| from cqindustry import Walkway | |
| from cqterrain import tile as terrain_tile, greeble | |
| def __vent_greeble(length, width, height): | |
| t = greeble.vent(length, width, height ,inner_width = height-1,) | |
| return t | |
| tile_styles = [ | |
| terrain_tile.plain, | |
| terrain_tile.chamfer_frame, | |
| terrain_tile.rivet, | |
| terrain_tile.slot, | |
| __vent_greeble | |
| ] | |
| tile_styles_count = len(tile_styles) | |
| def custom_tile2(length, width, height): | |
| tile_style = random.randrange(0,5) | |
| if tile_style in range(tile_styles_count): | |
| tile = tile_styles[tile_style](length, width, height) | |
| else: | |
| raise Exception(f"unknown tyle style {tile_style}") | |
| return tile | |
| bp = Walkway() | |
| bp.length = 225 | |
| bp.width = 75 | |
| bp.height = 6 | |
| bp.render_tabs=False | |
| bp.render_rails = 'left' | |
| bp.rail_width = 6 | |
| bp.rail_height = 50 | |
| bp.rail_chamfer = 25 | |
| bp.rail_slot_type = 'archPointed' | |
| bp.rail_slot_length = 8 | |
| bp.rail_slot_pointed_inner_height = 9 | |
| bp.rail_slot_top_padding = 5 | |
| bp.rail_slot_length_offset = 8 | |
| bp.rail_slots_end_margin = 15 | |
| bp.render_slots = 'irregular'#False | |
| bp.tile_max_height = 4 | |
| bp.tile_seed = 'whisper3' | |
| bp.make_tile_method = custom_tile2 | |
| bp.tile_max_columns = 6 | |
| bp.tile_max_rows = 6 | |
| bp.make() | |
| display = bp.build() | |
| base_height = 3.5 | |
| base = ( | |
| cq.Workplane("XY") | |
| .cylinder(base_height, 12.6) | |
| ) | |
| pip_height = 2.3 | |
| pip_radius = 1.56 | |
| magnet = ( | |
| cq.Workplane("XY") | |
| .cylinder(pip_height, pip_radius) | |
| ) | |
| base_mag_height = base_height+pip_height | |
| base_mag = ( | |
| cq.Workplane("XY") | |
| .union(base) | |
| .union(magnet.translate((0,0,-1*(base_mag_height/2)))) | |
| ) | |
| x_translate = 33 | |
| y_translate = 30 | |
| row_2_offset = 12 | |
| bases = ( | |
| cq.Workplane("XY") | |
| #row 1 | |
| .union(base_mag) | |
| .union(base_mag.translate((-x_translate,0,0))) | |
| .union(base_mag.translate((x_translate,0,0))) | |
| .union(base_mag.translate((-x_translate*2,0,0))) | |
| .union(base_mag.translate((x_translate*2,0,0))) | |
| .union(base_mag.translate((x_translate*3,0,0))) | |
| #row2 | |
| .union(base_mag.translate(((-x_translate*2)+row_2_offset,-1*y_translate,0))) | |
| .union(base_mag.translate(((-x_translate*1)+row_2_offset,-1*y_translate,0))) | |
| .union(base_mag.translate(((x_translate*2)-row_2_offset,-1*y_translate,0))) | |
| .union(base_mag.translate(((x_translate*3)-row_2_offset,-1*y_translate,0))) | |
| ).translate((-1*(x_translate/2),10,0)) | |
| scene = ( | |
| cq.Workplane("XY") | |
| .union(display) | |
| .cut(bases.translate((0,0,((bp.height/2)-base_height/2)+1.5))) | |
| ) | |
| #show_object(scene) | |
| cq.exporters.export(scene, "stl/minidisplay.stl") |
Author
medicationforall
commented
Jul 16, 2023
- https://github.com/medicationforall/cqindustry
- https://github.com/medicationforall/cqterrain
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
