Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- (c) ProgramCrafter
- -- This program creates and prints 3D models of letters.
- local c = require('component')
- local p = c.printer3d
- local g = c.gpu
- local tx1 = 'hardened_clay_stained_blue'
- local tx2 = 'emerald_block'
- local args = {...}
- if args[1] then tx1 = args[1] end
- if args[2] then tx2 = args[2] end
- p.reset()
- p.addShape(0,0,1, 16,16,16, tx1)
- while true do
- io.stdout:write('Next shape: ')
- local v = io.read()
- if v == '0' or v:lower() == 'print' then -- start printing
- io.stdout:write('Count: ')
- local c = io.read() or 0
- p.commit(tonumber(c))
- while (p.status()) == 'busy' do os.sleep(0.05) end
- break
- elseif v and tonumber(v) then
- v = tonumber(v)
- local lx = math.floor(v / 4096)
- v = v - lx * 4096
- local w = math.floor(v / 256)
- v = v - w * 256
- local by = math.floor(v / 16)
- v = v - by * 16
- local h = v
- p.addShape(lx,by,0, lx+w,by+h,1, tx2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement