buildinginstructions.js
buildinginstructions.js copied to clipboard
Please add support for the buffer exchange (BUFEXCH) meta command
Hi there,
The 0 BUFEXCHG
meta command originates from the MLCAD program but is also supported in a range of other LDraw programs such as LDCad, LPub3D and LeoCAD. The command can be used to "remove" parts during the building process. The typical use case is to show a certain part hovering above the model in one step, and then in it's final position in the next step. This can be tremendously useful for complex builds.
I've uploaded a model to BrickHub that makes heavy use of this command, almost in every step. You can view it here: https://brickhub.org/i/590 As you will see, the building instructions currently look like a mess, but with support buffer exchange they will be perfect!
Thanks for considering this feature request! Greetings, JJ
Hi JJ,
You are absolutely right. Buffer exchange commands should become supported, and I am currently working on a setup in one of my branches which will allow for just that.
Can you please share which software you have used to make your model? Other models with buffer exchange have been uploaded without the issue of parts showing more than once. As an example, see the Space Scooter https://brickhub.org/i/79 by Willy. The Buffer exchange section reads:
0 BUFEXCHG A STORE
0 GHOST 1 4 0 -28 0 1 0 0 0 1 0 0 0 1 3817.dat
0 GHOST 1 4 0 -28 0 1 0 0 0 1 0 0 0 1 3816.dat
0 GHOST 1 4 0 -40 0 1 0 0 0 1 0 0 0 1 3815.dat
0 GHOST 1 0 0 -39 0 1 0 0 0 1 0 0 0 1 885 - Space scooter - Hdsvl1.dat
0 GHOST 1 4 0 -96 0 1 0 0 0 1 0 0 0 1 973p90.dat
0 GHOST 1 4 -15.552 -87 0 0.985 -0.159748 -0.0581434 0.17 0.925597 0.33689 0 -0.34202 0.939693 3818.dat
0 GHOST 1 4 15.552 -87 0 0.985 0.159748 0.0581434 -0.17 0.925597 0.33689 0 -0.34202 0.939693 3819.dat
0 GHOST 1 4 -23.0709 -73.9959 -16.1152 0.985 -0.154049 0.0718343 0.17 0.892578 -0.416216 0 0.422554 0.906171 3820.dat
0 GHOST 1 4 23.0709 -73.9959 -16.1152 0.985 0.154049 -0.0718343 -0.17 0.892578 -0.416216 0 0.422554 0.906171 3820.dat
0 GHOST 1 4 0 -98 0 1 0 0 0 1 0 0 0 1 3838.dat
0 GHOST 1 0 0 -102 0 1 0 0 0 1 0 0 0 1 885 - Space scooter - Hdsvl1.dat
0 GHOST 1 14 0 -136 0 1 0 0 0 1 0 0 0 1 3626bp01.dat
0 GHOST 1 0 0 -142 0 1 0 0 0 1 0 0 0 1 885 - Space scooter - Hdsvl1.dat
0 GHOST 1 4 0 -179 0 1 0 0 0 1 0 0 0 1 3842a.dat
0 STEP
0 BUFEXCHG A RETRIEVE
Here the "0" prefix on many lines will cause software that does not support Buffer Exchange (such as buildinginstructions.js in its current state) to still work, albeit with less functions.
Best regards / Lasse
Hi,
I used LDCad to insert the 0 BUFEXCHG
commands. You can view the source here: https://raw.githubusercontent.com/rtts/lego/master/zeroturn/zeroturn.mpd
If you open the source with either LDCad or LPub3D, you should see the model rendered correctly. However, I did not use the GHOST
commands. Should I?
Gr, J
On May 23, 2020 1:29:34 PM GMT+02:00, Lasse Deleuran [email protected] wrote:
Hi JJ,
You are absolutely right. Buffer exchange commands should become supported, and I am currently working on a setup in one of my branches which will allow for just that.
Can you please share which software you have used to make your model? Other models with buffer exchange have been uploaded without the issue of parts showing more than once. As an example, see the Space Scooter https://brickhub.org/i/79 by Willy. The Buffer exchange section reads:
0 BUFEXCHG A STORE 0 GHOST 1 4 0 -28 0 1 0 0 0 1 0 0 0 1 3817.dat 0 GHOST 1 4 0 -28 0 1 0 0 0 1 0 0 0 1 3816.dat 0 GHOST 1 4 0 -40 0 1 0 0 0 1 0 0 0 1 3815.dat 0 GHOST 1 0 0 -39 0 1 0 0 0 1 0 0 0 1 885 - Space scooter - Hdsvl1.dat 0 GHOST 1 4 0 -96 0 1 0 0 0 1 0 0 0 1 973p90.dat 0 GHOST 1 4 -15.552 -87 0 0.985 -0.159748 -0.0581434 0.17 0.925597 0.33689 0 -0.34202 0.939693 3818.dat 0 GHOST 1 4 15.552 -87 0 0.985 0.159748 0.0581434 -0.17 0.925597 0.33689 0 -0.34202 0.939693 3819.dat 0 GHOST 1 4 -23.0709 -73.9959 -16.1152 0.985 -0.154049 0.0718343 0.17 0.892578 -0.416216 0 0.422554 0.906171 3820.dat 0 GHOST 1 4 23.0709 -73.9959 -16.1152 0.985 0.154049 -0.0718343 -0.17 0.892578 -0.416216 0 0.422554 0.906171 3820.dat 0 GHOST 1 4 0 -98 0 1 0 0 0 1 0 0 0 1 3838.dat 0 GHOST 1 0 0 -102 0 1 0 0 0 1 0 0 0 1 885 - Space scooter - Hdsvl1.dat 0 GHOST 1 14 0 -136 0 1 0 0 0 1 0 0 0 1 3626bp01.dat 0 GHOST 1 0 0 -142 0 1 0 0 0 1 0 0 0 1 885 - Space scooter - Hdsvl1.dat 0 GHOST 1 4 0 -179 0 1 0 0 0 1 0 0 0 1 3842a.dat 0 STEP 0 BUFEXCHG A RETRIEVE
Here the "0" prefix on many lines will cause software that does not support Buffer Exchange (such as buildinginstructions.js in its current state) to still work, albeit with less functions.
Best regards / Lasse
LDCad. Alright. I have reached out to Roland as it seemingly appears that LDCad outputs this incorrectly.
I don't know about "GHOST" - it seems unnecessary, but honestly, my main problem with implementing this part of the specification is that I can't find proper documentation for it. Hopefully Roland can share where he found the documentation when he implemented it in LDCad.
I think it should work as follows:
Upon encountering the command 0 BUFEXCHG STORE A
, the current state should be stored. Then, when encountering the command 0 BUFEXCHG RETRIEVE A
the editing buffer should be wiped, and the stored state recalled. Any other combination of these two commands is probably an error.
Gr, JJ
On May 23, 2020 2:56:07 PM GMT+02:00, Lasse Deleuran [email protected] wrote:
LDCad. Alright. I have reached out to Roland as it seemingly appears that LDCad outputs this incorrectly.
I don't know about "GHOST" - it seems unnecessary, but honestly, my main problem with implementing this part of the specification is that I can't find proper documentation for it. Hopefully Roland can share where he found the documentation when he implemented it in LDCad.
I agree. That seems to be the main use of the commands, and also what Willy describes here: http://www.holly-wood.it/mlcad/advanced2-en.html
As for "0 GHOST", it seems like it is used to ensure proper rendering in other software, and he also describes the usage as such. I just have to find out if "0 GHOST" should then be optionally ignored when within a buffer exchange block.
If the use of "0 GHOST" is optional and can be safely ignored, then I think I have all of the open questions answered for this topic. Then there will just be the big task of implementing it.
That is surely a big task! Between MLCAD, LDCad, LPub3D and others, I always encounter inconsistencies in how the BUFEXCH command is handled exactly, and the different ways it can crash the application :-D
That is unfortunate. Do you know of any particular setup that causes an application to crash? We are discussing how this should be implemented in LDCad: https://forums.ldraw.org/thread-23840-post-37443.html#pid37443
The solution in buildinginstructions.js should be able to handle all "dialects" of BUFEXCH.