====== HyperFun in the Fab Lab: Relief carving ====== {{http://www.hyperfun.org/HFab/FabLabHF/spoon3.jpg?255x133&nolink}} {{http://www.hyperfun.org/HFab/FabLabHF/HF_spoon3.jpg?255x133&nolink}} {{http://www.hyperfun.org/HFab/FabLabHF/HF_spoon3_zoom.jpg?300x224&nolink}} We use the [[tools|HyperFun Polygon Convertor]]: a 2D polygon drawing tool (polygon.exe) and a convertor from a polygon to HyperFun (Polygon_FRep.exe) for modeling a relief for carving. Then, we carve the generated relief on a block and on a spoon. - Draw a symbol or a letter as a 2D polygon using polygon.exe \\ Draw the polygon clockwise (see the "HF" letter [[http://www.hyperfun.org/HFab/FabLabHF/HF_let.jpg|HF_let.jpg]] as an example). It is better to use the whole available space, the letter can be scaled later. - Save the polygon data ([[http://www.hyperfun.org/HFab/FabLabHF/HF_let.txt|HF_let.txt]]). - From the command prompt window, run the command: \\ Polygon_FRep HF_let.txt HF_let.hf \\ The HyperFun file [[http://www.hyperfun.org/HFab/FabLabHF/HF_let.hf|HF_let.hf]] is generated. Note that x[3] is used in this model, so formally it is an infinite cylinder in 3D. The maximal bounding box for drawn polygons is x:[0,760], y:[0,470]. - (optional) To check the generated HF_let.hf model, the HFW program can be used as follows: Assign x[3] -> 0 f -> 0 \\ In Redering-Polygonization-Axes/Box visibility, make: Long step 100 short step 0 Render frame: [[http://www.hyperfun.org/HFab/FabLabHF/HF_let_HFW.jpg|HF_let_HFW.jpg]] \\ Note, it is up side down, because of the drawing the letter in screen coordinates. The letter can be vertically flipped later. - To flip the letter and to scale it to any given rectangle, add the following lines at the top: -- box to fit the letter in xmin = 2; xmax = 4; ymin = 2; ymax = 4; xt = 760*(x[1]-xmin)/(xmax-xmin); yt = 470*(1-(x[2]-ymin)/(ymax-ymin)); \\ and change in the text below these symbols \\ x[1] to xt \\ x[2] to yt \\See [[http://www.hyperfun.org/HFab/FabLabHF/HF_let_up.hf|HF_let_up.hf]] as an example and its image [[http://www.hyperfun.org/HFab/FabLabHF/HF_let_up.jpg|HF_let_up.jpg]]. - Making a relief solid. \\ Add at the end of the letter model the following lines: zmax = 1.1; slope = 0.2; letnorm = zmax * (2/(1+exp(-slope*letfit))-1); height = letnorm-x[3]; bound = x[3]-0.1; letrel = height & bound; \\ See [[http://www.hyperfun.org/HFab/FabLabHF/HF_let_relief.hf|HF_let_relief.hf]] model and its image [[http://www.hyperfun.org/HFab/FabLabHF/HF_let_relief.jpg|HF_let_relief.jpg]], where \\ zmax is height of the relief; \\ slope controls smoothness of the relief; \\ height defines a solid as f(x,y)-z >= 0 \\ bound is a boundary solid for the relief. - "Carving" the relief on a block. \\ Make a block object and apply union of it with the relief solid. See the [[http://www.hyperfun.org/HFab/FabLabHF/HF_let_box.hf|HF_let_box.hf]] model and its image [[http://www.hyperfun.org/HFab/FabLabHF/HF_let_box.jpg|HF_let_box.jpg]] - Carving on the spoon. - Change the box for scaling the letter: -- box to fit the letter in xmin = 1.7; xmax = 4.7; ymin = 1.4; ymax = 4.4; - Change the bound solid for the relief: center = [3, 3, 3]; bound = hfSphere(x, center, 2.9); - Change the block model to a [[http://www.hyperfun.org/HFab/FabLabHF/spoon3.hf|spoon3.hf]] model. See the initial spoon image [[http://www.hyperfun.org/HFab/FabLabHF/spoon3.jpg|spoon3.jpg]] \\ See the relief carving on the spoon model [[http://www.hyperfun.org/HFab/FabLabHF/HF_spoon3.hf|HF_spoon3.hf]], and the images [[http://www.hyperfun.org/HFab/FabLabHF/HF_spoon3_zoom.jpg|HF_spoon3_zoom.jpg]] and [[http://www.hyperfun.org/HFab/FabLabHF/HF_spoon3.jpg|HF_spoon3.jpg]]. \\ To make the STL file for fabrication, use the following command: hfp HF_spoon3.hf -b 0,0,0,20,8,8 -g 131 -stl hf_spoon.stl