(2020-05-23, 18:11)Roland Melkert Wrote: I'm not sure I understand the problem, do you mean you expected the "0 " prefixes on the ghost lines to be added automatically ?
If so that's not part of the bufxchg spec.
0 GHOST is a different mlcad meta, which it uses to draw parts transparently I believe.
It is just added as a prefix to lines which the user wants 'ghosted'.
I used MLCad's documentation to implement bufxchg
http://mlcad.lm-software.com/e_default.htm
It is basically a stack command, meaning you store the whole LDraw content at the STORE point and trow away the current content upon a RETRIEVE.
I did implement it as a hide flag in LDCad as I don't want to literately delete stuff
The main trick is to loop backwards trough the LDraw lines when processing the commands, that way nested ones are automatically handled correctly.
That explains the issue. The two commands go hand-in-hand to ensure compatibility with other LDraw software, such as LDView.
In the documentation you link to, the section with GHOST says (highlight mine):
Quote:Ghost commands are a special form of other commands. Any MLCad or Ldraw command can be a ghost command. To make a command to a ghost command simply put “0 GHOST” at the beginning of the line.
So what’s the deal with this type of command?
MLCad displays ghost commands only if the model containing the command is the main model. If the model is a sub-model of another or simply a part included into a model the ghost lines are simply ignored. They are useful in connection with the buffer exchange command and allow to show detailed assembly instructions of a part when it’s viewed by its own, but if it’s included as a part these steps will not be shown.
Without this ghost command you would see things between buffer exchange commands uncontrolled since buffer exchange commands are also ignored in sub-models.
And this is the issue with their models. LDCad outputs the stuff between SAVE and RETRIEVE without any modification, so other viewers will simply also render all the stuff in those sections.