[Python] LDraw to SVG Converter


[Python] LDraw to SVG Converter
#1
Hey folks,

I needed a way to have clean SVGs created from LDraw parts - luckily with the assistance of AI such can nowadays easily be achieved even with two left hands ..  Rolleyes

Released under MIT license, so everybody is free to use it for any needs.

Linkie: https://github.com/aFrInati0n/ldraw2svg

Main Features:
  • Supported formats: .dat; .ldr; .mpd
  • Allows Changing the perspective (via handing in exact angles or via presets)
  • Allows to create wireframe (no faces)
  • Coloring done via RGB colors

Example:
  • 89801 Thropy - angled and as wireframe only:
    .svg   89801.svg (Size: 7.46 KB / Downloads: 5)
  • 89901 Thropy - front view & colored: 
    .svg   89801-trophy-gold.svg (Size: 41.53 KB / Downloads: 4)
  • A minifigure (put together in Studio, exported as minifig.ldr): 
    .svg   minifig.svg (Size: 215.27 KB / Downloads: 5)


I believe I personally have enough functionality in the tool to suffice my needs - so I am not expecting any big amount of additional features added in the future.

As always - thanks to the whole LDraw team, without all your efforts there would be no basis for such tools!

Kind regards,
Christoph
Reply
RE: [Python] LDraw to SVG Converter
#2
If I understand it correctly each triangle is exported a path right? One optimization could be to merge adjacent triangles of the same colour to one path. This would also reduce the file size of the resulting svg.
Reply
RE: [Python] LDraw to SVG Converter
#3
Yes, that would possibly be a more advanced way to go - but as written in the initial post the script is sufficient enough for my needs already (which are usecases in the web & browsers are using compression already).

But if you like to improve it feel free to send a PR or just fork it please.
Reply
RE: [Python] LDraw to SVG Converter
#4
Maybe I will build a gui for it, either in fork or maybe a pullrequest. I could also reuse my colour picker from 3DToLD.
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)