Xml2Tmx - A Utility For Aircraft Developers

  • I've recently dipped my feet into developing aircraft. (More on that project later). One thing that I just couldn't get to grips with is the huge TMD files. Scrolling around a file with tens of thousands of lines with no syntax highlighting or error checking isn't fun. I felt like I couldn't get a handle on all the different parts of the file and how they tie together.

    So, I spent a couple of evenings coding up a simple utility that can convert XML to TMD or TMC files (let's call them TMX) and also TMX to XML.

    Doing this gives a few of advantages:

    • You can edit the XML with your favour editor and get syntax highlighting
    • You'll also get real-time XML syntax checking from your editor
    • You can fold sections away with your XML editor
    • Using XML includes you can break the file into lots of smaller files, neatly arranged into a separate folders

    A picture is worth a 1000 words and all that...

    Here's my root file for the aircraft (early days, don't judge), all in XML, and it just imports other files.

    If you take a look at the left sidebar you'll see how I've broken the aircraft source up into many different files and folders.

    In my opinion this makes things so much easier to deal with.

    The aircraft code becomes a real project with a logical layout. You know where to find things without searching.

    In this screenshot there's one XML include file, this one is specific to cameras.

    I can put all the documentation I need in these individual files as they are specific to one area of the aircraft.

    When I want to compile things down to a single TMD I run.

    Code
    Xml2Tmx ConvertToTmx -input "c208.xml" -output "c208.tmd"

    If you want to convert an existing TMD to XML, to allow it to be split up you can do the opposite

    Code
    Xml2Tmx ConvertToXml -input "c208.tmd" -output "c208.xml"

    Obviously, this is very niche appeal. I wrote it for myself, but if anyone else thinks it might be of use to them, let me know, and I'll add some error checking a do a public release.

    AeroScenery - Easily create photoreal scenery for Aerofly

    Edited 3 times, last by nickhod (August 9, 2019 at 11:52 AM).

  • Thank you, we need more stuff like that.

    I want to develop aircraft, but the task is daunting, the more tools like this we get, the simpler it makes it. Every single step is great contribution.

    I wish I knew how to do such coding, a graphical UI for aircraft dev, would be so great (like when you hover over the engine, you see what it requires and the values and can input new values, etc...)

  • Maybe we need to assemble a collective like we did on the Apollo 50. Ray?

    I've got a few projects, mostly modifying an F18 into A10, SR71, Super hornet (F18E). All are military, all are twin engines.

    Any taker?

    Sounds good. Let's see if there is any interest. I am on vacation with only an iPad and phone.

  • Maybe also interesting:

    Jan published a user defined language file for Aerofly and Notepad++ a year ago.

    It also works for tmd tmc tac tad tcd tml tps tsc mcf tmr tgi.txt tme tmm tmi files.

    Then it looks like this:

    It knows a lot of keywords:

    Cheers, Thomas


    Edited 2 times, last by TomSimMuc (August 9, 2019 at 8:54 PM).

  • Maybe also interesting:

    Jan published a user defined language file for Aerofly and Notepad++ a year ago.

    That's useful in it's own right. Is it in a post here?

    What I liked about converting to and from XML is that you can use any IDE like VS Code, and I could also split it into small files using XML includes.

    AeroScenery - Easily create photoreal scenery for Aerofly

  • That's useful in it's own right. Is it in a post here?

    What I liked about converting to and from XML is that you can use any IDE like VS Code, and I could also split it into small files using XML includes.

    Since I'm coding the TMDs in Visual Studio now too I don't use Notepad++ for that any more and the keywords are outdated. I mean you could renew them with the code snippets tool that I provided https://www.aerofly-sim.de/download/downl…re/codesnippets but I sort of got used to the black on white style and my eyes just snap to the important bits inside the third pair of square brackets.


    That's why for me an xml editor style would slow things down, I'm just not used to reading xml code. But if you're used to it I see that it might speed things up for you. and that's a good thing. The only issue that I would see is: how do I add comments and how do I indent parameters in a block form, e.g. like for aerowings. Usually I do " 1.0 0.0 0.0 " for the string, with leading and trailing white space, which might look weird in xml.... but in tmd block form it works great: [ 1.0 0.0 0.0 ] looks more like my c++ code ( 1.0 0.0 0.0 ) and without that it looks too cramped and isn't easy to read [1.0 0.0 0.0 ]. This makes a difference after 8 hours of work. In Jeremy Clarkson's voice: "Whitespace gooood. No whitespace baaaad." 8o^^

    And on top of the readability... I wonder how do you "ctrl+s", "alt+tab" + reload in aerofly then? I imagine you would have to compile your xml back to tmd first and that takes a couple more clicks or key strokes I guess? Unless you hook it up to your IDE commands. And I sometimes do that 10x a minute, so even the "ctrl+s" and "alt+tab" already gets annoying.


    That Notepad++ language file also offers code folding but I didn't use it much. What I do do is have multiple instances of the same file open in Visual Studio, with vertical split and horizontal split.

    I'm not saying that it always looks like this: but it can look like this and it helps to edit multiple sections at the same time.

    ( DO NOT SHARE THIS PICTURE - also because of what I'm editing ;) ... no comment )

    And on my wide screen monitor at my work place I have much more space laterally for this kind of stuff.

    What I would like to see is an short hand version of the tmd code.

    e.g. from this:

    Down to something this: