(2022-07-06, 15:20)Max Murtazin Wrote: I'm not sure how this can be useful, any examples?
At a basic level something as simple as bricks and plates could be "automated" in this fashion.
You would have a line type that is used to define a variable. That variable can be used in the part where repetitive dimensions are used or sub-parts are called or any number of other useful calculation points.
If we look at 3005.dat Brick 1 x 1 we see that the number 24 all over the file:
Code:
1 16 0 24 0 6 0 0 0 -20 0 0 0 6 box5.dat
4 16 10 24 10 6 24 6 -6 24 6 -10 24 10
4 16 -10 24 10 -6 24 6 -6 24 -6 -10 24 -10
4 16 -10 24 -10 -6 24 -6 6 24 -6 10 24 -10
4 16 10 24 -10 6 24 -6 6 24 6 10 24 10
1 16 0 24 0 10 0 0 0 -24 0 0 0 10 box5.dat
1 16 0 0 0 1 0 0 0 1 0 0 0 1 stud.dat
Now if we look at 3024.dat Plate 1 x 1 we see it is the same exact file but with every instance of 24 replaced with 8:
Code:
1 16 0 8 0 6 0 0 0 -4 0 0 0 6 box5.dat
4 16 10 8 10 6 8 6 -6 8 6 -10 8 10
4 16 -10 8 10 -6 8 6 -6 8 -6 -10 8 -10
4 16 -10 8 -10 -6 8 -6 6 8 -6 10 8 -10
4 16 10 8 -10 6 8 -6 6 8 6 10 8 10
1 16 0 8 0 10 0 0 0 -8 0 0 0 10 box5.dat
1 16 0 0 0 1 0 0 0 1 0 0 0 1 stud.dat
If variables could be used then making both parts would be as simple as adding a line like this and changing the line to equal 8 or 24 or 48 or whatever we want without changing anything else in the file:
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
This is a simple use case and I would not expect to be able to do math in these lines except for adding "-" to make it negative as needed to meet the BFC rules. Doing math would be bad for rounding errors unless the standard defined a calculation method to be used by all editors and renders.
My more advanced use case is that I want to make train wheels of various sizes and combinations but I would like to write the file once then just change a few variables (radius, subfile call(s), etc) in each of the files without having to type it all again or copy/paste and have errors.