Advertisement
Doob

3dmodels

Jan 30th, 2016
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.17 KB | None | 0 0
  1. local printer3d = require('component').printer3d
  2.  
  3. local tModels = {
  4.   {1, 0, 1, 15, 1, 15},
  5.   {1, 15, 1, 15, 16, 15},
  6.   {1, 1, 15, 15, 15, 16}
  7. }
  8.  
  9. local tColors = {
  10.   'wool_colored_white',
  11.   'wool_colored_orange',
  12.   'wool_colored_yellow',
  13.   'wool_colored_lime',
  14.   'wool_colored_blue',
  15.   'wool_colored_red'
  16. }
  17.  
  18. local tBorder = {
  19.   {
  20.     {0,0,1,1,1,16},
  21.     {0,0,0,15,1,1},
  22.     {15,0,0,16,1,15},
  23.     {16,0,15,1,1,16}
  24.   },
  25.   {
  26.     {0,15,1,1,16,16},
  27.     {0,15,0,15,16,1},
  28.     {15,15,0,16,16,15},
  29.     {16,15,15,1,16,16},
  30.   },
  31.   {
  32.     {0,0,15,1,15,16},
  33.     {1,0,15,16,1,16},
  34.     {0,15,15,15,16,16},
  35.     {15,1,15,16,16,16},
  36.   }
  37. }
  38.  
  39. for i = 1, #tModels do
  40.   for j = 1, #tColors do
  41.     if tColors[j] then
  42.       printer3d.reset()
  43.       printer3d.setLabel(i .. j)
  44.       for k = 1, 4 do
  45.         x1, y1, z1, x2, y2, z2 = table.unpack(tBorder[i][k])
  46.         printer3d.addShape(x1, y1, z1, x2, y2, z2, 'obsidian')
  47.       end
  48.       x1, y1, z1, x2, y2, z2 = table.unpack(tModels[i])
  49.       printer3d.addShape(x1, y1, z1, x2, y2, z2, tColors[j])
  50.       printer3d.commit(1)
  51.       while printer3d.status() == 'busy' do
  52.         os.sleep(1)
  53.       end
  54.     end
  55.   end
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement