SylvainLS Posted September 12, 2016 Posted September 12, 2016 Hi all, TD;LR: Does anyone know how the Assembly tag is supposed to work or have a link to some clues? Long version: I’m cleaning and completing the ldraw.xml file. I’m stuck with “Assemblies.” LDD parts that are composites are exported subpart by subpart. Easy peasy. But, in order to import them, recombining the subparts in the LDD assemblies, an Assembly tag is needed. Existing tags looks like that: <Assembly ldraw="ldraw-idc01.dat" lego="lego-id" tx="0" ty="0" tz="0> <Part ldraw="subpart-ldraw-id.dat" color="0" m0="0" m1="0" m2="0" m3="1" m4="0" m5="0" m6="0" m7="1" m8="0" m9="0" m10="0" m11="1" /> … </Assembly> sometimes with different values for the matrix. AFAICT, the minimum working tag looks like that: <Assembly ldraw="whatever" lego="lego-assembly-id"> <Part ldraw="subpart-ldraw-id.dat" /> … </Assembly> That is, the matrix and color attributes of the Part tags and the translation vector for the Assembly tag are useless. The name of the LDraw assembly is necessary but can be whatever. I first thought importing assemblies worked but, actually, it only works with the LDR that was exported by LDD. Just resaving it usually truncates some values and boom, can’t be imported anymore. Also, hints are given in comments that LDraw complete parts (such as MF hips and legs in one part) are exported/imported as is. That’s not true. Maybe it was true before: unflexed flexible parts were exported/imported in 4.3.8, they are not anymore in 4.3.9. So, if anyone has any clue… Thanks. Quote
djm Posted September 15, 2016 Posted September 15, 2016 Following your post, I had a bit of a fiddle to see if I could work out anything about the meaning of the Assembly tag. I successfully imported an mpd file built using LDCAD, so I don't think there is a constraint of the original model having to have been generated by LDD. Having said that, my test file builds were very simple. My findings to date; I suspect that there must be some kind of mapping reference data internal to LDD in which it knows which LDraw parts form the corresponding LDD assembly. The parts in the LDraw file were not on consecutive lines but it seemed to be able to correctly pick the parts which formed the assembly. If you have fewer parts in the LDraw file than that identified by the Assembly tag, LDD would display an error message and not import the assembly. I think you can't add additional parts to an assembly definition in the ldraw.xml. I tried adding an extra plate in the definition for the EV3 motor but on import into LDD I'd get an error message and the assembly would not import I don't think this especially adds to your knowledge but if I do gleen anything else which I think might be significant, I'll let you know. Regards, David Quote
SylvainLS Posted September 15, 2016 Author Posted September 15, 2016 Following your post, I had a bit of a fiddle to see if I could work out anything about the meaning of the Assembly tag. I successfully imported an mpd file MPD, not LDR? LDD can’t manage non-flat models. built using LDCAD, so I don't think there is a constraint of the original model having to have been generated by LDD. Having said that, my test file builds were very simple. After reading that and a PM from Philo, I tried with LDCad and, lo and behold! It works way better than LeoCAD. But, still, the difference is just that LeoCAD truncates numbers at 6 decimals, LDD and LDCad at 14-16. It’s strange as there’s a way larger tolerance for connections in LDD (almost 0.2mm, 0.5LDU). My findings to date; I suspect that there must be some kind of mapping reference data internal to LDD in which it knows which LDraw parts form the corresponding LDD assembly. The parts in the LDraw file were not on consecutive lines but it seemed to be able to correctly pick the parts which formed the assembly. Yes, and you can see them if you add the full tips (developper mode I think). An assembly is just a bunch of parts, a shortcut. Each part is treated as a primitive/simple element: and is exported separately. The Assembly tag is only needed for import and tells LDD what LDraw parts form the assembly and, maybe, what positions they must have relative to each other. When LDD can’t import an assembly (e.g. 2029+2030 hinge plates), in its error log, it says things like “Can’t find part 2030. Can’t find part 2029.” I surmise it’s because it found one part of the pair and couldn’t find the other part near enough. If you have fewer parts in the LDraw file than that identified by the Assembly tag, LDD would display an error message and not import the assembly. Yes, having fewer parts is possible for export, not import. Else we could import assemblies’ subparts separately (would have been handy when the 2x2 turntable was an assembly). I think you can't add additional parts to an assembly definition in the ldraw.xml. I tried adding an extra plate in the definition for the EV3 motor but on import into LDD I'd get an error message and the assembly would not import No, because subparts are exported one by one, and, for import, there’s no plate to add to the motor assembly. I don't think this especially adds to your knowledge but if I do gleen anything else which I think might be significant, I'll let you know. We’re progressing: I’ll now use LDCad for my tests on assemblies. Quote
djm Posted September 15, 2016 Posted September 15, 2016 MPD, not LDR? LDD can’t manage non-flat models. Yes, sorry LDR not MPD. I had nested the sub-file but it still had an LDR file extension. In the LDR file I have: 0 FILE main.ldr 1 4 -35 133 242 1 0 0 0 1 0 0 0 1 99550c01.dat 1 15 -35 133 242 1 0 0 0 1 0 0 0 1 99617c01.dat 1 16 -91 0 252 1 0 0 0 1 0 0 0 1 subModel-1.ldr 0 FILE subModel-1.ldr 1 0 0 0 0 -1 0 0 0 0.574 0.819 0 0.819 -0.574 3829b.dat 1 14 0.001 26.99 0.806 -1 0 0 0 1 0 0 0 -1 3829a.dat FYI, while fiddling some more with the assembly tag, I found the EV3 beacon is not in ldraw.xml. I have added the details to the appropriate thread. Regards, David Quote
SylvainLS Posted September 15, 2016 Author Posted September 15, 2016 Yes, sorry LDR not MPD. I had nested the sub-file but it still had an LDR file extension. In the LDR file I have: I meant that when I tried importing multi-models files (MPD, whatever the extension is), LDD just treated it as a flat file: the submodels parts are placed, once, without transformation. FYI, while fiddling some more with the assembly tag, I found the EV3 beacon is not in ldraw.xml. I have added the details to the appropriate thread. Er, I should add a note: I went through all the available parts and corrected the ldraw.xml accordingly. I also cleaned it up. Importing assemblies is the last step. I hadn’t made it available yet as I’m in the process of adding new LDraw (unofficial) shortcuts for some assemblies. Quote
SylvainLS Posted September 15, 2016 Author Posted September 15, 2016 (edited) If someone wants to play with assemblies, here are two: <!-- Animal Cow Body 64779c01.dat --> <!-- RIGHT COW 64778 --> <Brick ldraw="64779c01.dat" lego="64778" /> <Transformation ldraw="64779c01.dat" tx="-0.4" ty="-1.92" tz="-1.6" ax="0" ay="1" az="0" angle="-1.570796" /> <!-- Animal Cow Head 64835c01.dat --> <!-- RIGHT COW HEAD 64780 --> <Brick ldraw="64835c01.dat" lego="64780" /> <Transformation ldraw="64835c01.dat" tx="0" ty="0" tz="0" ax="0" ay="1" az="0" angle="-1.570796" /> <!-- Animal Cow 64452.dat --> <!-- COW ASSEMBLED 64452 --> <Assembly ldraw="64452.dat" lego="64452" > <Part ldraw="64779c01.dat" m0="0" m1="0" m2="0" m3="1" m4="0" m5="0" m6="0" m7="1" m8="0" m9="0" m10="0" m11="1" /> <Part ldraw="64335c01.dat" m0="3.078" m1="2.33" m2="-0.4" m3="1" m4="0" m5="0" m6="0" m7="1" m8="0" m9="0" m10="0" m11="1" /> </Assembly> <!-- Animal Horse Poseable Head 10350c01.dat --> <!-- ANIMAL NO.11 HEAD 10350 --> <Brick ldraw="10350c01.dat" lego="10350" /> <Transformation ldraw="10350c01.dat" tx="0" ty="0" tz="0" ax="0" ay="1" az="0" angle="-1.570796" /> <!-- Animal Horse Poseable Body 10352c01.dat --> <!-- ANIMAL NO.11 BODY LEFT 10352 --> <Brick ldraw="10352c01.dat" lego="10352" /> <Transformation ldraw="10352c01.dat" tx="-0.4" ty="-2.82" tz="2.68" ax="0" ay="1" az="0" angle="1.570796" /> <!-- Animal Horse Poseable Rear Legs 10354c01.dat --> <!-- ANIMAL NO.11 LEG LEFT 10354 --> <Brick ldraw="10354c01.dat" lego="10354" /> <Transformation ldraw="10354c01.dat" tx="0.4" ty="-2.82" tz="-0.52" ax="0" ay="1" az="0" angle="1.570796" /> <!-- Animal Horse Poseable 10509.dat --> <!-- ANIMAL NO.11 megablocks. 10509 --> <Assembly ldraw="10509.dat" lego="10509" > <Part ldraw="10350c01.dat" m0="-0.31" m1="3.075" m2="0.4" m3="-1" m4="0" m5="0" m6="0" m7="1" m8="0" m9="0" m10="0" m11="-1" /> <Part ldraw="10352c01.dat" m0="0" m1="0" m2="0" m3="1" m4="0" m5="0" m6="0" m7="1" m8="0" m9="0" m10="0" m11="1" /> <Part ldraw="10354c01.dat" m0="3.2" m1="0" m2="0.8" m3="1" m4="0" m5="0" m6="0" m7="1" m8="0" m9="0" m10="0" m11="1" /> </Assembly> The Animal Horse Poseable is importable, in any correct pose (that is, you can rotate the legs, the head, the body, provided it stays attached). It works even with one part slightly misplaced, e.g. the head turned 1° on another axis than the hinge axis. The Animal Cow isn’s importable. Even if you import the exact file that is exported. You can play with the matrices, AFAICT, they are useless (it works the same without). I’m beginning to think that the non-working parts are 4.3.9/2075 parts and assembly import has been dumbed down in 4.3.9/2075, the same way Flexible parts aren’t exported/imported anymore (they worked in 4.3.8). Edit: the cow isn’t new in 2075…. Edited September 15, 2016 by SylvainLS Quote
SylvainLS Posted September 15, 2016 Author Posted September 15, 2016 Okay, one strange thing: if I replace the.dat of the cow in ldraw.xml and the .ldr, it imports: <!-- Animal Cow Body 64779c01.dat --> <!-- RIGHT COW 64778 --> <!-- Brick ldraw="64779c01.dat" lego="64778" /> <Transformation ldraw="64779c01.dat" tx="-0.4" ty="-1.92" tz="-1.6" ax="0" ay="1" az="0" angle="-1.570796" / --> <Transformation ldraw="64778.dat" tx="-0.4" ty="-1.92" tz="-1.6" ax="0" ay="1" az="0" angle="-1.570796" /> <!-- Animal Cow Head 64835c01.dat --> <!-- RIGHT COW HEAD 64780 --> <!-- Brick ldraw="64835c01.dat" lego="64780" /> <Transformation ldraw="64835c01.dat" tx="0" ty="0" tz="0" ax="0" ay="1" az="0" angle="-1.570796" / --> <Transformation ldraw="64780.dat" tx="0" ty="0" tz="0" ax="0" ay="1" az="0" angle="-1.570796" /> <!-- Animal Cow 64452.dat --> <!-- COW ASSEMBLED 64452 --> <Assembly ldraw="64452.dat" lego="64452" > <Part ldraw="64778.dat" m0="0" m1="0" m2="0" m3="1" m4="0" m5="0" m6="0" m7="1" m8="0" m9="0" m10="0" m11="1" /> <Part ldraw="64780.dat" m0="3.078" m1="2.33" m2="-0.4" m3="1" m4="0" m5="0" m6="0" m7="1" m8="0" m9="0" m10="0" m11="1" /> </Assembly> I don’t understand why. Other working assembling have XXXc01 LDraw parts. The Poseable Horse above has the LEGO ID + c01.dat but others work and have random IDs before the c01…. Where is that Voynich manuscript? I think it’ll be easier to decipher than that. Quote
SylvainLS Posted September 15, 2016 Author Posted September 15, 2016 (edited) Okay, I’m a blind idiot. The cow assembly had 64335c01.dat instead of 64835c01.dat. Guh. Afetr hvanig croretced teh tpyos, all* assemblies are imported! Well, except if your LDraw editor truncates too much…. * but one: “Torso with hook left.” Working on it…. Edit: just another typo. Becoming old Edited September 15, 2016 by SylvainLS Quote
djm Posted September 15, 2016 Posted September 15, 2016 Okay, I’m a blind idiot. The cow assembly had 64335c01.dat instead of 64835c01.dat. Guh. I'm glad you spotted it because my head was hurting too. Amusingly, using the second definition (i.e. without the c01 suffix), I could take half a cow defined in LDraw and it would be imported into LDD as a whole cow! David Quote
SylvainLS Posted September 15, 2016 Author Posted September 15, 2016 Amusingly, using the second definition (i.e. without the c01 suffix), I could take half a cow defined in LDraw and it would be imported into LDD as a whole cow! Yeah Actually, you can put anything as an LDraw ID. Here, I used the same ID as LDD and LDD uses sub-sub-parts numbers (half cow body) as the ID for the sub-part (cow body). Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.