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 / 14149
Subject: 
I found an LDRAW importer for Google SketchUp
Newsgroups: 
lugnet.cad
Date: 
Tue, 24 Oct 2006 15:58:52 GMT
Viewed: 
2026 times
  
Don't know if this has been mentioned here before, but I have found an LDRAW
import plugin, made by Jim Foltz(?), for the Google SketchUp program:
http://jim.foltz.googlepages.com/sketchupldrawimporter

I have only checked it on the CAR.DAT yet, but that works, even the colors
come through.

One important thing for international users: It barfs if your Windows is not
configured for a decimal *point* (it crashed SketchUp on my Swedish Win XP
until I changed the National Settings to DP).

If you haven't heard about it, Google SketchUp (http://sketchup.google.com)
is a free drawing program with many interesting properties. It's probably
not suited for LDRAW part authoring, but it can be a great way to play a
little in 3D with your model.

--
Anders Isaksson, Sweden
BlockCAD:  http://web.telia.com/~u16122508/proglego.htm
Gallery:   http://web.telia.com/~u16122508/gallery/index.htm


Subject: 
Re: I found an LDRAW importer for Google SketchUp
Newsgroups: 
lugnet.cad
Date: 
Thu, 26 Oct 2006 05:23:41 GMT
Viewed: 
2325 times
  
In lugnet.cad, Anders Isaksson wrote:
Don't know if this has been mentioned here before, but I have found an LDRAW
import plugin, made by Jim Foltz(?), for the Google SketchUp program:
http://jim.foltz.googlepages.com/sketchupldrawimporter

I have only checked it on the CAR.DAT yet, but that works, even the colors
come through.

One important thing for international users: It barfs if your Windows is not
configured for a decimal *point* (it crashed SketchUp on my Swedish Win XP
until I changed the National Settings to DP).

If you haven't heard about it, Google SketchUp (http://sketchup.google.com)
is a free drawing program with many interesting properties. It's probably
not suited for LDRAW part authoring, but it can be a great way to play a
little in 3D with your model.

Actually I wonder about that. I searched recently for good 3D modeler programs
on the premise that using such programs could rapidly shrink part authoring time
if done well. In the process I also found Pictomod3D
(http://www.styxar.com/ptm3d.htm) which looks like it has potential. Imagine
getting started with a part by just taking a few photos and running them through
Pictomod3D, and then tweaking the result. This could be really amazing for
non-geometric parts like hair, plants, and animals.

If the LDraw importer for Google SketchUp can also save in .dat format, then
SketchUp could mock up a part and then more detail (including primitives) can be
added in another editor later. Right now I'm working on modeling the minifig
ponytail hair and farmer/blacksmith cowl using just LDraw Design Pad, which is a
slow and tedious process at best. (I figure at the rate I'm going after I've
just started, if I keep up at this pace, I could knock the ponytail piece out by
later December.)


Subject: 
Re: I found an LDRAW importer for Google SketchUp
Newsgroups: 
lugnet.cad
Date: 
Thu, 26 Oct 2006 15:49:57 GMT
Viewed: 
2158 times
  
Lee Gaiteri wrote:

Imagine getting started with a part by just taking a few
photos and running them through Pictomod3D, and then tweaking the
result.

I don't belive it works (well) until I've seen it :-) I've tested some other
such programs through the years, and they just don't cut it. Haven't tried
Pictomod3D though.

If the LDraw importer for Google SketchUp can also save in .dat
format

Note that it is an *im*porter, not *ex*porter. But it is probably possible
to write an exporter that produces something .dat-like, you just have to
find the programmer to do it :-)

then SketchUp could mock up a part

Is Sketchup good when making things with precise dimensions? I've played a
bit with it, and it's easy to draw *something*, but I didn't find an easy
way to get precise dimensions (and it's all too easy to change things with
the mouse).

and then more detail (including primitives) can be added in another editor

Automatic primitive substitution is almost a must, as we're talking
*complicated* parts here with lots of elements. The easy ones are better
done directly in a text editor.

--
Anders Isaksson, Sweden
BlockCAD:  http://web.telia.com/~u16122508/proglego.htm
Gallery:   http://web.telia.com/~u16122508/gallery/index.htm


Subject: 
Re: I found an LDRAW importer for Google SketchUp
Newsgroups: 
lugnet.cad
Date: 
Thu, 26 Oct 2006 17:32:44 GMT
Viewed: 
2243 times
  
In lugnet.cad, Anders Isaksson wrote:
Lee Gaiteri wrote:

Imagine getting started with a part by just taking a few
photos and running them through Pictomod3D, and then tweaking the
result.

I don't belive it works (well) until I've seen it :-) I've tested some other
such programs through the years, and they just don't cut it. Haven't tried
Pictomod3D though.

I haven't tried it either, though I haven't seen anything else to compare it to.
I did manage to find one user review on a download site that says it's good, but
it works best on light-colored objects.

Note that it is an *im*porter, not *ex*porter. But it is probably possible
to write an exporter that produces something .dat-like, you just have to
find the programmer to do it :-)

Aye, there's the rub.

then SketchUp could mock up a part

Is Sketchup good when making things with precise dimensions? I've played a
bit with it, and it's easy to draw *something*, but I didn't find an easy
way to get precise dimensions (and it's all too easy to change things with
the mouse).

Many modeling programs I've looked into over the years (I don't currently use a
3D modeler because of this) don't allow that level of precision, no. However,
with complex parts like hair, manually adding a zillion lines and triangles
isn't all that feasible. As far as conditional edges go, my edger utility can
handle adding those, but the rest is quite hard. Neither LDraw Design Pad nor
MLCad is able to simply move a vertex, split an edge, etc. I'm tempted to write
my own program for this, but I think it'd be easier to design an LDDP plugin
than write a program. I've been compiling a list of functions that no current
editor I've seen has:

- Split a quad into two triangles
- Split an edge
- Easily move a vertex
- Enforce same winding among traingles/quads that touch
- Add primitives according to a scripted math formula (e.g., lines, triangles)

Something like that would be pretty useful, I think. I know some of these
functions are supported by other 3D modelers, and many modelers are good for
simply rapidly working up a general shape. Connecting it to primitives later is
really the easy part.

Automatic primitive substitution is almost a must, as we're talking
*complicated* parts here with lots of elements. The easy ones are better
done directly in a text editor.

Well yeah, but then anybody can do easy parts--and they do. Harder parts have
fallen by the wayside for lack of good tools.


Subject: 
Re: I found an LDRAW importer for Google SketchUp
Newsgroups: 
lugnet.cad
Date: 
Fri, 27 Oct 2006 00:00:15 GMT
Viewed: 
2333 times
  
In lugnet.cad, Lee Gaiteri wrote:
In lugnet.cad, Anders Isaksson wrote:
Lee Gaiteri wrote:

then SketchUp could mock up a part

Is Sketchup good when making things with precise dimensions? I've played a
bit with it, and it's easy to draw *something*, but I didn't find an easy
way to get precise dimensions (and it's all too easy to change things with
the mouse).

You can add dimension objects, which get "linked" to points you specify, so as
you change the size of the object it's linked to, the dimension is automatically
updated. Not the perfect solution, but does allow for reasonable accuracy.

Many modeling programs I've looked into over the years (I don't currently use a
3D modeler because of this) don't allow that level of precision, no. However,
with complex parts like hair, manually adding a zillion lines and triangles
isn't all that feasible. As far as conditional edges go, my edger utility can
handle adding those, but the rest is quite hard. Neither LDraw Design Pad nor
MLCad is able to simply move a vertex, split an edge, etc. I'm tempted to write
my own program for this, but I think it'd be easier to design an LDDP plugin
than write a program. I've been compiling a list of functions that no current
editor I've seen has:

- Split a quad into two triangles
- Split an edge
- Easily move a vertex

SketchUp can do all these quite nicely. It can split a quad into 2 quads too if
you need to. All you do is add a line where you want to split, and you can drag
the line as needed. I think it would be a great tool for modelling complex
surfaces like minifig hair, if an export to DAT funtion can be written.

ROSCO


Subject: 
Re: I found an LDRAW importer for Google SketchUp
Newsgroups: 
lugnet.cad
Date: 
Mon, 30 Oct 2006 17:25:45 GMT
Viewed: 
2480 times
  
Ross Crawford wrote:

I think it would be a great tool for modelling complex surfaces
like minifig hair, if an export to DAT funtion can be written.

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 basic export function. It looks at only
the faces in the current model and exports a .dat file (defaults to
c:/ldraw/test.dat).

Maybe you could give it a try. I'd like to hear about how you would like to
use SketchUp for part authoring so I can understand how to make  the
importer/exporter better.
<<<

So let's go to http://jim.foltz.googlepages.com/sketchupldrawimporter and
download it and test it. Jim knows of the postings here now, so we can add
our findings, ideas and bug-reports in this thread.

--
Anders Isaksson, Sweden
BlockCAD:  http://web.telia.com/~u16122508/proglego.htm
Gallery:   http://web.telia.com/~u16122508/gallery/index.htm


Subject: 
Re: I found an LDRAW importer for Google SketchUp
Newsgroups: 
lugnet.cad
Date: 
Thu, 2 Nov 2006 15:59:30 GMT
Viewed: 
3225 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...


Subject: 
Re: I found an LDRAW importer for Google SketchUp
Newsgroups: 
lugnet.cad
Date: 
Thu, 2 Nov 2006 20:31:33 GMT
Viewed: 
2904 times
  
In lugnet.cad, Jim Foltz wrote:
   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.

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::swapPointsIfNeeded.) If the algorithm I use isn’t apparent, or you’re not familiar with C++, let me know and I’ll describe it for you.

I don’t know if sketchup has a concept of front and back faces for polygons (I’m guessing it does), but if it does, you won’t be able to determine the proper front surface of polygons for any parts that aren’t BFC-certified. You can, however, automatically generate two polygons containing the same points with opposite windings for any polgons where you don’t know the winding.

--Travis


Subject: 
Re: I found an LDRAW importer for Google SketchUp
Newsgroups: 
lugnet.cad
Date: 
Thu, 2 Nov 2006 22:38:36 GMT
Viewed: 
2905 times
  
In lugnet.cad, Travis Cobbs wrote:
  

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::swapPointsIfNeeded.) If the algorithm I use isn’t apparent, or you’re not familiar with C++, let me know and I’ll describe it for you.

I can’t find it anywhere. I downloaded the source from: http://ldview.sourceforge.net/LDView-2101s.zip. Is this the right zip file?


Subject: 
Re: I found an LDRAW importer for Google SketchUp
Newsgroups: 
lugnet.cad
Date: 
Thu, 2 Nov 2006 23:34:21 GMT
Viewed: 
3026 times
  
In lugnet.cad, Jim Foltz wrote:
   In lugnet.cad, Travis Cobbs wrote:
  

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::swapPointsIfNeeded.) If the algorithm I use isn’t apparent, or you’re not familiar with C++, let me know and I’ll describe it for you.

I can’t find it anywhere. I downloaded the source from: http://ldview.sourceforge.net/LDView-2101s.zip. Is this the right zip file?

No, that’s not the right version, and doesn’t have the file. You can get the latest release’s source from here:

http://prdownloads.sourceforge.net/ldview/LDView-3100s.zip?download

I’ll update my downloads page to include direct links to the more current source. It’s obviously confusing at the momemt.

--Travis


Subject: 
Re: I found an LDRAW importer for Google SketchUp
Newsgroups: 
lugnet.cad
Date: 
Fri, 3 Nov 2006 04:56:04 GMT
Viewed: 
3077 times
  
Just FYI, I updated the LDView downloads page, and it’s now much more clear how to get the current LDView source code. The source code section of that page is here:

http://ldview.sourceforge.net/Downloads.html#SourceCode

--Travis


Subject: 
Re: I found an LDRAW importer for Google SketchUp
Newsgroups: 
lugnet.cad
Date: 
Fri, 3 Nov 2006 16:54:45 GMT
Viewed: 
3054 times
  
In lugnet.cad, Travis Cobbs wrote:
   Just FYI, I updated the LDView downloads page, and it’s now much more clear how to get the current LDView source code. The source code section of that page is here:

http://ldview.sourceforge.net/Downloads.html#SourceCode

--Travis

Thanks Travis, I will have a look.

In the mean time, I have been using the blog to announce the importer/exporter updates. Sketchy Endeavors.


Subject: 
Re: I found an LDRAW importer for Google SketchUp
Newsgroups: 
lugnet.cad
Date: 
Fri, 3 Nov 2006 17:29:22 GMT
Viewed: 
3421 times
  
In lugnet.cad, Jim Foltz wrote:
  
  • Create a simple model and paint the parts (use colors you know are available by name in LDraw: red, green, blue...)

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 RGB. Make sure to 0-pad. So 255,128,0 would be 0x02FF8000.

You can use the following to get transparent colors:

0x03RRGGBB

Of course, you can’t control the amount of transparency, just whether it’s on or off.

--Travis


Subject: 
Re: I found an LDRAW importer for Google SketchUp
Newsgroups: 
lugnet.cad
Date: 
Sat, 4 Nov 2006 06:09:44 GMT
Viewed: 
3110 times
  
In lugnet.cad, Travis Cobbs wrote:
   Just FYI, I updated the LDView downloads page, and it’s now much more clear how to get the current LDView source code. The source code section of that page is here:

http://ldview.sourceforge.net/Downloads.html#SourceCode

--Travis

Tanks Travis, I got it working. Your code was neat and clear; you must do it professionally.

Here’s a before and after:






Subject: 
Re: I found an LDRAW importer for Google SketchUp
Newsgroups: 
lugnet.cad
Date: 
Sat, 4 Nov 2006 10:03:01 GMT
Viewed: 
2456 times
  
In lugnet.cad, Lee Gaiteri wrote:
Many modeling programs I've looked into over the years (I don't currently use a
3D modeler because of this) don't allow that level of precision, no. However,
with complex parts like hair, manually adding a zillion lines and triangles
isn't all that feasible. As far as conditional edges go, my edger utility can
handle adding those, but the rest is quite hard. Neither LDraw Design Pad nor
MLCad is able to simply move a vertex, split an edge, etc. I'm tempted to write
my own program for this, but I think it'd be easier to design an LDDP plugin
than write a program. I've been compiling a list of functions that no current
editor I've seen has:

- Split a quad into two triangles
- Split an edge
- Easily move a vertex
- Enforce same winding among traingles/quads that touch
- Add primitives according to a scripted math formula (e.g., lines, triangles)




Hi Lee,

for the last four years I've been working on a program to do things like that -
move vertexes easily, handle the winding, add mathematically simple shapes like
circles in an easy way, calculate the intersction line between two objects...
What kind of functions do you need? I can try and implement some of them (if I'm
able).

First screenshots can be found here:
http://www.brickshelf.com/cgi-bin/gallery.cgi?f=199419

I hope I can publish the program in Spring 2007.

Leg Godt-
Sven


Subject: 
Re: I found an LDRAW importer for Google SketchUp
Newsgroups: 
lugnet.cad
Date: 
Sat, 4 Nov 2006 18:24:45 GMT
Viewed: 
3314 times
  
In lugnet.cad, Travis Cobbs wrote:

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:

Thanks for the tip.

I plan on having a custom pallet in SketchUp with all the ldraw colors
available. Of course, you can create your own colors too. A custom color will
get exported as you describe below.


0x02RRGGBB

The RRGGBB part is the hex version of the RGB.  Make sure to 0-pad.  So
255,128,0 would be 0x02FF8000.

You can use the following to get transparent colors:

0x03RRGGBB

Of course, you can't control the amount of transparency, just whether it's on
or off.

I'd use 50% in that case.


--Travis


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