diff --git a/shell/export/print/README.md b/shell/export/print/README.md index fc1cc22..82d9b5f 100644 --- a/shell/export/print/README.md +++ b/shell/export/print/README.md @@ -18,10 +18,10 @@ Designed for a **0.4 mm nozzle**, ~0.2 mm layers. ## Support blocks (TopShell, BottomShell) `TopShell_with_buck.stl` and `BottomShell_with_buck.stl` include a few plain rectangular blocks in the big open voids, already in the right place (separate lumps in the same STL, sitting on the bed). `TopShell.stl` / `BottomShell.stl` are the bare shells (default). -- TopShell: 2 blocks (about 13.5 and 3.6 cm3; the one out front under the OLED housing was dropped, `--max-y 50`). BottomShell: 2 side blocks (about 4 cm3 each). +- TopShell: 10 blocks: the big one in the main cavity (about 13.5 cm3), one by the posts (about 3.4 cm3), and 8 small ones around the face buttons and under the thumbstick (side strips, between the button columns, beside and behind the stick; 0.5 to 2.3 cm3 each, all at least 0.3 mm from the part). The one out front under the OLED housing was dropped (`--max-y 50`). BottomShell: 2 side blocks (about 4 cm3 each). - Each block keeps 0.3 mm or more from the part on every side, and its flat top is lifted to about 0.2 mm under the lowest roof point above it. The sloped parts of the roof, and everything else, still use normal slicer supports. - In OrcaSlicer load the STL and answer yes to "split into parts". Give the block parts 1 wall and about 5% infill, no supports. -- Regenerate with `tools/gen_buck.py ` (needs numpy, scipy, scikit-image, trimesh, rtree). +- Regenerate with `tools/gen_buck.py [--max-y 50] [--band -20.5 22.5]` (`--band` adds the small face-button/thumbstick blocks; TopShell uses both flags) (needs numpy, scipy, scikit-image, trimesh, rtree). ## Built-in breakaway supports - Tapered pillars: 1.0 mm base, 0.6 mm tip (0.7/0.5 mm in tight spots), ending 0.2 mm below the part so they snap off. diff --git a/shell/export/print/stl/TopShell_with_buck.stl b/shell/export/print/stl/TopShell_with_buck.stl index e951545..be58906 100644 Binary files a/shell/export/print/stl/TopShell_with_buck.stl and b/shell/export/print/stl/TopShell_with_buck.stl differ diff --git a/shell/export/print/tools/gen_buck.py b/shell/export/print/tools/gen_buck.py index a84cc71..002d140 100644 --- a/shell/export/print/tools/gen_buck.py +++ b/shell/export/print/tools/gen_buck.py @@ -106,7 +106,7 @@ def _max_rect(m): start=s0 st.append((start,cur)) return best -def make_boxes(tris,extra=2,min_cm3=3.0,max_boxes=3): +def make_boxes(tris,extra=2,min_cm3=3.0,max_boxes=3,band=None): solid,x0,y0,m=solid_grid(tris) fill,_,_=make_buck_from(solid,x0,y0,need_all=True) # downsample 2x in XY and Z, erode by `extra` coarse voxels so the blocks stay well clear @@ -114,6 +114,8 @@ def make_boxes(tris,extra=2,min_cm3=3.0,max_boxes=3): f=f.reshape(f.shape[0]//2,2,f.shape[1]//2,2,f.shape[2]//2,2).all(axis=(1,3,5)) f=ndimage.binary_erosion(f,structure=np.ones((3,3,1)),iterations=extra,border_value=1) cx,cz=CX*2,CZ*2; boxes=[] + if band: # only keep free space whose y lies inside the band + ys=y0+np.arange(f.shape[1])*cx; f[:,(ysband[1]),:]=False for _ in range(max_boxes): best=None; acc=np.ones(f.shape[:2],bool) for k in range(f.shape[2]): @@ -157,6 +159,11 @@ def raise_top(tris,b,gap=Z_GAP,side=0.3): if __name__=='__main__': # usage: gen_buck.py in_print_plain.stl out_with_buck.stl (boxes are added as extra lumps in place) tris=load(sys.argv[1]); boxes=make_boxes(tris,extra=1,min_cm3=2.5,max_boxes=4) + if '--band' in sys.argv: # extra small blocks in a y band, e.g. around the face buttons / thumbstick: --band -20 22 + i=sys.argv.index('--band'); bb=(float(sys.argv[i+1]),float(sys.argv[i+2])) + boxes+=make_boxes(tris,extra=1,min_cm3=0.3,max_boxes=8,band=bb) + if '--max-y' in sys.argv: # drop blocks out past this print-frame y (e.g. outside the shell, under the OLED housing) + my=float(sys.argv[sys.argv.index('--max-y')+1]); boxes=[b for b in boxes if b[3]<=my] boxes=[raise_top(tris,b) for b in boxes] allt=np.concatenate([tris]+[box_tris(b) for b in boxes]) if boxes else tris write(sys.argv[2],allt,'part+buck')