Jump to content

Recommended Posts

Posted (edited)

Hi all,

I cobbled together a little command-line¹ program to convert LXF models to LDR. I put it in a gitlab repo here.

Contrarily to LDD’s own conversion process, it tries to convert decorations (though a lot are missing/different in LDraw) and flexible parts (though unflexed).

On the technical part: it’s source only², tested under Linux only but should compile and work on other OSes (needs Qt5 core, QuaZIP and yaml-cpp).

On the legal part: it’s GPLv3+.

Constructive comments are welcome. :classic:

———

¹ Yes, command-line, no GUI. Feel free to add one if you wish.  A minimal GUI was added in March, 2018.

² I won’t provide binaries. Feel free to do so for your OS (pointing to the sources as per GPLv3+).

Edited by SylvainLS
GUI comment
Posted

Nice work! :classic: :thumbup:
I'll add it to the forum index (which is probably maybe kinda outdated...)

How do you create the parts in LDraw? LSynth style, LDCad style or maybe something of your own? 

Posted

Thanks :classic:

LXF stores intermediary data as “bones.” I’m not sure yet if they are placed at the center of a rigid part (b-spline-like) or at the joints. It seems to depend on the part.

For now (not on the gitlab version (yet)), I just tried placing LDraw subparts at these points. It works great for some parts (as the one I linked, which is very simple) but not very well for others (technic flex-system hose or the tool belt 17).

So, next step is to look into how LSynth and LDCad do it and chose the easiest one, er, I mean, the one that translates best :wink:

Posted
9 hours ago, SylvainLS said:

So, next step is to look into how LSynth and LDCad do it and chose the easiest one, er, I mean, the one that translates best :wink:

If you need info on the LDCad side let me know. In short it uses bezier control points combined with 'atom' parts and spreading rules.

Posted
9 hours ago, roland said:

If you need info on the LDCad side let me know. In short it uses bezier control points combined with 'atom' parts and spreading rules.

I was wondering. LDCad saves the file with the fully generated part (e.g. a hose), so it can be viewed in other LDraw based programs. What if this lxf2ldr program would only generate the 'ldcad meta-data' such as your bezier points and such. Would LDCad then generate the full part when the file is opened?

Posted

@roland Thanks Roland, but it seems LSynth’s way would be simpler: LDD’s bones can serve as LSynth’s constraints: the curve goes through them. With Bezier, the intermediary points are outside the curve. So, unless you have a simple method to interpolate Bezier c.p. from points of/in the curve, I’ll go with LSynth :classic:

@legolijntje As I’m lazy, that’s exactly what lxf2ldr will do, but with LSynth commands. I don’t want to reimplement LSynth’s interpolation. (Depending on the part, there are more or less “bones” than there will be LDraw parts. So I’d need to interpolate parts’s positions and rotations from the bones/passage points, which is exactly what LSynth does.)

Posted
10 hours ago, legolijntje said:

I was wondering. LDCad saves the file with the fully generated part (e.g. a hose), so it can be viewed in other LDraw based programs. What if this lxf2ldr program would only generate the 'ldcad meta-data' such as your bezier points and such. Would LDCad then generate the full part when the file is opened?

If there is no "GENERATED" meta it will (re)generate the dynamic part upon opening it in LDCad, Otherwise it will only regenerate when you change something.

5 hours ago, SylvainLS said:

@roland Thanks Roland, but it seems LSynth’s way would be simpler: LDD’s bones can serve as LSynth’s constraints: the curve goes through them. With Bezier, the intermediary points are outside the curve. So, unless you have a simple method to interpolate Bezier c.p. from points of/in the curve, I’ll go with LSynth :classic:

I understand, you could probably use LSynth through an external call to generate it for you. I recommend embedding the needed LS*.dat part inside the resulting (mpd) model though.

Posted

@SylvainLS Thanks for creating this. It will be nice to be able to do this from linux instead of starting a Windows VM.

Posted

I just pushed a new version:

  • Groups are converted to submodels, centered on their first part or submodel.
  • Flexible parts are converted to LSynth commands. (It means you need to run LSynth on the generated file if you used flexible parts. (Cleaning up and removing a lot of control points before is recommended.))
  • Parse errors are now properly reported.
  • Code has been cleaned up and comments added.

A modified lsynth.mpd file is provided. It adds 3 new flexible parts: Minifig Chain Link 5L (92338), Hose Flexible 11.5L (14301), and Technic Tool Belt 17M (98567). (Latest LDraw Unofficial Library needed for 14301.)

Posted

I just pushed a few improvements:

  • Assemblies (minifig hips and legs, torsos and arms and hands…) are regrouped in submodels.
  • Update ldraw.xml

(I will only post about big modifications from now on.)

Posted
55 minutes ago, SylvainLS said:

I just pushed a few improvements:

  • Assemblies (minifig hips and legs, torsos and arms and hands…) are regrouped in submodels.

[...]

Cool! I don't use LDD myself, but there's some kind of grouping functionality right? Would it be possible to export those groups as submodels too? I can imagine that that might be useful for people.

Posted
1 minute ago, legolijntje said:

Cool! I don't use LDD myself, but there's some kind of grouping functionality right? Would it be possible to export those groups as submodels too? I can imagine that that might be useful for people.

Yep:

On 22/5/2017 at 0:52 AM, SylvainLS said:

Groups are converted to submodels

:wink:

  • 6 months later...
Posted

Reminder: The program hasn’t changed (much) for a while but the decors (colors and patterns) and parts matches (a.k.a. ldraw.xml) are updated as soon as a new part is added in LDraw Unofficial :wink:

  • 3 months later...
Posted

Big OOPS!  That’s the gitlab member URL. This is the anonymous download: 

git clone https://gitlab.com/sylvainls/lxf2ldr.git

Correcting the README right now.

  • 1 year later...
Posted

New version available!

As it appears some people loved LDD’s building instructions, I added an option to use them (when present) to make steps.

Note that there’s no submodels and LDD’s groups are lost if you use this option.

It’s here.

And remember the repository keeps an up-to-date ldraw.xml file too (so refresh your sources (git pull) when I update ldraw.xml).

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...