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 / 14654
     
   
Subject: 
Sticker Generator for LDRAW / MLCAD
Newsgroups: 
lugnet.cad, lugnet.announce
Followup-To: 
lugnet.cad
Date: 
Mon, 23 Jul 2007 22:26:23 GMT
Highlighted: 
! (details)
Viewed: 
7562 times
  

I would like to share my sticker generating tool, that I created to convert
bitmap images into flat part files (stickers / decals) for use in ldraw based
CAD programs and rendering programs.

Here is an example of what it can do:
<http://www.brickshelf.com/cgi-bin/gallery.cgi?i=2637508>

Here is a screenshot of the program:
<http://www.brickshelf.com/cgi-bin/gallery.cgi?i=2637509>

If you'd like to try it, I would really appreciate comments and suggestions for
improvement.  Also, I have included source code, so you can make your own
changes or make sure that it is indeed a safe program to use.  If you do make
changes, I would really appreciate you sending them to me.

Download in zip format from here:
<http://www.scottwardlaw.com/sticker_generator.zip>

Thanks,
Scott

   
         
     
Subject: 
Re: Sticker Generator for LDRAW / MLCAD
Newsgroups: 
lugnet.cad
Date: 
Mon, 23 Jul 2007 23:07:19 GMT
Viewed: 
3126 times
  

In lugnet.cad, Scott Wardlaw wrote:

   Download in zip format from here: http://www.scottwardlaw.com/sticker_generator.zip

Very cool! May I add a link to this from my Bitsticker page? I suspect the desktop program does not have the size/speed restrictions that limit my script.

Jim

    
          
      
Subject: 
Re: Sticker Generator for LDRAW / MLCAD
Newsgroups: 
lugnet.cad
Date: 
Tue, 24 Jul 2007 02:21:23 GMT
Viewed: 
3198 times
  

In lugnet.cad, Jim DeVona wrote:
   In lugnet.cad, Scott Wardlaw wrote:

   Download in zip format from here: http://www.scottwardlaw.com/sticker_generator.zip

Very cool! May I add a link to this from my Bitsticker page? I suspect the desktop program does not have the size/speed restrictions that limit my script.

Jim

Jim,

I searched and searched for a program that would do this and never found one. I was surprised that there wasn’t something, but it looks like I was wrong.

You can absolutely put a link from you page to my download page. I’ll have to actually create a real page on my site and send it to you.

It looks like you have done more with colors and such. Would you mind if I incorporate some of your code into mine? If I have any thing that you can use, please use it.

Have you asked LDRAW.org to include a link to your site?

Thanks again, Scott

BTW, awesome truck!

     
           
       
Subject: 
Re: Sticker Generator for LDRAW / MLCAD
Newsgroups: 
lugnet.cad
Date: 
Tue, 24 Jul 2007 03:23:07 GMT
Viewed: 
3170 times
  

In lugnet.cad, Scott Wardlaw wrote:

   I searched and searched for a program that would do this and never found one. I was surprised that there wasn’t something, but it looks like I was wrong.

Don’t feel bad - the same thing happened to me when I wrote my script (except I didn’t really think to search much first). Shortly after releasing it, I discovered an even earlier effort on Lugnet. I think each implementation has its advantages, so we can be excused.

   You can absolutely put a link from you page to my download page. I’ll have to actually create a real page on my site and send it to you.

Sounds good.

   It looks like you have done more with colors and such. Would you mind if I incorporate some of your code into mine? If I have any thing that you can use, please use it.

Sure, you’re welcome to use anything you like from my code. If I ever get around to updating it again, I’ll definitely see if there’s anything I can use from yours!

   Have you asked LDRAW.org to include a link to your site?

No, not specifically. I did put a link to it in the LDraw wiki, but I think that’s sort of an experimental system so it’s not particularly visible.

   Thanks again, Scott

BTW, awesome truck!

Thanks! It’s a far cry from your rebuilt Camaro, but I like it. What I like to tell people now is that my next car is 60 years old - I have a ‘47 project car. Progress is slow, but building it from the ground up is going to be lots of fun.

Jim

     
           
      
Subject: 
Re: Sticker Generator for LDRAW / MLCAD
Newsgroups: 
lugnet.cad
Date: 
Tue, 24 Jul 2007 08:58:56 GMT
Viewed: 
3141 times
  

In lugnet.cad, Scott Wardlaw wrote:

Have you asked LDRAW.org to include a link to your site?

you can add download links by yourself. just login, go to the download section,
click on the [Add Download] link and fill in. don't worry if it doesn't show up
immediately - I have to authorize it.

w.
Ldraw Content Manager

    
          
     
Subject: 
Re: Sticker Generator for LDRAW / MLCAD
Newsgroups: 
lugnet.cad
Date: 
Tue, 24 Jul 2007 16:47:51 GMT
Viewed: 
3241 times
  

In lugnet.cad, Jim DeVona wrote:
   In lugnet.cad, Scott Wardlaw wrote:

   Download in zip format from here: http://www.scottwardlaw.com/sticker_generator.zip

Very cool! May I add a link to this from my Bitsticker page? I suspect the desktop program does not have the size/speed restrictions that limit my script.

Both of these applications are very cool, and I intend to begin using them immediately.

Do you guys mind if I ask a dumb question? That is, another dumb question after these two?

Are these applications an evolution of the various BMP2DAT programs I’ve played around with over the years? It seems that what you’ve got here is greaty more sophisticated, but the idea seemed similar enough to be worth asking about.

Anyway, great stuff. Thanks for sharing!

Dave!

    
          
     
Subject: 
Re: Sticker Generator for LDRAW / MLCAD
Newsgroups: 
lugnet.cad
Date: 
Tue, 24 Jul 2007 19:03:54 GMT
Viewed: 
3380 times
  

In lugnet.cad, Dave Schuler wrote:

   Are these applications an evolution of the various BMP2DAT programs I’ve played around with over the years? It seems that what you’ve got here is greaty more sophisticated, but the idea seemed similar enough to be worth asking about.

So, I know of at least four tools to convert images to LDraw stickers:
  1. BMP2DAT
  2. img2sticker (*)
  3. Bitsticker
  4. Sticker Generator
Plus you can make stickers from text with txt2dat.

I think this is a case of convergent evolution, not direct descent from BMP2DAT. In fact, I wasn’t really aware of BMP2DAT or img2sticker before writing Bitsticker.

So in conclusion, I don’t think there is a direct relation between any of these tools, just a similarity as you note. Take your pick!

Jim

   
         
   
Subject: 
Re: Sticker Generator for LDRAW / MLCAD
Newsgroups: 
lugnet.cad
Date: 
Tue, 24 Jul 2007 16:40:28 GMT
Viewed: 
3099 times
  

I have just tested your prog.

It seems to me that you put for every pixel one quad. This produces an
enormous amount of bytes in a file. There was already a prog that was
called bmp2dat.

If you could rearrange the quads that are direct beside into one bigger
quad, then I would use your prog also for official files. But in the way
it is now I can't do that (3MB filesize for example).

cu
mikeheide

Scott Wardlaw schrieb:
I would like to share my sticker generating tool, that I created to convert
bitmap images into flat part files (stickers / decals) for use in ldraw based
CAD programs and rendering programs.

Here is an example of what it can do:
<http://www.brickshelf.com/cgi-bin/gallery.cgi?i=2637508>

Here is a screenshot of the program:
<http://www.brickshelf.com/cgi-bin/gallery.cgi?i=2637509>

If you'd like to try it, I would really appreciate comments and suggestions for
improvement.  Also, I have included source code, so you can make your own
changes or make sure that it is indeed a safe program to use.  If you do make
changes, I would really appreciate you sending them to me.

Download in zip format from here:
<http://www.scottwardlaw.com/sticker_generator.zip>

Thanks,
Scott

   
         
     
Subject: 
Re: Sticker Generator for LDRAW / MLCAD
Newsgroups: 
lugnet.cad
Date: 
Tue, 24 Jul 2007 19:18:22 GMT
Viewed: 
2943 times
  

&tIn lugnet.cad, Michael Heidemann wrote:

It seems to me that you put for every pixel one quad. This produces an
   enormous amount of bytes in a file. There was already a prog that was called bmp2dat.

This is the approach also used by Bitsticker. It is certainly not optimal.

   If you could rearrange the quads that are direct beside into one bigger quad, then I would use your prog also for official files. But in the way it is now I can’t do that (3MB filesize for example).

Tim Gould’s img2sticker script uses a different strategy; you may want to give it a try. It does edge detection and then triangulates surfaces to fill the uniform areas. I’m not sure if that’s appropriate for official parts, either, but it should generate smaller files than these raster techniques.

Jim

   
         
   
Subject: 
Re: Sticker Generator for LDRAW / MLCAD
Newsgroups: 
lugnet.cad
Date: 
Tue, 24 Jul 2007 19:23:35 GMT
Viewed: 
3114 times
  

It seems to me that you put for every pixel one quad.

Almost...I combine pixels of the same color that are on the same horizontal
line.  So, if pixels 1 through 5 are the same color, they become a line that
ocupies 1 through 5.

Most of my stickers have been about 1MB.

I wasn't aware of the other programs when I wrote mine.  I don't think that
there is a good programmatic way to make official files.

I'll try to combine the vertical lines together, where possible, so that should
reduce file size.

Look for another release tomorrow.

Thanks for all of the suggestions and ideas!
Scott

   
         
   
Subject: 
Re: Sticker Generator for LDRAW / MLCAD
Newsgroups: 
lugnet.cad
Date: 
Tue, 24 Jul 2007 19:56:52 GMT
Viewed: 
3303 times
  

In lugnet.cad, Scott Wardlaw wrote:
It seems to me that you put for every pixel one quad.

Almost...I combine pixels of the same color that are on the same horizontal
line.  So, if pixels 1 through 5 are the same color, they become a line that
ocupies 1 through 5.

Most of my stickers have been about 1MB.

I wasn't aware of the other programs when I wrote mine.  I don't think that
there is a good programmatic way to make official files.

I'll try to combine the vertical lines together, where possible, so that should
reduce file size.

Look for another release tomorrow.

Thanks for all of the suggestions and ideas!
Scott

Hi Scott,
  It will be better if you put adjacent horizontal pixels into a long quad
rather than a line.

  The renderer POV-Ray does not support the concept of lines, so they are tossed
when L3P converts you LDraw file to a POV file.

Kevin

   
         
   
Subject: 
Re: Sticker Generator for LDRAW / MLCAD
Newsgroups: 
lugnet.cad
Date: 
Tue, 24 Jul 2007 21:39:38 GMT
Viewed: 
3606 times
  

Hi Scott,
  It will be better if you put adjacent horizontal pixels into a long quad
rather than a line.

  The renderer POV-Ray does not support the concept of lines, so they are tossed
when L3P converts you LDraw file to a POV file.

Kevin

Sorry, long quads is really what I meant by a line.  So, that's exactly what the
program does.

I should have an update out later today or tomorrow that combines pixels
vertically as well.

Thanks,
Scott

   
         
   
Subject: 
Re: Sticker Generator for LDRAW / MLCAD
Newsgroups: 
lugnet.cad
Date: 
Tue, 24 Jul 2007 23:26:45 GMT
Viewed: 
3782 times
  

In lugnet.cad, Scott Wardlaw wrote:
I should have an update out later today or tomorrow that combines pixels
vertically as well.

Keep in mind that doing it both ways is probably a lot more difficult than just
doing it one way.  For example, if you have a 1-pixel thick plus sign, you need
at least 3 quads (to avoid overlap), and your algorithm needs to deal nicely
with this.  Then too, a 2x2 pixel square would be nice as a single quad, but
doing this generically is likely to be a lot of work.

--Travis

   
         
   
Subject: 
Re: Sticker Generator for LDRAW / MLCAD
Newsgroups: 
lugnet.cad
Date: 
Wed, 25 Jul 2007 00:39:18 GMT
Viewed: 
3912 times
  

In lugnet.cad, Travis Cobbs wrote:
In lugnet.cad, Scott Wardlaw wrote:
I should have an update out later today or tomorrow that combines pixels
vertically as well.

Keep in mind that doing it both ways is probably a lot more difficult than just
doing it one way.  For example, if you have a 1-pixel thick plus sign, you need
at least 3 quads (to avoid overlap), and your algorithm needs to deal nicely
with this.  Then too, a 2x2 pixel square would be nice as a single quad, but
doing this generically is likely to be a lot of work.

--Travis

If you can work out regions of identical colour I believe there is a theory that
says you can fill it with no more than 2N (where N is the number of corners)
triangles. This is probably a good way of doing it for complex shapes.

If I ever get a chance to update my sticker creator I intend to use this
algorithm (I believe Ross uses it for txt2dat) as well as better smooth edge
finding.

Tim

   
         
     
Subject: 
Re: Sticker Generator for LDRAW / MLCAD
Newsgroups: 
lugnet.cad
Date: 
Thu, 26 Jul 2007 17:44:34 GMT
Viewed: 
4092 times
  

Sorry that it has taken me so long.  In fact, I am still working on creating
quadrilaterals and triangles to fill the largest spaces possible.  My main
hang-ups are:
reducing processing time
a working point-in-polygon test

I have found two different methods for testing if a point is inside a polygon,
but both have flaws (or my implimentation of them has flaws)

I did create a webpage for the sticker generator.  Does anyone have a better
name for it, other than sticker generator?

The ldraw primary colors is now working, and the preview for ignoring background
colors is now more accurate.

Please checkout the website, download the program, and let me know what other
changes that I can make:
<http://www.scottwardlaw.com/sticker_generator/>

I will continue to work on the polygon problem.

Thanks again for all of your help and suggestions,
Scott

    
          
     
Subject: 
Re: Sticker Generator for LDRAW / MLCAD
Newsgroups: 
lugnet.cad
Date: 
Thu, 26 Jul 2007 19:14:31 GMT
Viewed: 
3945 times
  

In lugnet.cad, Scott Wardlaw wrote:
I have found two different methods for testing if a point is inside a polygon,
but both have flaws (or my implimentation of them has flaws)

There is C code for a point in polygon implementation here:

http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html

It's only 8 lines of code for the whole thing, but it supports arbitrary
polygons, including ones with holes.  UNDERSTANDING the algorithm might take a
little work, but the page contains good documentation about the whole thing.

--Travis

   
         
   
Subject: 
Re: Sticker Generator for LDRAW / MLCAD
Newsgroups: 
lugnet.cad
Date: 
Sat, 6 Oct 2007 23:59:16 GMT
Viewed: 
4644 times
  

In lugnet.cad, Timothy Gould wrote:
In lugnet.cad, Travis Cobbs wrote:
In lugnet.cad, Scott Wardlaw wrote:
I should have an update out later today or tomorrow that combines pixels
vertically as well.

Keep in mind that doing it both ways is probably a lot more difficult than just
doing it one way.  For example, if you have a 1-pixel thick plus sign, you need
at least 3 quads (to avoid overlap), and your algorithm needs to deal nicely
with this.  Then too, a 2x2 pixel square would be nice as a single quad, but
doing this generically is likely to be a lot of work.

--Travis

If you can work out regions of identical colour I believe there is a theory that
says you can fill it with no more than 2N (where N is the number of corners)
triangles. This is probably a good way of doing it for complex shapes.

If I ever get a chance to update my sticker creator I intend to use this
algorithm (I believe Ross uses it for txt2dat) as well as better smooth edge
finding.

Wow, I can't believe I only just found this thread!

txt2dat uses Jonathan Richard Shewchuk's Triangle library to triangulate
polygons generated by Truetype fonts. All you need to do is supply a list of
verteces, and it will generate the triangles to fill it. It's written in C, is
very fast, and can handle all weird types of polygons, including ones with
"holes" in them. And best of all it's free. Get it here:
http://www.cs.cmu.edu/%7Equake/triangle.html

And there's lots of great information there about the theory and how it works
too.

ROSCO

 

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