LDraw.org Discussion Forums
[LDCad] Duplo or Lego Alphabet Script (and question about groups) - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: LDraw Editors and Viewers (https://forums.ldraw.org/forum-11.html)
+--- Thread: [LDCad] Duplo or Lego Alphabet Script (and question about groups) (/thread-26102.html)



Duplo or Lego Alphabet Script (and question about groups) - Mike C - 2022-03-07

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. 

Code:
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,
Mike

   


RE: Duplo or Lego Alphabet Script (and question about groups) - Mike C - 2022-03-10

(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.
http://www.melkert.net/LDCad/docs/scriptAPI2

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.


RE: Duplo or Lego Alphabet Script (and question about groups) - Roland Melkert - 2022-03-10

(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.