RE: Variables in LDraw files
2022-07-06, 21:10 (This post was last modified: 2022-07-06, 21:11 by Roland Melkert.)
2022-07-06, 21:10 (This post was last modified: 2022-07-06, 21:11 by Roland Melkert.)
(2022-07-06, 16:43)Cam's Bricks Wrote:Code:0 !VAR "height" = 24
1 16 0 "height" 0 6 0 0 0 -20 0 0 0 6 box5.dat
4 16 10 "height" 10 6 "height" 6 -6 "height" 6 -10 "height" 10
4 16 -10 "height" 10 -6 "height" 6 -6 "height" -6 -10 "height" -10
4 16 -10 "height" -10 -6 "height" -6 6 "height" -6 10 "height" -10
4 16 10 "Height" -10 6 "height" -6 6 "height" 6 10 "height" 10
1 16 0 "height" 0 10 0 0 0 -"height" 0 0 0 10 box5.dat
1 16 0 0 0 1 0 0 0 1 0 0 0 1 stud.dat
You could (should?) do this using a new meta, especially since you would need to extend existing software in order to use it anyway.
Something like:
Code:
!VAR "height" = 24
!VAR 1 16 0 "height" 0 6 0 0 0 -20 0 0 0 6 box5.dat
You Could also loose the quotes (I always hate those) by defining grammar for the variable name, for example ([a-zA-z]+[a-zA-Z0-9]*) (case insensitive if needed)