## Christmas Tree Extrusion

Type: Mini-lesson

Theme: Engineering

Grades: 5, 6, 7, 8, 9, 10, 11, 12

Learning Target: Students will use coordinate pairs to create an extrusion Christmas tree in OpenSCAD.

Instructions
1. Create one-half of a Christmas tree design, used for extrusion. It must start at (0,0). The final point must end on the y-axis. Example: https://www.desmos.com/calculator/rxrd99lw88
2. Use the web browser Javascript console F-12 > Console to paste-enter the following code to extract the coordinates for use in OpenSCAD. Copy output from the console log.
`state = Calc.getState()ordered_pairs = "";pair="";for (let i = 0; i < state.expressions.list.length; i++) { if (state.expressions.list[i].type == "table") { for (let k = 0; k < state.expressions.list[i].columns[0].values.length; k++) { ordered_pairs += ",["+state.expressions.list[i].columns[0].values[k]+","+state.expressions.list[i].columns[1].values[k]+"]"; } }}console.log(ordered_pairs.substring(1));`
`rotate_extrude(\$fn=200) polygon( points=[[0,0],[1,0],[1,1],[2,1],[1,2],[2,2],[1,3],[1.5,3],[0,6]] );`