Created
July 18, 2023 10:23
-
-
Save medicationforall/8859ea02f7822c9f9cc500af1b24ad84 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 = 'bigbases9' | |
| bp.make_tile_method = custom_tile2 | |
| bp.tile_max_columns = 7 | |
| bp.tile_max_rows = 6 | |
| bp.make() | |
| display = bp.build() | |
| base_height = 3.5 | |
| base_radius = 20.1 | |
| base = ( | |
| cq.Workplane("XY") | |
| .cylinder(base_height, base_radius) | |
| ) | |
| 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 = 43 | |
| 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((0,0,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_5_40.stl") |
Author
medicationforall
commented
Jul 18, 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
