To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cadOpen lugnet.cad in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / 14165
14164  |  14166
Subject: 
Re: I found an LDRAW importer for Google SketchUp
Newsgroups: 
lugnet.cad
Date: 
Thu, 2 Nov 2006 15:59:30 GMT
Viewed: 
3226 times
  
Hello,

I just wanted to say hi and that I am trying to work on the plugin everyday. Even so, it’s a slow process. I have some basic functionality but there are a lot of problems.

Right now, it’s posible to import primitives, parts, and models. Multi-part documents (.mpd) are not supported, but it shouldn’t be too hard to add.

You can also create a component and export it, but some things need to be done by hand:

Faces with more than 4 vertices need to be divided so no face has more than 4 vertices. Call it triangulation, or quadrilateral-ization. I’m sure part authors are familiar with the process...

Installation
  • Download ldraw.rb
  • Move or copy it to the Plugins directory where SketchUp is installed.
  • Re-start SketchUp. A sub-menu named LDraw should appear in the Plugins menu.
General Settings
  • Set Units to Decimal Inches with 0 precision. You may also turn off Display units format because you will be working in LDraw Units (LDU’s.) One inch == one LDU. Screenshot
  • Turn on Enable transparency in the Display Settings so you can see transparent colors.
  • Turn off Show: Profiles in the same dialog. (Helps you see errors.) Screenshot
  • Open the Component Browser and make sure it is in List view, then...
  • Close all SketchUp dialogs (Component Browser, Outliner, Layers Dialog) before importing! SketchUp tries to update the dialogs during the import, which makes importing very slow unless they are closed. I’m not sure if I can automate this yet.
  • Set View to Iso
Importing Primitives and Parts
  • Select LDraw -> import menu
  • Select a .dat file to import. I will use (3001.dat)
  • Open the Components window.
For some reason, SketchUp doesn’t update the Component window if it is in Icon view. You may now switch it to Icon view if you like.
  • Find the name of the part/primitive you just imported in the Component browser, select it, and place it at the origin.
(screenshot)

You will notice the part is sitting on the wrong axis. It appears LDraw and SketchUp disagree on which way is up. Don’t worry about it for now.

Notice also you will see all the primitives used by 3001.dat in the Component browser.

If you open the Outliner, you should see how the imported part is really organized. It is a hierachy of primitives, in this case. (Outliner)

As a side note, there is at least one part that gives me problems: 6120.dat . Importing 6120.dat (minifig ski) gives me ski. I can fix this by switching the order of the vertices in the .dat file, but I don’t know how to automatically detect which order to use in the plugin.

Anyway, back to our regulary scheduled program...


Exporting a Model File from Parts
  • Let’s import a few more parts: (3002, 3003, 3004)

  • Notice the Components list doesn’t get that much longer. Components already in the browser don’t get re-loaded.

  • Create a simple model and paint the parts (use colors you know are available by name in LDraw: red, green, blue...)

  • Select all the bricks and create a new component named model1 (Edit -> Make component) You should see it in the Component Browser.

  • Select the new component, and then LDraw -> Export component to .dat from the menu. What is really happening is that each component in the model is being exported as a file reference (line type 1 in LDraw.) The container component provides the filename.

  • Load the file LDraw to test.


Here’s the .dat file produced:

1 2 60 28.0 20.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 3003.dat
1 1 70 4.0 20.0 0.0 0.0 -1.0 0.0 1.0 0.0 1.0 0.0 0.0 3004.dat
1 4 40.0 76.0 20.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 3001.dat
1 14 50 52.0 20 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 3002.dat
0

Well, that’s it in a nutshell. You can try to make your own components also, but I can’t guarantee it will work:
  1. Draw some faces.
  2. Inport some primitives (if you want.)
  3. Place the primitives.
  4. Make everything into one component.
  5. Select and export it.
  6. Good luck!

Now I need to work on the bathroom remodel before my wife files for divorce...



Message has 2 Replies:
  Re: I found an LDRAW importer for Google SketchUp
 
(...) If you look at LDLoader/LDLQuadLine.cpp in the LDView source code, you will find my code for fixing the winding of bow-tie quads. (Specifically, look at LDLQuadLine::swapPoi...IfNeeded.) If the algorithm I use isn't apparent, or you're not (...) (18 years ago, 2-Nov-06, to lugnet.cad, FTX)
  Re: I found an LDRAW importer for Google SketchUp
 
(...) A note on colors. Some LDraw tools (including MLCAD, LDView, L3P) support arbitrary 24-bit color specifications. Use the following in place of the color code for colors you don't recognize: 0x02RRGGBB The RRGGBB part is the hex version of the (...) (18 years ago, 3-Nov-06, to lugnet.cad, FTX)

Message is in Reply To:
  Re: I found an LDRAW importer for Google SketchUp
 
(...) I got the following mail from Jim (the author of the LDRAW import plugin): (...) Hello Anders, I've been reading the posts in the lugnet.com/cad news about my LDraw SketchUp Plugin. Thanks for the posting. I have uploaded a new version with a (...) (18 years ago, 30-Oct-06, to lugnet.cad)

16 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR