Recommended Posts

Scenario: You are in the situation in which you miss some LEGO parts in Studio but have seen them in LDRAW (unofficial) library.

Maybe you tried to resolve all the references to all sub-assembly-files once by hand or had a look at the dependencies with some other tools - as I am working in IT and love to automate things and thought "I can't be bothered with doing this manually".

And as I want to contribute something back to the lovely community of people I put it online in May 2022 and gave it some little updates inbetween:

The LDraw to Studio Exporter (https://www.reum.it/ldraw-to-studio-exporter/)

Description

This tool is designed to import parts which are available in LDraw, but not in Studio. From the LDraw part number, it zips all relevant sub elements (there can be many!) into a part pack.

Howto

  1. Visit the LDraw Parts Lookup
  2. Search for your part of choice & copy the number
  3. Enter this number into the below searchfield
  4. A list of all fitting parts from the catalogue will show up - clicking the entries will create a zip package with just the needed parts
  5. To use the packs, unzip them and place their contents in your "C:\Users\{your username}\AppData\Local\Stud.io\CustomParts" (Windows)
  6. The parts will then be available in Custom Parts palette of Studio

Screenshots

Entry-Page

ldraw-to-studio-exporter_mobile.png

Example result for query "47373"

ldraw-to-studio-exporter_mobile-search-r

 

Details of the zipfile structure of an example part

Here is an example of the structure and the needed subparts for one Shock Absorber ("47373-f1"):

Spoiler

C:\Users\User\Downloads\47373-f1
│   CAlicense.txt
│   CAreadme.txt
│   Readme.txt
└───CustomParts
    ├───p
    │       1-16cyli.dat
    │       1-16edge.dat
    │       1-4chrd.dat
    │       1-4cyli.dat
    │       1-4edge.dat
    │       1-8chrd.dat
    │       1-8cyli.dat
    │       1-8cyls2.dat
    │       1-8edge.dat
    │       1-8ndis.dat
    │       1-8rin10.dat
    │       1-8ring9.dat
    │       3-8edge.dat
    │       4-4con3.dat
    │       4-4con8.dat
    │       4-4cylc.dat
    │       4-4cyli.dat
    │       4-4disc.dat
    │       4-4edge.dat
    │       4-4rin10.dat
    │       4-4ring2.dat
    │       4-4ring3.dat
    │       4-4ring4.dat
    │       4-4ring8.dat
    │       4-4ring9.dat
    │       7-8cyli.dat
    │       7-8edge.dat
    │       peghole.dat
    │       t04o2500.dat
    │
    └───parts
            47373-f1.dat
            48912.dat
            48913.dat
            48914.dat
            48915.dat
            48917.dat
            48918.dat
            u9013.dat

Some example results as direct links of parts missing in Studio:

 

Updates

January 2023:

  • Fix: Nightly refresh of LDraw unofficial files working now, it was buggy before and stuck on the releases from ~August 2022 version
  • Feature: Unofficial files may be downloaded via a new checkbox. Searches are exclusive here, so having the checkbox set means it only goes through the unofficial list (but may grab sub assemblies from the official, where needed)
  • UI: Added Dark Mode awareness
  • UI: Added Font-Awesome Icons for downloads
  • UI: Some tweaks (all professional webdesigners: hush hush, nothing to see here... don't look at my nasty css quirks :P)

May 2023:

  • Fix: Textures are now included (they werent before..)

 

 

Edited by aFrInaTi0n
Updated information

Share this post


Link to post
Share on other sites

Wow!!!

Thanks a million for that tool!!!

I am using MLCad for building and thus the LDraw library. I like to use Stud.io for rendering ... and now this will be one genuinely nice workflow.

Nice.

All the best,
Thorsten 

Share this post


Link to post
Share on other sites

@freakwave Its just ~150 lins of dirty php code.

Its more or less just 1 recursive function, walking down the references to subparts of the main part and adding them into a zip-stream, which is send to the browser.

I will have to check if there are any legal reasons denying that - I will check out if I can add the unofficial parts on the weekend.

Share this post


Link to post
Share on other sites

Hey @freakwave, first of all, sorry for one week without an update! Finally had some minutes to take a initial look :D
Legal reasons shouldn't be any concern for the unofficial parts, as far as I get it.

Only problem I see is, the unofficial lib is updated very frequent and it would need some scheduled job for my script / server to have the library files refreshed with a more recent version - technically its no huge thing, just needs some brainjuice (I would also use this to automatically update the official one, because it was just placed manually there for the first approach)..

Open Questions: 

  • Would a checkbox for "include LDraw unofficial" for the search be enough for your needs?
  • Do you know if the unofficial contains parts which are already in the official? If so, this could create multiple result.
    • Could be solved by also prefixing the source [official|unofficial] at the search-results links

I hope I can give some feedback on this sunday already, regards.

Edit: updated official parts with the latest files (2022-03, released on 2022-05-07)

Edit 2: The unofficial LDraw Lib contains also other parts (textures etc) -> need to extend my script to be able to include them too.

 

Edited by aFrInaTi0n

Share this post


Link to post
Share on other sites

This does not really need its own thread so I decided that this thread would be best to post it in, but you can also import .io models directly LDCAD by opening the  io file in WINRAR, and extracting model.ldr. For a while I thought that the password was just garbage data being treat as a password because it happned to be in the same section of the file that WINRAR uses to check if the archive has a password, and what it is (in encrypted form) but turns out I was wrong, the password is actually just soho0909. I found the password from this souce after extensive googling: https://www.mecabricks.com/en/forum/topic/853

Share this post


Link to post
Share on other sites

@SNIPE Not really gitting it, your topic is for imports from Studio to LDCad - my thread is about importing parts from LDraw into Studio...

All good if you think it fits best here, but maybe I didn't got your point correctly.. :D

Share this post


Link to post
Share on other sites

Updates of January 2023:

  • Fix: Nightly refresh of LDraw unofficial files working now, it was buggy before and stuck on the releases from ~August 2022 version
  • Feature: Unofficial files may be downloaded via a new checkbox. Searches are exclusive here, so having the checkbox set means it only goes through the unofficial list (but may grab sub assemblies from the official, where needed)
  • UI: Added Dark Mode awareness
  • UI: Added Font-Awesome Icons for downloads
  • UI: Some tweaks (all professional webdesigners: hush hush, nothing to see here... don't look at my nasty css quirks :P)

There shouldn't be any bugs known - hit me up if you found something to proof me wrong!

Edited by aFrInaTi0n

Share this post


Link to post
Share on other sites

Hello there @aFrInaTi0n

I love your " LDraw to Studio Exporter "

So far I found one unofficial LDraw part that won't display properly, to be specific the shape is ok but the textures are not displayed


https://library.ldraw.org/search/part?s=u9328ap01c01
parts/u9328ap01c01.dat

Can you fix it if you can :)

thanks a lot

Share this post


Link to post
Share on other sites

Hello @sparrow_blaise - first of all thanks for your kind words - can you retest if all textures are now included?

Direct Link: https://www.reum.it/ldraw-to-studio-exporter/index.php?part=u9328ap01c01.dat&unofficial=true

There was a bug, missing out textures at all... fixed now - thanks for pointing out!

 

With the LDraw Viewer its correctly showing the textures - I am not familar with working with textures, so I don't know if they need to be added manually in Part Designer for Studio picking them up, as mine isn't taking them..

ldraw-downloader-texture-fix.png

Edited by aFrInaTi0n

Share this post


Link to post
Share on other sites

At the moment, LDraw and Studio’s texture mapping solutions are different.  They could be compatible but they aren’t.

Studio reinvented a solution, mostly because LDraw’s texmapping wasn’t actually used at the time (also because Studio wanted the images included in the part’s file, not as external files; that’s possible in LDraw but was not obvious).

We are trying to have the Studio team at least make it easy/simple to import from / export to LDraw.

 

Share this post


Link to post
Share on other sites

Thanks for clarification!

So I am including all the pngs in the correct folder structure now - but then they need to be re-added in PartDesigner, I guess?!

I which file is the description for Studio to recognize those? May be its worth a look, if those can be translated (in the process of creating the zipfiles from my tool).

Edited by aFrInaTi0n

Share this post


Link to post
Share on other sites

It should be possible to automatically convert LDraw’s texmap syntax to Studio’s.

The easy part is to include the png as a base64-encoded blob.  For the other parameters, unfortunately, there’s no documentation, so you’ll need to retro-engineer the parameters.

Note that, for some parts, Studio uses special files for texmaps (for instance, 973tex.dat for decorated torsos).  I’m not sure of their utility: as a shape, they are the same as the plain parts, and I didn’t see any big syntactic difference (I mean, they are somewhat flattened but still use subfiles/primitives, including for the texmapped surface).

Share this post


Link to post
Share on other sites

@aFrInaTi0n Sorry it didn't work for me in Studio 2.0

Can you please fix it, it would mean the world to me

Thanks buddy

ALSO

do you have that string that goes along the whole ship front to back from your Pirates 6285 ship for Studio 2.0 as a ldraw file perhaps?

6285.jpg

Edited by sparrow_blaise

Share this post


Link to post
Share on other sites

Pleas read the posts above from @Sylvain - seems the format is structured in a complete other way in Studio.

 

I fixed the downloader already - so now the pngs are included now - I will have to have a deeper look into this..

But I expect it taking longer / my capabilities to work on that issue not being good enough in the end.

 

So no promises, but will update you as soon as I am somehow smarter about this topic (expect 2-4 weeks).

Regards

Edited by aFrInaTi0n

Share this post


Link to post
Share on other sites

@aFrInaTi0n thank you for your answer, I will kindly wait 2-4 weeks :)

ALSO

do you have that string that goes along the whole ship front to back from your Pirates 6285 ship for Studio 2.0 as a ldraw file perhaps?

see picture above

Share this post


Link to post
Share on other sites

If there is a part id in the LDraw official & inofficial, than the answer may be "yes" - so are you speaking of https://www.bricklink.com/v2/catalog/catalogitem.page?P=x77ac50 ? Can't find the ID in LDraw unfortunately - so the answer seems to be "no".

General thing with Studio is: Its very limited when it comes to flexible parts like hoses, tubes etc - I think this may also apply to strings / cords.. normally people recommend to do the flexible parts in LDDraw and import them into Studio in their already-correctly bent positions.

Another idea: Philo did it via the LDraw OMR: https://omr.ldraw.org/files/1512

Download this and take it out from there? I am curently working, so I can't rn check in detail what part number is in philos file of the ship..

Edited by aFrInaTi0n

Share this post


Link to post
Share on other sites

@aFrInaTi0n I didn't know LDraw OMR existed, what is it exactly?

I love LDraw OMR, Built Lego sets with everything from sails, stickers to strings / cords, completed as it's meant to be :)

 

Hey please don't give up on making the png files work for the tepees, even if it takes some time
I would really like to build set

LEGO Rapid River Village Set 6766

 

Share this post


Link to post
Share on other sites

Hello! I've noticed an issue while trying to zip part no. 48156p01.dat - Minifig Helmet SW Scout Trooper with Black and Light Bluish Grey Markings Pattern. Exporter returns "not found" msg. Might be that I'm doing something wrong, tho I tried with part no. 47373 - from yours tutorial - and it worked properly :) May I ask for a little help? Thanks! 

Share this post


Link to post
Share on other sites

@grab_a_beer_and_build_lego You are right, its missing but should not - I will take a look the next days and post back here whenever I know the reasons.

Meanwhile you may use the direct download function of the Ldraw lib (but then only as one unified .dat file - bottom left on the page you linked, direct link: https://library.ldraw.org/library/official/parts/48156p01.dat)

Share this post


Link to post
Share on other sites

I tried that - and unfortunately it looks like only a fragment of the part shows up in the open Studio editor.

 

I wasn't sure whether it was a matter of a damaged LDraw model (unlikely - the embedded 3D preview on the LDraw website shows the correct model) or a matter of the fact that putting the model downloaded via "Download" into the "custom" directory causes an error. I'm sure I tried with the main model - that's why I kept looking and finally found your program :)

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.