SylvainLS

More up-to-date ldraw.xml LDD/LDraw conversion file

Recommended Posts

Flattening an MPD isn’t rocket science: read the whole file, store each submodel, and then dump the main model, replacing each used submodel by its content, coloring it (= replacing color 16) and transforming the matrices using the one in the use-line (simple multiplication).

Here is another (dumb) example in Ruby for your collection :grin:

The flattening shouldn’t cause much problem (beside approximation errors): we have 4x4 transformation matrices that are multiplied together and we end up with 4x4 transformation matrices. If we start with (rotation+translation) matrices, we should end up with (rotation+translation) matrices (I think :tongue: : I know rotation matrices are a group, I think (rotation+translation) matrices are another one).

@roland As we can see in the examples I gave, the numbers are the same but the first matrix isn’t orthogonal and the second one is. I don’t think approximation errors are the culprit here. As an aside, there’re ways to find the nearest orthogonal/rotation matrix. That’s what Qt does in the QMatrix4x4::optimize() function.

Share this post


Link to post
Share on other sites

This is what the mirror function does (shortened) orientation (3x3) wise:

newRefMatrix = scaleOneSymAxisNeg * orgRefMatrix * scaleMirrorAxisNeg

Where scaleOneSymAxisNeg usually is the x-axis as most LDraw parts are symmetrical in the x dimension.

Afterwards it does the mirroring on the positional part separately.

I'm no matirx math expert but as far I know this shouldn't cause skewing or a negative determinants as in the end it basically only flips two axis signs'

edit: Is the original MPD available for me to test with?

Edited by roland

Share this post


Link to post
Share on other sites
1 hour ago, roland said:

I'm no matirx math expert but as far I know this shouldn't cause skewing or a negative determinants as in the end it basically only flips two axis signs'

Yes. “Flipping” an axis as a determinant of -1 (your scale-an-axis-negatively matrices are diagonal matrices with two 1 and one -1, aren’t they?). So, you do N = A x M x B, with A, B, and M orthogonal, M a rotation matrix (determinant of 1), and A and B with a determinant of -1. Hence, N is orthogonal, with a determinant of -1 x 1 x -1 = 1. IOW, N is a rotation matrix.

Too bad it isn’t (even though it’s determinant is (almost) 1) :sceptic:

Hence one of the above hypotheses is wrong: either M, A, or B, or two or all of them aren’t orthogonal (because orthogonal matrices are a group, so XxY is orthogonal iff X and Y are orthogonal), or something happened to the matrices.

We really need a simple example (that doesn’t import well in LDD) where we can clearly see which part is the mirror of which. (I wasn’t able to build one using LDCad’s mirror tool (but I’m no LDCad expert): they all import well in LDD.)

Share this post


Link to post
Share on other sites
13 minutes ago, SylvainLS said:

your scale-an-axis-negatively matrices are diagonal matrices with two 1 and one -1, aren’t they?

Yes

13 minutes ago, SylvainLS said:

We really need a simple example (that doesn’t import well in LDD) where we can clearly see which part is the mirror of which. (I wasn’t able to build one using LDCad’s mirror tool (but I’m no LDCad expert): they all import well in LDD.)

Indeed I tried some weird multiple rotation angles before mirroring and it still give identity afterwards when multiplied with its transposed self like you showed earlier in the tread.

It did notice though when you do that after a save reload from disk (3 digits) it gives 1 0 0 0 1 0 0 0 1.001 where the unsaved state did exact;y 1 0 0 0 1 0 0 0 1  (I used ldcad's own scripting env to calculate stuff). And this is a single layer 'flat' model so a mpd using sub sub sub models could cause a noticeable drift in precision quit easily imho.

Edited by roland

Share this post


Link to post
Share on other sites

The values in the LDR file have 3 digits, so ±0.001.

The example that works leads to an “identity” matrix with (1 or 0) ±0.0005.

The one that isn’t orthogonal gives (1 or 0) ±0.0005 and spurious 0.06 and 0.19. I don’t believe these 0.06 and 0.19 can be floating point errors. Especially as the entry matrices uses the same values, just with different signs:

[ [-0.304, -0.31, -0.901],
  [-0.002, -0.945, 0.325],
  [-0.953, -0.1,   0.287] ] # isn't a rotation

[ [-0.304,  0.31,  0.901],
  [ 0.002, -0.945, 0.325],
  [ 0.953,  0.1,   0.287] ] # is a rotation

 

Share this post


Link to post
Share on other sites
1 hour ago, Renderbricks said:

@SylvainLS Check PM!

legolijntje already sent us (me and Roland) the file and, as surmised, it’s a problem with the file, not with the flattening (mpd to ldr), not with ldraw.xml. There’s a 0.1 instead of a -0.1 in a matrix in the top-level model, the bricks apparently show really near where they should be but the matrix is wrong (not a rotation). I guess legolijntje will correct that soonish.

As an aside, as you want to import in Mecabricks in the end, if it’s possible, maybe you could transform the model submodel by submodel: it should greatly help you with overlapping bricks (less bricks to import, less bricks rejected by LDD, less bricks to re-add afterward).

Share this post


Link to post
Share on other sites
1 hour ago, SylvainLS said:

There’s a 0.1 instead of a -0.1 in a matrix in the top-level model, the bricks apparently show really near where they should be but the matrix is wrong (not a rotation).

It's the other way around the old one is negative, still would like to know how that happened though.

Share this post


Link to post
Share on other sites

Update 2017-08-04

Added:

  • 18835 / 18835p01.dat  Minifig Hair Mid-Length Straight with Gold Crown Pattern
  • 88323 / 88323.dat  Technic Chain Tread 38 Reinforced

md5sum: 43786195f6d977424e571767af7a0dee

Share this post


Link to post
Share on other sites

Hi,

First of all: thanks for all the work on keeping ldraw.xml up to date!

Question: can it be that I miss a simple brick like the 2x8 with the new number? 93888 (old = 3007)

Share this post


Link to post
Share on other sites

TL;DR: 93888.dat is in Unofficial ( http://www.ldraw.org/cgi-bin/ptscan.cgi?q=93888 ), it has been there for a long time.

LDD treats 3007 and 93888 as different (the latter having internal supports), whereas, in LDraw, 93888.dat is a simple alias to 3007.dat (but a long help text explaining the differences (which don’t include internal supports)). So using 93888.dat isn’t necessary and could even be a problem but, as many parts are already only available in Unofficial, in those cases I prefer to use the correct DesignID.

 

Share this post


Link to post
Share on other sites

Ah, I see. The LDraw format has no secrets to me, but I thought 93888 would long be official. I didn't bother to check. Sorry ;-)

I'll just replace 93888 by 3007 in the LDraw file.

Thanks!

Share this post


Link to post
Share on other sites

Update 2017-08-17

Added:

  • 18455 / 18455.dat  Hinge Brick  2 x  4 Locking with  1 Finger on Top at One End
  • 92903 / 92903.dat  Arch  1 x  3 x  2 with Curved Top

md5sum: 4cfd013b4632e8c0c411f7e30eb8df86

Edited by SylvainLS
oops, wrong file…

Share this post


Link to post
Share on other sites

Update 2017-09-07

Removed unnecessary half-turns and a few minor corrections:

  • Arch  1 x  8 x  6  30528.dat
  • Bar  1 x  8 x  3  2583.dat
  • Bar  6L with Thick Stop  63965.dat
  • Bar Tube with Clip  11090.dat
  • Brick  2 x  2 Round Sloped  98100.dat
  • Brick  2 x  2 Round with Grille  92947.dat
  • Brick  2 x  2 x  2 Round with Fins  4591.dat
  • Brick  2 x  4 with Curved Top  6192.dat
  • Brick  2 x  4 x  2 with 3 Understuds with Axlehole at Left and Right Side  6061.dat
  • Brick  4 x 10 with Wheel Holders  30076.dat
  • Brick 12 x 12 with  3 Pin Holes on Sides & Axle Holes in Corners  52040.dat
  • =Bucket  2 x  2  70973.dat
  • Car Wash Brush  2498.dat
  • Cone  2 x  2 x  1.667 Octagonal  6039.dat
  • Container  2 x  2 x  2 Crate  61780.dat
  • Cylinder Domed  1 x  1 x  1.667 with Bar  58176.dat
  • Dish 10 x 10 Inverted with Hollow Studs  50990a.dat
  • Door  1 x  4 x  6 Frame Type 1  30179.dat
  • Door  1 x  4 x  6 Lattice  92589.dat
  • Glass for Window  1 x  2 x  2 without Sill  60601.dat
  • Glass for Window  1 x  2 x  3  60602.dat
  • =Glass for Window  1 x  4 x  3 Opening  60603.dat
  • Glass for Window  1 x  4 x  6  57895.dat
  • =Glass for Window  1 x  4 x  6  60803.dat
  • Gold Ingot  96910.dat
  • Hemisphere  4 x  4 Multifaceted  30208.dat
  • Jet Engine Fan with 10 Blades and Technic Pin  46667.dat
  • Minifig Chain 17L (Complete)  30104.dat
  • Minifig Feathers with Pin  30126.dat
  • Minifig Lightsaber Hilt with Bottom Ring  577b.dat
  • Minifig Lightsaber Hilt without Bottom Ring  577a.dat
  • Minifig Microphone  90370.dat
  • Minifig Plunger  11459.dat
  • Minifig Roller Skate  11253.dat
  • Minifig Skateboard with Four Wheel Clips  42511.dat
  • Minifig Skateboard with Two Wheel Clips  45917.dat
  • Minifig Sledgehammer  75904.dat
  • Minifig Syringe  87989.dat
  • Minifig Sword Double Blade Serrated with Bar Holder  13549.dat
  • Minifig Telescope  64644.dat
  • Minifig Tool Magnifying Glass  30152c01.dat
  • Minifig Tool Screwdriver  55298.dat
  • Minifig Tool Screwdriver with Wide Head and 3-Rib Handle  604550.dat
  • Minifig Wine Glass  33061.dat
  • Plant Bush Base  6065.dat
  • Plate  1 x  1 Round with Open Stud  85861.dat
  • Plate  1 x  2 with Exhaust Ports  61072.dat
  • Plate  1 x  4 with Two Studs  92593.dat
  • Plate  1 x 12  60479.dat
  • Plate  2 x  2 Round with Hole and 4 Vertical Bars  98284.dat
  • Plate  2 x  2 with Groove with 1 Center Stud  87580.dat
  • Plate  2 x  2 with Rod Frame Octagonal  30033.dat
  • Plate  2 x  2 with Rod Frame Octagonal Reinforced  75937.dat
  • Plate  2 x  2 with Wishbone Suspension Arms and Pins  47720.dat
  • Plate  2 x 14  91988.dat
  • Plate  4 x  4 Round with  2 x  2 Round Hole  11833.dat
  • Plate  6 x  6 Round with Hole and Snapstud  11213.dat
  • Plate  6 x 24  3026.dat
  • Plate  8 x 16  92438.dat
  • Plate 10 x 10 Octagonal with Hole and Snapstud  89523.dat
  • Propellor  1 Blade 14L with Two Pin Holes and Four Axles  89509.dat
  • Slope Brick 45  4 x  4 Double Inverted with Open Centre  4854.dat
  • Slope Brick 45  4 x  4 Double Inverted with Open Centre and 2 Holes  72454.dat
  • Slope Brick 45  6 x  2 Double Inverted with Open Centre  22889.dat
  • Slope Brick 45  6 x  4 Double  32083.dat
  • Slope Brick 45  6 x  4 Double Inverted  30183.dat
  • Slope Brick 45  6 x  4 Double Inverted with Centre Holes  60219.dat
  • Slope Brick Curved  2 x  8 x  2 Double  11290.dat
  • Slope Brick Curved  6 x  8 x  2 Double  45411.dat
  • Slope Brick Curved  6 x  8 x  2 Inverted Double  45410.dat
  • Support  2 x 16 x  2 Girder Triangular  30518.dat
  • Support  4 x  4 x  5 Stanchion  2680.dat
  • Technic Axle Connector  2 x  3 Quadruple  11272.dat
  • Technic Brick  5 x  3 x  1 with  8 Pegholes and  2 Studs  32333.dat
  • Technic Connector Circular with  2 Pin Holes and  3 Axle Holes  98585.dat
  • Technic Cross Block  2 x  4 (Axle/Pin/Pin/Twin Pin)  98989.dat
  • Technic Cross Block 3 x 2 (Axle/Triple Pin)  63869.dat
  • Technic Engine Crankshaft Centre  2854.dat
  • Technic Engine Piston Round  2851.dat
  • Technic Gear 16 Tooth Reinforced  94925.dat
  • Technic Gear 20 Tooth Double Bevel  32269.dat
  • Technic Panel  3 x 11  15458.dat
  • Technic Panel  5 x 11  64782.dat
  • Technic Tile  1 x  2 with Two Holes  32530.dat
  • Technic Engine Cylinder Head with Side Slots  2850a.dat
  • Tile  1 x  3 with Groove  63864.dat
  • Tile  2 x  2 Inverted with Groove  11203.dat
  • Tile  2 x  2 Roadsign Base  30256.dat
  • Tile  2 x  2 Round with Round Underside Stud  14769.dat
  • Tile  2 x  2 Round with Technic Half Beam  74698.dat
  • Tile  2 x  4 with Groove  87079.dat
  • Tile  3 x  4 with Four Studs  88646.dat
  • Tile  6 x  6 with Groove and Underside Studs  10202.dat
  • Tile  6 x  6 with Underside Details  6881b.dat
  • Tile  8 x 16 Type 2  90498.dat
  • Tyre  7/ 45x 17 Offset Tread with Middle Band  61254.dat
  • Tyre 11/ 65 x 18 Offset  56897.dat
  • Tyre 14/ 54 x 15 VR  58090.dat
  • Wheel 81.6 x 15 Motorcycle  2903.dat
  • Wheel Rim 20 x 30 with 3 Pegholes  44292.dat
  • Technic Turntable Type 1 Bottom  2856.dat
  • ~Turntable  4 x  4 x  0.667 Locking Top  30658.dat
  • Winch  2 x  4 x  2 Body  3750c01.dat

md5sum: 46251f5429ab081720e77d62820121d0

Share this post


Link to post
Share on other sites

Update 2017-09-19

Added:

  • 88286 / 88286.dat  Minifig Hair Female Ponytail with Long French Braid

Rematched & Corrected:

  • 30104 / 30104.dat  Minifig Chain 17L
  • 60169 / 60169.dat  Minifig Chain 16L
  • 92338 / 92338.dat  Minifig Chain  6L

Notes:

  • 30104 is not flexible in LDD and it’s too short (should be 17+L, it’s 16L in LDD). Don’t use it.
  • 60169 and 92338 are flexible in LDD, so LDD doesn’t export them. You should use other tools, like lxf2ldr :wink: which exports them as LSynth macros. Note that the LDraw versions are a tiny bit longer than 16L and 6L whereas LDD’s are exactly 16L and 6L.

md5sum: 9c9243dd296eda1c18dc58c4c26ed462

Update 2017-09-19b

Rematched:

  • 92338 / 92338c01.dat  Minifig Chain  6L (This one is exactly 6L.)

md5sum: 31659ef89cf5ca1ca4aec826c5509d9e

Share this post


Link to post
Share on other sites

Update 2017-10-09

Added:

  • 15625 / 15625.dat  Slope Brick Curved  5 x  8 x  0.667

Rematched:

  • 30292 / 30292a.dat  Flag  8 x  3 with Rod with Reinforced Base

Corrected:

  • 2447 / 2447.dat  Minifig Helmet Visor
  • 2594 / 2594.dat  Minifig Helmet Visor Castle
  • 6119 / 6119.dat  Minifig Helmet Visor Ice Planet
  • 23318 / 769.dat  Minifig Helmet Visor Space

md5sum: 5c6d82a5d10260321be05642a7302612

Share this post


Link to post
Share on other sites

Update 2017-10-12

Corrected:

  • 2434 / 2434.dat  Brick  2 x  4 x  2 with Studs on Sides
  • 2498 / 2498.dat  Car Wash Brush
  • 2550 / 2550.dat  Animal Monkey Body (Needs Work)
  • 2586 / 2586.dat  Minifig Shield Ovoid
  • 3729 / 3729.dat  =Plate  2 x  2 with Towball
  • 4218 / 4218b.dat  Roller Door Normal
  • 4219 / 4219b.dat  Roller Door with Handle
  • 4496 / 4496.dat  Minifig Pitchfork
  • 6076 / 476.dat  Bar 12L with Hollow Studs, Towball, and Slit
  • 6265 / 6265.dat  Minifig Skeleton Arm
  • 10049 / 10049.dat  Minifig Shield Broad with Spiked Bottom and Cutout Corner
  • 11289 / 11289.dat  Windscreen  4 x  4 x  4.667 Canopy with Handle
  • 15530 / 15530.dat  Minifig Hat Police
  • 33078 / 33078.dat  Minifig Food Sausage
  • 33172 / 33172.dat  Minifig Food Carrot
  • 44032 / 44032.dat  Technic Bionicle Weapon Ice Blade
  • 44571 / 44571.dat  Slope Brick 45  4 x  4 Double with Locking Hinge
  • 45406 / 45406c01.dat  Windscreen  4 x  6 x  4 Cab with Hinge and Trans Black Glass
  • 50956 / 50956.dat  Wedge 10 x  3 x  1 Double Rounded Right
  • 54872 / 54872.dat  Minifig Head SpongeBob
  • 62808 / 62808.dat  Minifig Key
  • 64805 / 64805.dat  Minifig Head Ewok
  • 75902 / 75902.dat  Minifig Shield Round Bowed
  • 75904 / 75904.dat  Minifig Sledgehammer
  • 92694 / 92693c01.dat  Technic Linear Actuator Small Body Assembly
  • 92743 / 92743.dat  Minifig Head Gungan With Flat Eyes
  • 92747 / 92747.dat  Minifig Shield Oval
  • 93251 / 93251.dat  Minifig Shield Scarab
  • 98102 / 98102.dat  Windscreen  8 x  6 x  2.333 Bubble Canopy with Handle Bar

md5sum: 07e51f65ed2c38289a80dcd71da89c06

 

Share this post


Link to post
Share on other sites

Update 2017-11-03

Added:

  • 11092 / 11092.dat  Minifig Hand Gorilla Fist
  • 11438 / 11438.dat  Minifig Armor Shoulder Pads with Ridges
  • 15086 / 15086.dat  Minifig Armor Shoulder Pads with Neck Protection, 1 Stud on Front, 2 Studs on Back
  • 24088 / 24088.dat  Minifig Helmet with Wings and Eagle Head
  • 24946 / 24946.dat  Egg  1.2 x  1.2 x  1.333 with Hole on Top
  • 98366 / 98366.dat  Minifig Helmet Roman Soldier

Rematched:

  • 75347 / 75347.dat  =Support  2 x  2 x 11 Solid Pillar

md5sum: ce831081da12b5e56686878e44b8b0d0

 

Share this post


Link to post
Share on other sites

Update 2017-11-18

Added:

  • 18897 / 18897.dat  Brick  6 x  6 Round with Holes
  • 18909 / 18909.dat  Panel Cone  3 x  6 x  6 Elliptic Parabolic

Rematched:

  • 2714 / 2714a.dat  Bar  8L with Stop Ring and Pin - Rounded End

md5sum: 0e0c72f38eba19c62594aa1b0dc0870f

Share this post


Link to post
Share on other sites

Update 2017-11-25

Added:

  • 23421 / 23421.dat  Pole 32 with Shaft and Helical Groove
  • 23422 / 23422.dat  Handle for Pole 32 with Shaft and Helical Groove

Rematched:

  • 30152 / 30152p01.dat  Minifig Tool Magnifying Glass with Transparent Lens

md5sum: 8e73494eabf6a23d4bc669c754fef096

Share this post


Link to post
Share on other sites

Update 2017-12-02

Corrected (revised LDraw file):

  • 47846 / 47846.dat  Cockpit  4 x 10 x  2 Curved

Added:

  • 10314 / 10314.dat  Brick  1 x  4 x  1.333 with Curved Top without Understuds
  • 18587 / 18587.dat  Six Shooter Trigger
  • 18588 / 18588.dat  Six Shooter Housing
  • 72475 / 72475.dat  Windscreen  3 x  4 x  4 Inverted with Rounded Top Corners, Cutout Bottom Corners

md5sum: 3af9191848c18307a14b57f02adf932a

Share this post


Link to post
Share on other sites

Update 2017-12-07

Corrected:

  • 2554 / 2554.dat  Door  1 x  3 x  6 with 1/4 Circle Top

Added:

  • 20179 / 20398c01.dat  Minifig Cup Take Out with Dome Lid
  • 92713 / 92713.dat  Belt for Conveyor Belt
  • 92715 / 92715.dat  Brick 4 x 16 with Holes for Conveyor Belt
  • 92716 / 92716.dat  Roll 4M for Conveyor Belt

md5sum: 31d861b04941d373756426c98d9141f7

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.