Eagle3D on a Mac when POVray won’t work…

So you just finished your first PCB in Eagle. Good job. Me too actually, and after a few days I came across something very cool. Eagle3D. Eagle3D takes your Eagle .brd file and renders it as a 3D image, so you get to see the board in a photorealstic way. (I think I’ve been saving up photorealistic to use in a post-1995 context. I really don’t think I’ve seen it used to describe anything since the box of Myst). So you download Eagle3D, you download POVray, you copy your include files over there, generate your .pov file, and you launch POVray in anticipation… and then it crashes.

The nerve…

So here’s the deal. POVray for the Mac is either being developed poorly, or more likely is simply not the center of the universe for it’s developers. On the POVray website they blame Apple for not properly keeping up the PPC emulator. I want to support these folks for their hard work, but seriously… we’ve been using all-intel Macs for 4 years now. Time to move on. At any rate, this problem occurs in a few machines, and it’s not quite clear which ones. The problem has something to do with preferences, and Intel Macs between 2006 and 2007 (of course, my Mac is an early 2008 model, but who’s counting?)

Because I couldn’t find any easy answers to getting POVray to run, I was pleased to have found a solution. Here are the steps needed to get your board rendered in 3D:

1. Download these things:

2. Install MegaPOV, and Eagle3D (if you haven’t already)

MegaPOV is a derivative of POVray, and it’s fortunately written in Cocoa and is a proper universal binary. Because it will run properly, we can use it to render the images Eagle3D turns out. MegaPOV is an easy click-and-drag to install. Just stick it in your Applications folder. For Eagle 3D, I recommend you move the folder into the EAGLE folder in your Applications directory. Good place to have it.

3. Copy over needed include files

In order to use MegaPOV for Eagle3D, we need to copy some include files from POVray . In the POVray folder, you’ll see a folder called includes. Rename this folder to “pov-includes” (or whatever you would like), and copy the folder into the MegaPOV folder.

4. Make changes to the Eagle3D UPL

In POVray, you can name variables starting with lowercase letters. MegaPOV is not as courteous in that respect, and so if you try to render an Eagle3D pov file, it’ll throw and error:

MegaPOV Error

expected 'unidentified declaration', environment found instead

It’s relatively easy to fix this. The variable named environment is the culprit, and we’ll need to change it in the ulp file in the Eagle 3D folder. As Eagle3D is a few years old, everyone is probably using the 3d41.ulp. If you’re not, you’ll need to change the file you’re using.

Find the following lines in the code:

46: "#if(environment=on)n"
1023: if(opt_amb==1) printf("n#declare environment = on;n");
1024: else printf("n#declare environment = off;n");

Change those lines to look like this (respectively):

46: "#if(Environment=on)n"
1023: if(opt_amb==1) printf("n#declare Environment = on;n");
1024: else printf("n#declare Environment = off;n");

That’s it, no other changes to be made in the code. You just need to capitalize the E in “Environment”!

5. Set additional include paths

We need some of the include files that are floating around here. In MegaPOV you can set two include paths. It provides a convenient open dialog. You need to select:

  • /Applications/EAGLE/eagle3d/povray/
  • /Applications/MegaPOV_C_UB/pov-include/

Settings for alternate paths

6. Make your board!

That’s all you need to do. From this point, you need to simply run the Eagle3D script in EAGLE, and it’ll generate your .pov. Open your .pov in MegaPOV, and it should render just fine.

My custom Arduino Prototyping board

22 comments
    • Hmm… I hadn’t really thought of it in terms of a “surprise”. But you’re right, where’s the excitement? On the other hand, I think it may help in terms of visually troubleshooting something. Footprints, placement, etc. In theory you shouldn’t run into these problems with proper schematics and layouts, but I like being able to see the (supposed) final product.

  1. Nice tutorial and great work.
    The final image is very nice, its good because you can use the 3D in presentations, to show your boss.
    Its even a kind of art. 😀

    Regards, Diego

  2. hi!

    thanks a lot for this help!
    there seems to be an error when i try to render my eagle pcb.
    i did all you mentioned above but this error comes out:

    File: /Applications/EAGLE/eagle3d/povray/ic.inc Line: 1039
    File Context (5 lines):
    }
    #end

    #if(logo_assigned < 0.5)
    #local label = text{ttf besch_font value 0.2,0 rotate
    Parse Error: Cannot open font file.
    Total Scene Processing Times
    Parse Time: 0 hours 0 minutes 0 seconds (0 seconds)
    Photon Time: 0 hours 0 minutes 0 seconds (0 seconds)
    Cloth Time: 0 hours 0 minutes 0 seconds (0 seconds)
    Mechsim Time: 0 hours 0 minutes 0 seconds (0 seconds)
    Render Time: 0 hours 0 minutes 0 seconds (0 seconds)
    Postpr. Time: 0 hours 0 minutes 0 seconds (0 seconds)
    Total Time: 0 hours 0 minutes 0 seconds (0 seconds)

    what can i do to fix this?
    thank you!

    • Hi Martin,

      I’m not deeply familiar with the inner workings of MegaPOV and POVRay, but from what I’ve searched, this appears to be an issue with Povray not being able open the font file -specifically that the file is most likely not a .ttf format, so povray doesn’t know how to read it. See if you can change the font and get it to work. That’s what I figure is the problem. Best of luck, let me know how you fare.

    • i fixed it!
      i just copied a missing font into the pov-include file.
      by the way how can i make rotative animations?
      thanks!

      • Hi Martin,

        I don’t know if there’s a way to make animations with the eagle3d plugin. I’d do an internet search to see if something like that is available. If not, at the very least you’ll have the povray script for the board. From there you should be able to create an animation with povray or megaPOV.

  3. @ martin
    I have the same problem that you had.
    which font did you copy in which pov-include file?
    tanks

  4. Thanks for the great post. I was able to get it working once I followed the advice that martin gave to copy the missing font into the pov-include folder.

    My Eagle board design rendered out in 3D quite well.

  5. Cannot seem to get this to work, not sure if Im missing something. Everytime I render a PCB all I get is an X Y Z gridwork grid. This is the message I get.

    Redirecting Options
    All Streams to console……….Off
    Debug Stream to console………On
    Fatal Stream to console………On
    Render Stream to console……..On
    Statistics Stream to console….On
    Warning Stream to console…….On
    Parsing Options
    Input file: /Applications/EAGLE-6.2.0/eagle3d/ulp/LM1875T Chip Amp Board.pov (compatible to version 3.61)
    Remove bounds……..On
    Split unions………On
    Library paths:
    /Applications/EAGLE-6.2.0/eagle3d/ulp/
    /Applications/EAGLE-6.2.0/eagle3d/povray
    /Applications/MegaPOV_C_UB/pov include
    Output Options
    Image resolution 320 by 240 (rows 1 to 240, columns 1 to 320).
    Graphic display……On (gamma: 1.8)
    Mosaic preview…….Off
    CPU usage histogram..Off
    Continued trace……Off
    Tracing Options
    Quality: 9
    Bounding boxes…….On Bounding threshold: 10
    Light Buffer………On
    Vista Buffer………On Draw Vista Buffer….On
    Antialiasing………On (Method 2, Threshold 0.300, Depth 3, Jitter 1.00)
    Clock value: 0.000 (Animation off)
    File: /Applications/MegaPOV_C_UB/pov include/glass_old.inc Line: 17
    Parse Warning: Due to changes in version 3.1, you must add interior {I_Glass} to all objects calling glass_old.inc
    textures and finishes…
    File: /Applications/EAGLE-6.2.0/eagle3d/povray/tools.inc Line: 53
    Parse Warning: Fallback font not found. Please specify the path to courbd.ttf in the ini-file
    File: /Applications/EAGLE-6.2.0/eagle3d/povray/tools.inc Line: 79
    Parse Warning: Font Courier not found. Fallback font used
    File: /Applications/EAGLE-6.2.0/eagle3d/povray/tools.inc Line: 83
    Parse Warning: Font Courier Bold not found. Fallback font used
    File: /Applications/EAGLE-6.2.0/eagle3d/povray/tools.inc Line: 87
    Parse Warning: Font Arial not found. Fallback font used
    File: /Applications/EAGLE-6.2.0/eagle3d/povray/tools.inc Line: 91
    Parse Warning: Font Arial Bold not found. Fallback font used
    File: /Applications/EAGLE-6.2.0/eagle3d/povray/tools.inc Line: 95
    Parse Warning: Font HandelGo not found. Fallback font arial used
    File: /Applications/EAGLE-6.2.0/eagle3d/povray/capwima.inc Line: 56
    Possible Parse Error: Could not find file ‘courbd.ttf’
    File: /Applications/EAGLE-6.2.0/eagle3d/povray/capwima.inc Line: 56
    File Context (5 lines):
    #if (Ra=2.54) //d=0.4mm
    cylinder{ 0.20 texture{col_silver}} // Draht rechts senkrecht
    cylinder{ 0.20 texture{col_silver}} // Draht links senkrecht
    text {ttf besch_font value 0.1, 0 scale
    Parse Error: Cannot open font file.
    Total Scene Processing Times
    Parse Time: 0 hours 0 minutes 0 seconds (0 seconds)
    Photon Time: 0 hours 0 minutes 0 seconds (0 seconds)
    Cloth Time: 0 hours 0 minutes 0 seconds (0 seconds)
    Mechsim Time: 0 hours 0 minutes 0 seconds (0 seconds)
    Render Time: 0 hours 0 minutes 0 seconds (0 seconds)
    Postpr. Time: 0 hours 0 minutes 0 seconds (0 seconds)
    Total Time: 0 hours 0 minutes 0 seconds (0 seconds)

    • Hi Paul,

      From your render output, it looks like POVRay is having a hard time finding the font. Specifically this line:

      Possible Parse Error: Could not find file ‘courbd.ttf’

      Is leading the parser down a series of “could not find this file”. and then towards the end:

      Parse Error: Cannot open font file.

      I don’t think MegaPov isn’t smart enough to go looking outside it’s own directories for fonts. You might try finding a copy of this font and sticking it in the path listed and see if that helps. Sadly POVRay is a bit of a finicky beast. Best of luck.

      • Sorry to ask again, when you say find the file and stick it in the path, could you please expand on that. 1. where do I find it 2. which path do I stick it in.

        • Don’t worry about asking questions, that’s how you learn 🙂

          So the error that it’s providing is saying that the font file (presumably that it’s relying upon to produce the render of the board) isn’t in a directory that it’s looking at. So we need to either get that file (the font file) into a directory that it’s looking at, or we need to set the directory it’s looking at to one where the font file is. I’m inclined to the do the prior because I don’t want POVRay set to look in a directory for a single file.

          I’m not sure which path you’d put it in, but if you look at these lines in your error:
          File: /Applications/EAGLE-6.2.0/eagle3d/povray/tools.inc Line: 53
          Parse Warning: Fallback font not found. Please specify the path to courbd.ttf in the ini-file

          You can see where it specifies what it’s doing. If you go into tools.inc you’ll probably find some sort of declaration about where to find the font file. All you need to do is stick the font file in that path. (you may have to do some detective work as path might be relative to the app, or include a variable – I can’t look at it at the moment so I wouldn’t be able to tell you)

          As for what font… “courbd.ttf” isn’t quite obvious. Whatever shall we do? 🙂
          If you don’t have courbd.ttf (which I just learned from our search is Courier New Bold), you can download a copy. If you *do* have it, search your Mac and find the file, and drag a copy into that include path we found above.

          I hope that helps.

          • I’ll do my best to help, but I don’t have your computer in front of me (I don’t even have Eagle installed ATM)

            1. Go find this file: /Applications/EAGLE-6.2.0/eagle3d/povray/tools.inc
            2. Go to line 53
            3. This should tell you something about where MegaPOV/POVray is looking for the font file.
            4. Put that font file in that location
            5. Try to render again
        • I understand your instructions, ive dragged the download font into line 53 rendered again and now I get this error

          File: /Applications/EAGLE-6.2.0/eagle3d/povray/tools.inc Line: 53
          File Context (5 lines):
          //Check the availability of the fall back font. If not available throw an error.
          #if(file_exists(global_fontfile_fallback)=0)
          /
          Parse Error: Expected ‘object or directive’, / found instead

          • Paul,
            The font file itself needs to be in the directory listed on line 53. Not just dragged on to the config file. What (I think) happened is that you dragged the font onto the config, it added in a “/” (as a file path) and when the interpreter got to that line, it didn’t know what to do with it, because a single forward slash doesn’t mean anything to the interpreter. That’s why you’re seeing:
            Parse Error: Expected ‘object or directive’, / found instead

            It found the /

  6. Aaron, thanks for you help. I followed all you download instructions. What I cant understand is this. If I followed you instructions to the letter which I did three times, why am I getting errors in the first place. By the way Im not blaming you I just dont understand. Everytime I fix one error I get another in the end after fixing 15 errors I just gave up and deleted megapov and povray and eagle 3d to much effort to get it working.

    • Hi Paul, I’m sorry you didn’t have success getting it to work. The instructions I offer here may not work for a variety of reasons. This post is two and half years old – I’m not sure is MegaPOV or Eagle3D haven’t been updated or changed, or quite possibly if something has changed in OS X that causes different issues. I found this particular solution over the course of a few hours trying to understand what the errors were and how they might be solved. Again, sorry it didn’t work for you. If you do find a solution to your particular problem, I’d love to know what you find.

  7. Aaron,
    I thought Id get in touch managed to solve the problem took a lot of work. But my issue seems to be a lot of missing files that need to be in the ULP file of eagle 3d. I had to put in all the files ending in inc. I had to download all the required fonts and also put those into the ULP file. Once I did this it rendered perflectly. Except one thing which Im hoping someone can help with.

    I used a WIMA capacitor for what should of been an ELKO and I understand you can go ing toe render file and change it but I can not for the life of me figure out what im suppose to put in.

    The line I need to replace is this one
    #ifndef(pack_C3) #declare global_pack_C3=yes; object {CAP_DIS_WIMA_5_045_072_095(“100uf”,)translate rotaterotate rotate translate}#end //WIMA-Capacitor Grid 5.08 (capacitator-wima.lib) C3 100uf E5-8,5

    The capacitor I need is listed under the 3d model as.

    CAP_DIS_ELKO_2MM_5MM

Comments are closed.