Lego Description Language (LDL)
2020-06-01, 20:31 (This post was last modified: 2020-06-01, 20:39 by SNIPE.)
2020-06-01, 20:31 (This post was last modified: 2020-06-01, 20:39 by SNIPE.)
Hi,
Today, I'd like to share a project I've been working on for a few years.
It is the idea of being able to describe lego models without the use of physical or digital lego, and in a way that is:
It works by just having the bare minimum amount of information to build a lego model:
Part type, Part ID, Primative type, Primative ID
These are simply macros for certain paramaters in an ldraw script, that's it!. Let's take a few examples:
This syntax also means you can create helper assemblies in order to position more complex parts then simply DEL(ete) the helper assemblies, which after all is what you do in ldd/ldcad anyhow therefore SNOT and advanced building tequniques are possible including the ability to flex certain types of parts. So the syntax has been tried and tested and can stand up to huge and or complex models.
There are a few syntax shortcuts so far such as part/primative ranges or lists (3003 B1:B50 c1) (3005 B2 c1,c2,c3,c4,), exact part positioning co-cordinates (B2 <25,87,53>) and the IDE will also help you by having tools which leads me onto the bit where I need help from the LDRAW community: building the compiler/IDE:
The idea (assuming you are not just typing into notepad) is to have a C program read the LDL syntax and parse it into native LDRAW script but also display the digital model in real time, as you type, in a graphical output window.
This post is already kinda long so feel free to ask about the full syntax, the IDE, or the compiler, or anything else more below.
Regards, Snipe
Today, I'd like to share a project I've been working on for a few years.
It is the idea of being able to describe lego models without the use of physical or digital lego, and in a way that is:
- Very close to English and not too unintuitive
- Has fast development time
- Is cross platform and highly accessable
- Is powerful enough to represent any possible combination of LEGO parts or building techniques
- Capable of being translated by a computer into a digital model (though this goal was originally part of a seperate "lego programming language" project)
- Flexable parts, hinges, etc are also possible
- Still makes the user learn about lego techniques
- Can be converted into native LDRAW script
It works by just having the bare minimum amount of information to build a lego model:
Part type, Part ID, Primative type, Primative ID
These are simply macros for certain paramaters in an ldraw script, that's it!. Let's take a few examples:
Code:
3005 B1 c1 = 3005 B2 s1
/* placeĀ clutch1 of BRICK1 of type 3005 onto stud1 of BRICK2 of type 3005 */
32316 L1 ph1 = 2780 PI1 pi1
/* place pinhole1 of LIFTARM1 of type 32316 onto pin1 of PIN1 of type 4274 */
/* Now what if we want to attach these two assemblies together? easy: */
3024 PL1 c1 = PIN1 c1
PL1 s1 = B2 C1
/* place clutch1 of PLATE1 of type 3024 onto clutch1 of PIN1.
place stud1 of PLATE1 onto clutch1 of BRICK2 */
This syntax also means you can create helper assemblies in order to position more complex parts then simply DEL(ete) the helper assemblies, which after all is what you do in ldd/ldcad anyhow therefore SNOT and advanced building tequniques are possible including the ability to flex certain types of parts. So the syntax has been tried and tested and can stand up to huge and or complex models.
There are a few syntax shortcuts so far such as part/primative ranges or lists (3003 B1:B50 c1) (3005 B2 c1,c2,c3,c4,), exact part positioning co-cordinates (B2 <25,87,53>) and the IDE will also help you by having tools which leads me onto the bit where I need help from the LDRAW community: building the compiler/IDE:
The idea (assuming you are not just typing into notepad) is to have a C program read the LDL syntax and parse it into native LDRAW script but also display the digital model in real time, as you type, in a graphical output window.
This post is already kinda long so feel free to ask about the full syntax, the IDE, or the compiler, or anything else more below.
Regards, Snipe