LDraw.org Discussion Forums

Full Version: Duplo or Lego Alphabet Script (and question about groups)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone,

The attached script (just change .txt to .lua) lets you write words in a Duplo or Lego font. 

Just change the part and factor variables in addLetter to get the different versions. For brevity, the letters are defined using positions by studs and brick height and are multiplied by the factor to get coordinates. As such, they will work for any brick that is 2 studs wide with height 1. 

function addLetter(color, studOffset, letter)
  -- Duplo
  --   local part = '3437.dat'
  --   local factor = ldc.vector(40, -48, 40)
  -- Lego
  local part = '3003.dat'
  local factor = ldc.vector(20, -24, 20)
Question: Is it possible to add a group in an an LDCad script? I'd like to add the parts in each letter to a group, and then add a group for the entire word. The best example I have seen is in the Add Wall example script, but that just adds the new parts to the selection.

Thank you,

(2021-08-12, 18:21)Roland Melkert Wrote: [ -> ]That script only lists the 'static' functions, ldc.vector() etc returns lua 'user data' which has its own set of functions.

That said the current lua interface is 99% readonly oriented, so you can't copy groups as you currently can't create groups using pure script.

The documentation is ancient (~version 1.4), I've been working on updating it but its boring and therefor slowly progressing Smile

I've uploaded the part I already done, as it might be somewhat helpful.

Don't mind the 150 or so "todo's"  Big Grin

Please note there are some Alpha 2 things (input/control/etc) in there not available in 1.6/alpha1

Looks like Roland already answered my question in another thread, LDCad 1.7 Alpha 1 (win + linux), emphasis mine.
(2022-03-07, 17:20)Mike C Wrote: [ -> ]Is it possible to add a group in an an LDCad script?
At the moment it is not possible to add things to a group.

This is something I'm planning to add though.