SylvainLS Posted May 17, 2017 Posted May 17, 2017 (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. ——— ¹ 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 November 10, 2018 by SylvainLS GUI comment Quote
SylvainLS Posted May 17, 2017 Author Posted May 17, 2017 I have been working on flexed flexible parts: looking good so far. http://slswww.free.fr/lxf2ldr_flex.png Quote
legolijntje Posted May 18, 2017 Posted May 18, 2017 Nice work! 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? Quote
SylvainLS Posted May 18, 2017 Author Posted May 18, 2017 Thanks 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 Quote
roland Posted May 18, 2017 Posted May 18, 2017 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 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. Quote
legolijntje Posted May 19, 2017 Posted May 19, 2017 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? Quote
SylvainLS Posted May 19, 2017 Author Posted May 19, 2017 @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 @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.) Quote
roland Posted May 19, 2017 Posted May 19, 2017 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 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. Quote
dulsi Posted May 19, 2017 Posted May 19, 2017 @SylvainLS Thanks for creating this. It will be nice to be able to do this from linux instead of starting a Windows VM. Quote
SylvainLS Posted May 21, 2017 Author Posted May 21, 2017 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.) Quote
SylvainLS Posted May 23, 2017 Author Posted May 23, 2017 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.) Quote
legolijntje Posted May 23, 2017 Posted May 23, 2017 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. Quote
SylvainLS Posted May 23, 2017 Author Posted May 23, 2017 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 Quote
legolijntje Posted May 23, 2017 Posted May 23, 2017 Haha, whoops! Totally missed that one Nice work though! Quote
SylvainLS Posted December 2, 2017 Author Posted December 2, 2017 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 Quote
supertruper1988 Posted March 22, 2018 Posted March 22, 2018 Hey @SylvainLS any chance we can get a simple gui interface? Just browse to find the lxf file to convert and pick where the ldr goes? I am not to comfortable on the command line but I would like to use this for some builds I have. Quote
SylvainLS Posted March 22, 2018 Author Posted March 22, 2018 @supertruper1988 I’ll think about it. The main obstacles are: 1. I can’t build or test Mac or Windows versions, 2. I’m a CLI guy Quote
supertruper1988 Posted March 22, 2018 Posted March 22, 2018 I have access to both and wouldnt be opposed to helping out. Just a thought. Thanks for your great tool! Quote
SylvainLS Posted March 23, 2018 Author Posted March 23, 2018 I just pushed a new version with a minimal GUI. Quote
supertruper1988 Posted March 25, 2018 Posted March 25, 2018 I get an error when trying to add this with the git command on my mac. Like I said I am not a command line guy so I am not even sure what i did is right. Quote
SylvainLS Posted March 25, 2018 Author Posted March 25, 2018 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. Quote
SylvainLS Posted May 7, 2020 Author Posted May 7, 2020 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). 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.