LDraw.org Discussion Forums
"Export to LDraw" plugin for Google SketchUp - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: Parts Author Tools (https://forums.ldraw.org/forum-24.html)
+--- Thread: "Export to LDraw" plugin for Google SketchUp (/thread-187.html)



"Export to LDraw" plugin for Google SketchUp - Jim DeVona - 2011-07-30

Just thought I'd share this again here for anyone who might be interested - my version of a script to convert Google SketchUp models to LDraw format. It is very rudimentary and not particularly user-friendly, but I found it useful to be able to take advantage of SketchUp's various modeling features to get started on a part. You'll have to edit the output manually to incorporate any existing LDraw primitives.

The script is available here: http://code.google.com/p/sketchupldraw/downloads/list
Pasted below is the documentation, such as it is (which also appears at the top of the script file):



This is a plugin for Google SketchUp (http://sketchup.google.com/). To install, put this file in your SketchUp plugins folder. Where's that? See here: http://sketchuptips.blogspot.com/2008/03/how-to-download-and-install-plugins.html (Note on Mac OS X you can also use your user ~/Library instead of your system /Library) Restart SketchUp, and an "Export to LDraw…" item should now appear in the Plugins menu.

Credits:
- Based on Jim Foltz' Su2LDraw script, which has more features, including importing LDraw models to SketchUp. http://sites.google.com/site/jimfoltz02/su2ldraw Check out Jim's blog for other cool SketchUp stuff: http://sketchuptips.blogspot.com/

References:
- SketchUp Ruby API: http://code.google.com/apis/sketchup/docs/
- LDraw File Format Specification: http://www.ldraw.org/specs/fileformat/ - oops, I mean http://www.ldraw.org/Article218.html

Scale & Orientation:
- Per http://www.ldraw.org/Article218.html#coords "Real World Approximations", this script assumes 1 LDU = 0.4 mm and converts units on export accordingly. In other words, model bricks as life-size in SketchUp and they will be exported with correct LDraw units. An example: Brick 1 x 1 (3001.dat) has an 8 mm footprint and is 9.6 mm tall not including stud.
- SketchUp and LDraw coordinate systems are slightly different. In general, for easiest results, rotate your SketchUp model down 90 degrees around X axis before export (or just build that way).

Limitations:
- Too many to list. Don't assume you can just export any SketchUp model and have an LDraw version; it won't work. See code and comments below for details on how it works and what it doesn't do.