LDCad Script to Recolor Model from Inventory Parts


Script to Recolor Model from Inventory Parts
#1
Lightbulb 
Hello everyone, 

This is my first time posting on these forums and my first time using Lua, but maybe this will be useful or fun to someone else. 
  • My 3 year-old and I build almost exclusively in DUPLO. 
  • Our collection is about 2,500 parts.
  • He enjoys building anything big: towers, bridges, castles, etc. 
  • I enjoy trying to make our creations aesthetically pleasing. So far, that just means using parts in a color gradient (e.g. rainbow). 
  • I also use Rebrickable.com to maintain my part inventory.

LDraw and LDCad have been wonderful resources for making us both happy. By coloring my designs in LDCad, I can have a plan when I begin a build with my sometimes impatient building partner.

These attachments are my attempt at using Lua to let me build in LDCad without worrying about color, and then recolor the entire model with a click from the parts we actually own. 

Originally, I wrote this to assign color to the parts in order by their y value. But then I actually read Roland's very helpful LDCad documentation at http://www.melkert.net/LDCad/docs/scriptAPI where I saw the getComp method, and realized I could parameterize this function to easily sort along different axes (e.g., XYZ, ZYX, etc.)

If anyone has ANY thoughts or suggestions, please share, as I am clearly new at this.

Next, I plan on working on scripts to build walls using the parts in my inventory. 

Happy building,
Mike


Attached Files Thumbnail(s)
                           

.zip   MJC-Recolor.zip (Size: 4.95 KB / Downloads: 3)
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Script to Recolor Model from Inventory Parts - by Mike C - 2022-02-28, 2:01

Forum Jump:


Users browsing this thread: 1 Guest(s)