LDraw.org Discussion Forums

Full Version: "Export to LDraw" plugin for Google SketchUp
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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...ugins.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.

- 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/

- 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).

- 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.