Saturday, August 15, 2009

How to make 3D image using Eagle3D and POV-Ray

Download the Eagle3D software and Install it.
Open your board file in Eagle. Click on ‘ULP’ icon: A new window will open asking for a ‘.ulp’ file. Browse into your Eagle3D directory (where you installed it) and select the file '3d41.ulp'. Now select the language you want, and then browse for the output file.
Make sure your PCB layout contain ‘dimension’ else you will get en error message:


You can do this by clicking on ‘wire’ icon; select the dimension from drop down list (20) and draw a border across your layout.


If every thing goes right then a new window will pop up:


You can change camera angle, lights, colors etc. For now, just click on ‘create POV-File and Exit’ button. After some seconds it will ask various questions about your board components answer as best as you can.

Now you will have a ‘.pov’ file. Download and Install the 32-bit version POV-Ray software.Click on the ‘Open’ file icon, and locate your .pov file created in the previous step. We need to point POV-Ray to the ‘.inc’ files for Eagle3D. These files define the 3D electronics components, to do this:
Click Tools => Edit master POVRAY.INI

A notepad file will open. At the bottom of it, add this line:

Library_Path="C:\Program Files\Eagle\ulp\Eagle3D\povray"

Make sure the directory points to where you installed Eagle3D. Now save and close the file. In POV-Ray, click the ‘Ini’ icon and select an image size from the drop down list.


Now push the ‘Render’ button. Error messages will pop-up. Just push OK and ignore it. It won't happen again.

If you did everything right, an image should appear.


Not all components have shown up on the board. This is where it gets tricky and so I'll do my best to help you out.

  • First, click the ‘Open’ file button in POV-Ray. Locate and open the file ‘user.inc’ in the Eagle3D\povray folder.
  • Next, click Open again, and change Files of type: to All Files (*.*). Locate and open the file ‘3dusrpac.dat’ in your Eagle3D folder.
By default, both of the files should be blank.

  • In the file 3dusrpac.dat, add this line:
PACKAGE_NAME:0:1: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:MACRO_NAME(::

To find the PACKAGE_NAME, go back to your board file, click on ‘info’ icon, and then click on a component that is missing in the 3D image.


  • Replace PACKAGE_NAME with the Package value. In this case it is ‘HSIP17-P-2.00’.
  • Next, you need to find a MACRO_NAME to match your missing part as closely as possible. To do this download the Eagle3D image library and unzip it into a folder.
Let’s say you select ‘BL_1×17’ which looks something like this:

  • Now in POV-Ray, go into your Eagle3D\povray and locate the file ‘connector.inc’ because you needed a connector. If you needed a capacitor instead, you would use ‘capacitor.inc’. Etc.
After searching the part name you will find this:
#macro BL_1X17()
object{BL_GRND(17,1)}
#end

  • Copy this code exactly and paste it in the ‘user.inc’ file. And add the word ‘value’ in the parenthesis and the union{} like this:
#macro BL_1X17(value)
union{
object{BL_GRND(17,1)}
}
#end

  • Now go back to the 3dusrpac.dat and replace the package name and macro-name with HSIP17-P-2.00 and BL_1×17 respectively.
  • Now recreate the .pov file, and render your image again. If you did everything right, your new component should appear.

you can increase the image size for better resolution.

3 comments:

  1. Hi Malik, thanks for your nice tutorial. it's great. I got a coin battery on my PCB board. I didn's see any battery .png file in the "Eagle3D image library" folder. Do you have a battery image library on hand please?
    Thanks. my email address is cooper.zp@gmail.com

    ReplyDelete
  2. No. Still there are lot of images missing in eagle 3D image library. I hope soon they will update this library.
    Regards.

    ReplyDelete
  3. This is the excellent tutorial, taught me the relation between package and model macro.
    Thank you very much.

    ReplyDelete