Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
Jasems

Simple 3d printer color input

Question

Description:


I have been having fun printing stuff w/the 3d printer just to the plain chamelium blocks.  I have just been going in and editing a single file changing the hex color, exiting then printing.  Looking to have a program to input just the hex color code, and printer will print it.  Maybe even have a 2nd option after printing to give a quantity?


 


Function:


Basically load program, it asks for color hex code.  Next screen could be how many, or even ask for the texture block you want to use, in my case just been using chamelium blocks.  Then 3rd screen asks for how many.


 


Deadline:


No rush, even just something to get me started would be helpful.  Everything I learn about programming I forget after not doing it for a few months... lol


 


Additional Information:


none atm


 


Thanks a bunch!


 


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Ok I got something basic working, but need help w/the hex input text.

 

--------------------------------------------------------------------------------------------

local term = require("term")

 

local printer = component.printer3d

 

term.clear()

term.setCursor(1,1)

 

printer.reset()

-- Name the Block

io.write(" Name Your Block: ")

printer.setLabel(io.read())

-- This part works great since the read returns as a string, probably a better way to do it, but I am a beginner lol

 

--set the color tint

io.write("Write in hex color: ")

printer.addShape(0,0,0,16,16,16, "opencomputers:White","true",io.read())

-- this part doesn't get the io.read() command since it returns as a string, i need it to return as just 0xFFFFFF (for example) without quotes.

 

printer.commit(1)

--------------------------------------------------------------------------------------------

So the above prints, but need to figure out how to change that last io.read() in the printer.addShape tint color.  Would be cool to have it already grab the 0x part so i just have to type the hex color code.  Go easy on me pretty new at all this lol...

Link to post
Share on other sites
  • 0

That's how I currently have the code, but it doesn't work.  If I manually put the hex code at 0xFFFFFF (for example) in place of the io.read() it works fine, but I think it has something to do w/that sending a string (or something with quotes) but the hex code doesn't work w/the quotes like the booleon and texture does.

Link to post
Share on other sites
  • 0

So I got this semi-working.  By adding the "*n" to the io.read it seems to take the code and change the hex.  For some reason though it likes to mess up the program temporarily now though.  Probably a much better way to do all of this (which I welcome the improvements), but I got it working for now.  Yay!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.