Loading...
July 29, 2009#

Eagle3D, POVray, Google SketchUp and SU2POV! Eh? Lost?

downloadTime to shed some light on one of those secret tools in my little electronics toolbox: Eagle3D! If you are like me, using Cadsoft’s awesome (and free) layout and schematics tool Eagle and want good-looking pictures of your latest design, then you should probably heave a look at another free little tool designed to work on Eagle layouts to generate a 3D ray-traced rendering of your boards. The tool or rather script is called Eagle3D and can be found here.

No why is this worth writing about? First of all because it’s an astonishing tool creating absolutely realistic images of your board before you even think about manufacturing and soldering it. But secondly, because Eagle3D is not the type of tool with funny, colored icons in a nice little toolbar where you just click one of those icons and your rendering is done. Unfortunately, using it as it comes out of the box, you’ll probably end up with only half of the parts on your board being rendered correctly or rendered at all. To see the rest of you parts on the board, there’s no way around some fine tuning of the Eagle3D scripts (or even some CAD construction work to build custom parts). Below is an image of one of my boards at various stages, rendered with the out-of-the box version of Eagle3D, rendered after editing some of the Eagle3D scripts and finally, rendered after construction and adding some custom parts with Google SketchUp.

Comp 1 Comp 2

So before I explain all this, let’s make sure you got the basic part right:

  1. Go here and download Eagle3D AS WELL AS the archive containing all the parts included with Eagle3D as images. You’re gonna need the latter one later on for lookup purposes.
  2. Get the latest POVray version here.
  3. After you’ve installed all the above to whatever location you prefer, fire up Eagle, open your favorite board and select File –> Execute ULP then in the dialog that appears, navigate to your Eagle3D directory and the ULP sub-folder there and select 3d41.ulp
  4. Once you hit Open a settings dialog appears. You can basically leave the default settings as they are, just remember the path that’s shown on the first page where Eagle3D stores the povray file.
  5. Hit create POV-File and exit and answer all the questions you’ll be asked (e.g. colors of LEDs, logos on ICs, …)
  6. After the POVray file has been created, open it with POVray and hit Run to render your board.

At this point I’d like to point you to this site here and this one for a detailed description of Eagle3D’s features and further instruction on its basic usage.

Now, if you’re really lucky, after the six steps mentioned above, you end up with an image of your board with all parts rendered correctly. Unfortunately, in most cases, some of the parts will be rendered incorrectly (misplaced, mirrored, etc.) or not rendered at all. These problems result from two different situations with different solutions, but first a little but important background info:

Eagle3D parts are all described by macros written in POVray’s scripting language and you can find them in the povray subfolder in your Eagle3D directory. These macros are named different from the Eagle part / package names, which is why there are two files 3dpack.dat and 3dusrpac.dat in the ulp subfolder of the Eagle3D directory in which you can find the mapping between Eagle package names and Eagle3D part macros.

So if now some of the parts on your board are not rendered (correctly or at all) there’s the following two reasons:

  1. There is no or a wrong mapping in the 3dpack.dat or 3dusrpac.dat file between some of your parts in Eagle and the Eagle3D macro BUT such a part EXISTS in the Eagle3D image library.

    Example:
    In the design above, I’m using 4-pin Molex connectors with the package name 53048-04 in my Eagle layout and Eagle3D doesn’t render those connectors
    Blue Coffee 1.1
    BUT I browse through the image archive I’ve downloaded before from the Eagle3D website and I see, that there is in fact an image of the connector I’m looking for, named CON_MOLEX_53048_4.png.
    CON_MOLEX_53048_4
    Solution:

    1. So I open the 3dpack.dat file and search for CON_MOLEX_53048_4 to find the following line:

      NOEAGLEPAC:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:CON_MOLEX_53048_4(:Molex 53048: 

      This line tells me that the Eagle package with the name NOEAGLEPAC is mapped to the Eagle3D POVray macro CON_MOLEX_53048_4.

    2. Now you can either directly edit the line in this file or more elegantly copy the line into 3dusrpac.dat

      53048-04:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:CON_MOLEX_53048_4(:Molex 53048: 

      This way, you tell Eagle3D to map your Eagle package 53048-04 to the CON_MOLEX_53048_4.

    3. Now if you save your changes and go through steps 3 to 6 of the basic Eagle3D instructions above again, the missing Molex connector should be rendered correctly

    Hint:
    If a part is actually rendered but misplaced or flipped, rotated, etc. you can edit the mapping above and change the 13th to 16th ‘0’ digits to correct the rotation angle and x-, y-, z-offset of your part, e.g.

    53048-04:0:0:0:0:0:0:0:0:0:0:0:0:90:3.2:1.2:2.6:0:0:0:0:0:0:0:0:0:0:0:0:0:0:CON_MOLEX_53048_4(:Molex 53048:

    Details see here.

  2. There is no mapping in the the 3dpack.dat or 3dusrpac.dat file between some of your parts in Eagle and the Eagle3D macro AND such a part DOES NOT EXIST in the Eagle3D image library.
    In this case, there are two different solutions:

    Example 1:
    Eagle3D comes with the following 6-pin and 10-pin connectors (named CON_DIS_WS6G and CON_DIS_WS10G)
    CON_DIS_WS6G CON_DIS_WS10G
    similar to the connector I need, BUT I need an 8-pin version which doesn’t exist in Eagle3D. 

    Solution:

    1. Look for the Eagle3D macro for these connectors, to be found in the connectors.inc file in the povray sub-directory.
    2. Inside this file, look search for CON_DIS_WS6G or CON_DIS_WS10G and you will find the following:

      #macro CON_DIS_WS6G()
      object{CON_DIS_WS_XX_G_GRND(6)}
      #end
      #macro CON_DIS_WS10G()
      object{CON_DIS_WS_XX_G_GRND(10)}
      #end
      #macro CON_DIS_WS14G()
      object{CON_DIS_WS_XX_G_GRND(14)}
      #end
      #macro CON_DIS_WS16G()
      object{CON_DIS_WS_XX_G_GRND(16)}
      #end 

      As you can see, these lines describe a 6-pin, a 10-pin, a 14-pin and a 16-pin version of the above connector AND more importantly, they all just call another macro named CON_DIS_WS_XX_G_GRNDGRND with the number of desired pins passed to in brackets.

    3. Add the following lines to the file

      #macro CON_DIS_WS8G()
      object{CON_DIS_WS_XX_G_GRND(8)}
      #end 

    4. Now, of course, you need to add a respective mapping to to 3dusrpac.dat again:In 3dpac.dat you’ll find a line saying:

      ML6:0:0:0:0:0:0:0:0:0:0:0:0:0:180:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:CON_DIS_WS6G(:Wannenstecker 6Pin:Shrouded Header 6Pin 

      So, add a similar line for the 8-pin version to 3dusrpac.dat:

      ML8:0:0:0:0:0:0:0:0:0:0:0:0:0:180:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:CON_DIS_WS8G(:Wannenstecker 8Pin:Shrouded Header 8Pin 

    5. Render your board again and you should now see your 8-pin connector!

    Hint:
    This does not only work for connectors as used in this example. In fact, many of the Eagle3D parts, especially ICs are implemented as specific macros that then call a generic macro to which they pass the number of e.g. pins as a parameter. So you can easily add a similar part with fewer or more pins for example. There is no guarantee that this does always work as it depends on how the generic macro is implemented but fact is, in many cases it works!


    Example 2:

    On your board there is a completely exotic part, e.g. the Amber Wireless BlueNiceCom IV in the case of the board above
    Blue Coffee 2.2
    AND there is nothing even remotely similar to be found in the Eagle3D image library.

    Solution:
    In this case, think about living without this part being rendered on your board :) but if you’re really desperate to see this part on your board, there are two ways to go:

    1. You can manually write a povray macro to draw your part. This option receives a straight ‘zero’ though on the intuitivity scale and is extremely time consuming. I’d only recommend that for very simple parts. If you still wanna go there, have a look at this site here and the pages linked here.
    2. Design your component / part in Google SketchUp and have SU2POV export it to povray format which can then be included in your Eagle3D design. Don’t underestimate the time needed for this approach! But especially for more complex parts this is way easier than approach number one!

      When this idea came to my mind, I did a quick Google search and it turned out someone has had this idea before. So instead of writing detailed instructions on how to export SketchUp designs to povray and include them in Eagle3D, I’d like to point you to this tutorial which does a pretty good job in explaining the whole process.

      I’ve used this method to design the Amber BlueNiceCom IV mentioned above as well as a CR 2032 battery among others.
      Blue Coffee 2.3 Blue Coffee 1.3
      You can find these and other Eagle3D components I’ve done in Google SketchUp at Google’s 3D Warehouse here.

 

Finally, some eye candy… these are a few of my boards rendered with Eagle3D:

3 Comments

  1. Hi,

    This is a very nice example of how Eagle 3d works. I have not been able to get it working though. I tried a part that I drew a few weeks ago to no avail, and then I remembered this tutorial when I needed a CR2032 Battery holder. I tried following the tutorial using your Google sketch, but was unsuccessful. Is there any chance that you could post or mail me your .inc file for this part so I can see where I am going wrong?

    Thanks,
    Jeremy

  2. Thank you! I was getting all kinds of errors following a different tutorial. Yours was very concise and to the point.

    THANKS!!!

    Brian

  3. Hello Sincerely, please if you’ve got the files of 3D eagle and the libraries could please upload them to a server, I had them installed on my computer but I had to format the drive and lost files, homepage no longer works if you can help me thank you very much in advance.

Leave a Reply to Brian

You must be logged in to post a comment.