Welcome! Log In Create A New Profile

Advanced
Re: XML to LDR
March 07, 2013 01:03PM
Hey Michael,

all predefined colors can be found in the source files, which are free available:
Quote
DataManagement.java
legoTop.setColor("11_Black",0,0,0);
legoTop.setColor("85_Dark_Bluish_Gray",73,88,101);
legoTop.setColor("86_Light_Bluish_Gray",161,171,178);
legoTop.setColor("99_Very_Light_Bluish_Gray",198,205,209);
legoTop.setColor("01_White",255,255,255);
legoTop.setColor("03_Yellow",255,214,0);
legoTop.setColor("33_Light_Yellow",255,233,143);
legoTop.setColor("69_Dark_Tan",144,144,105);
legoTop.setColor("02_Tan",214,191,145);
legoTop.setColor("88_Reddish_Brown",104,46,47);
legoTop.setColor("04_Orange",244,123,32);
legoTop.setColor("31_Medium_Orange",248,155,28);
legoTop.setColor("59_Dark_Red",247,4,55);
legoTop.setColor("05_Red",238,46,36);
legoTop.setColor("25_Salmon",246,150,124);
legoTop.setColor("26_Light_Salmon",250,188,174);
legoTop.setColor("47_Dark_Pink",205,127,181);
legoTop.setColor("23_Pink",247,179,204);
legoTop.setColor("89_Dark_Purple",70,42,135);
legoTop.setColor("24_Purple",127,63,152);
legoTop.setColor("93_Light_Purple",142,49,146);
legoTop.setColor("71_Magenta",171,29,137);
legoTop.setColor("63_Dark_Blue",0,54,96);
legoTop.setColor("07_Blue",0,87,164);
legoTop.setColor("42_Medium_Blue",94,174,224);
legoTop.setColor("62_Light_Blue",193,224,244);
legoTop.setColor("39_Dark_Turquoise",0,146,121);
legoTop.setColor("40_Light_Turquoise",0,179,176);
legoTop.setColor("41_Aqua",162,218,222);
legoTop.setColor("80_Dark_Green",0,65,37);
legoTop.setColor("06_Green",0,148,74);
legoTop.setColor("37_Medium_Green",151,211,184);
legoTop.setColor("38_Light_Green",186,225,209);
legoTop.setColor("34_Lime",181,206,47);
legoTop.setColor("76_Medium_Lime",193,216,55);
legoTop.setColor("35_Light_Lime",197,225,170);
But you can define colors yourself!

The xml-file contains the data "row by row top down and from the left to the right". The xml-file represents one huge matrix. If you only use LEGO plates 1x1 each entry (tag) in the matrix (the xml-file) would be filled. If you use bigger parts, only the upper left most matrix entry for each part is filled. All overlayed matrix entries will appear as an empty tag.

Here is a pseudo code to convert the xml-file to LDraw:
read xmlFile
foreach row in xmlFile
    x = 0 // each row starts at the left
    foreach unit in row
        if unit is not empty
            color = translateColor
            part = translateElement
            offest = calculateOffset(part) // the origin of the ldraw parts is not the upper left most stud
            write ldrFile "1 color x+offset y 0 1 0 0 0 1 0 0 0 1 part.dat"
        x += 20 // for each horizontal entry (unit) in the matrix, we have to shift right 
    y += 8 // for each vertical entry (row) in the matrix, we have to go down

You would have to translate the given color and the given element. For this you can implement some kind of dictionary. But also parts can be defined by yourself! This means: if you work with the predefined colors and elements a conversion is possible. But once there is a userdefined element, an "always working" conversion would become impossible.

Currently I have not detected any difference between the xml-files for "LEGO in top view" and "LEGO in side view". Only some entries might give a hint (e.g. LEGO plate 4x4 would not appear in side view).

Rolf
SubjectAuthorViewsPosted
XML to LDR Arthur Sigg967March 06, 2013 09:21AM
Re: XML to LDR Tim Gould353March 06, 2013 12:52PM
Re: XML to LDR Rolf Osterthun375March 06, 2013 05:49PM
Re: XML to LDR Rolf Osterthun348March 09, 2013 02:25PM
Re: XML to LDR Arthur Sigg281March 09, 2013 05:33PM
Re: XML to LDR Rolf Osterthun379March 15, 2013 07:52AM
Re: XML to LDR Michael Heidemann286March 15, 2013 01:35PM
Re: XML to LDR Rolf Osterthun251March 17, 2013 01:43PM
Re: XML to LDR Arthur Sigg283March 24, 2013 01:23PM
Re: XML to LDR Rolf Osterthun524March 25, 2013 03:11AM
Re: XML to LDR Michael Heidemann416March 07, 2013 08:04AM
Re: XML to LDR Rolf Osterthun342March 07, 2013 01:03PM
Re: XML to LDR Michael Heidemann296March 07, 2013 02:23PM
Re: XML to LDR Arthur Sigg319March 07, 2013 03:36PM
Re: XML to LDR Nina68220December 29, 2013 11:49PM



Sorry, only registered users may post in this forum.

Click here to login