pcb2blender – Move your pcb files to 3D with Blender


I have been working on a tool for a while, which converts your pcb design files to Blender 3D models and allows you to render fancy images. Blender is a free and awesome 3D design tool. pcb2blender only supports Eagle files for now but adding support for more tools won’t be an issue.

Above image is just a very ugly example you can create with pcb2blender. Blender is a very capable tool. Once you know what you are doing you will be able to create quite realistic renders. And I aim to make this completely automated for you.

So how pcb2blender works? Currently, it’s implemented as a python script which you call inside Blender. When you call Blender with below command, after a few minutes of magic your 3D model should be ready.

>> blender -P eagle2blender.py -- boardfile.brd

pcb2blender will read you pcb file, create outline of board and place components from it’s model library. And your 3D model is ready. Now you can edit your model any way you want with Blender’s tools and create very nice renders.

You can find the code at ย https://bitbucket.org/hyOzd/pcb2blender. Since it’s under development, it’s much likely you will have problems. And don’t expect much from it since model library is almost empty. I’m working on it.

At the moment, I’m working on the structure of model library. Because once you start to create models, it’s hard to update them all in case of a change. It’s important to set it right at the beginning. So I need to be careful.

If you can make the code work or just can’t, please let me know. Remember to read README file. And use a proper OS, such as linux ; ) .


134 responses to “pcb2blender – Move your pcb files to 3D with Blender”

  1. Hasan, Ive been working on something similar as this. My approach has been to import an IDF (Intermediate Data File) format which is not tied specifically to Eagle. I have also written a program in Eagle to generate the IDF file but most PCB tools will allow you to export to IDF.

    Let me know if you would be interested in collaborating. Your much further along than myself. Ive worked with others on tools that use these IDF files to generate 3D models in CAD packages like Proe. Ive also built as part of that the library management component. What I had planned to do for my IDF import was to make it so that the python script pulls the needed components from a web based library. I was considering giving the Blender plugin away for free but then charging users to improve the Blender model by paying for a license to use my library components.

    Thanks
    Marc

    • Marc, I’m happy to see someone is interested in my work! Honestly I haven’t looked into this since this post. But recently I have been thinking to start again.

      My plan was also similar to yours. To support more tools, not just Eagle, I have been thinking to create a simple file format myself. First convert PCB file to this format, than convert to 3D model. So that if anyone writes a converter for let’s say KiCad, they can use my tool to create PCB model. But I didn’t know anything about IDF. Is this a general term? Or a file format that is common among CAD tools with a specification? Where can I find more information on this?

      Idea of a web based repository for models sound nice. Maybe user could also contribute to repository? I think “matching” information, which PCB library component corresponds to which model is the hardest part to maintain. Easiest method would be user feedback.

      I don’t know if you have tried my script but what it does can be summarized as:
      1) Create the board model with drills, create and apply textures.
      2) Place component models from library

      What’s your progress on the Blender side, model generation etc?

  2. Hi hyOzderya, (openSUSE 13.2 With Eagle 6.4)
    Amazing work !!!
    But I see only the PCB with no track and no components may be that this is due to me, I not having a clue on where to place the python files. I just unpacked the zip file and run the command “blender -P eagle2blender.py — Jupiter1.brd”.
    Blender coupled with Eagle is perfect for this purpose and I find it very useful!!! also saw the large amount of Eagle’s users

    The components of my PCBs, are all in SMD technology, is for that, that I can not see them, are still missing that libraries ?
    Do you think that is feasible run the commandis directly by a ULP script, from Eagle? …those libraries are still missing? Where I’m doing wrong ?
    You’re still working on?

    Congratulations for the great work you’ve done !! greetings and thanks

    • Hi Ivan,

      You don’t have to place python files in any particular directory. You can put them anywhere you want. Just make sure they are accessible by Blender.

      You don’t see any components because 3D model library only includes a handful. See “models/” folder. You might as well say it’s empty. But still, tool should be able to create a usable model of the PCB (only the board, no components). Did you try to have a render? By default Blender won’t show you any texture on the model (tracks are shown as texture, they are not a part of the 3d model). You either should run a render, or change the display settings to show the textures on the model.

      Now, if you want to add your own models to the model library, it’s not that hard. Just investigate the files in the models folder. Also remember to add your model info to “models/index.xml” file. If you investigate the xml file, you will see that you can add parameters to the models to adjust their placement to board.

      Tool only supports models as Blender files. I want to remind you that blender can import STL files. And you can find models for the most electronic components as STL file (Actually I misremembered. Popular format is STEP. And it’s not supported by blender ๐Ÿ™ . But you can convert STEP file to STL (you can use FreeCAD) and then import that to Blender. So there is a way.)

      About running command from ULP: since there is only one command to be run, I think writing an ULP for this is overkill.

      If you need any other help, just ask.

  3. Hi hyOzderya
    From Linux all works fine but i’d like to do the same from windows7
    How can I run this script from windows ?
    I’ve tryed something like this:

    echo %PATH%
    set PATH=%PATH%;C:\Program Files\Blender Foundation\Blender\
    cd C:\Users\Ivan\Eagle\3D\hyOzd-pcb2blender-ff88f98e984c\
    blender -P eagle2blender.py — boardfile.brd

    but nothing to do, why? where am I doing wrong ?

    greetings ๐Ÿ™‚

    • Hi Ivan,

      Sorry for the late response. It looks like you are trying to run pcb2blender in windows. But it needs some work before it actually works.

      Can you tell me what error message are you getting in the command window?

      I have tried the command you run with example file inside the pcb2blender/etc directory. That command is okay. If you want to see something until I fix the script, try commenting these lines in “eagle2blender.py”:

      # makeTextures(file)
      # bu.applyTextures()

      This way script will skip the texture steps. You won’t see the tracks and silk screen, but you should see everything else (board outline, drills, components).

      • Ivan,

        I think I got a temporary fix for windows. Please download “windows-compatibility” branch from here https://bitbucket.org/hyOzd/pcb2blender/downloads . This is a direct link to zip file: https://bitbucket.org/hyOzd/pcb2blender/get/windows-compatibility.zip .

        But there are 2 more things you should take care of. Eagle and imagemagic should be in your path as well.

        When installed imagemagic adds itself to PATH variable automatically. You should be ok by just installing it, no extra steps required. Bu still, make sure when you run `convert` in command window, imagemagic’s convert utility is called. There may be a conflict with a Windows utility.

        About eagle; you should add the directory that eagle.exe resides in, to your PATH variable, just like you did with blender.

        If you have any problems, please let me know!

  4. Thank you very much, here’s the output

    ๐Ÿ™
    It does not work

    ###################
    # add eagle path #
    ###################
    C:\Users\Ivan\Eagle\3D>set path=%path%;C:\Users\Ivan\Eagle\bin
    C:\Users\Ivan\Eagle\3D>echo %path%

    C:\Program Files\ImageMagick-6.9.1-Q16;C:\Program Files\NVIDIA Corporation\PhysX\Common;C:\Windows\s
    ystem32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program F
    iles\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Int
    el\WirelessCommon\;C:\Program Files\Diskeeper Corporation\ExpressCache\;C:\Program Files\Blender Fou
    ndation\Blender\;C:\Users\Ivan\Eagle\bin

    ######################
    # imagemagig testing #
    ######################
    C:\Users\Ivan\Eagle\3D>convert “test.png” “pippo.jpg”

    C:\Users\Ivan\Eagle\3D>dir
    14/05/2015 17:30 .
    14/05/2015 17:30 ..
    10/05/2015 23:41 Eagle2Blender
    09/04/2015 23:28 FreeCad
    10/05/2015 23:45 hyOzd-pcb2blender-a9770c883733
    14/05/2015 17:23 hyOzd-pcb2blender-ff88f98e984c
    14/05/2015 17:01 19.519.949 ImageMagick-6.9.1-2-Q16-x86-dll.exe
    14/05/2015 17:30 60.960 pippo.jpg
    26/04/2015 18:01 260.186 test.png
    6 File 40.427.720 byte
    7 Directory 54.653.382.656 byte disponibili

    ##################
    # script testing #
    ##################
    C:\Users\Ivan\Eagle\3D>cd hyOzd-pcb2blender-ff88f98e984c

    C:\Users\Ivan\Eagle\3D\hyOzd-pcb2blender-ff88f98e984c>blender -P eagle2blender.py – example1.brd
    found bundled python: C:\Program Files\Blender Foundation\Blender\2.71\python
    Traceback (most recent call last):
    File “”, line 1, in
    File “”, line 104, in
    File “”, line 15, in run
    ValueError: ‘–‘ is not in list
    unknown argument, loading as file: –
    Error: Cannot read file ‘C:\Users\Ivan\Eagle\3D\hyOzd-pcb2blender-ff88f98e984c\-‘: No such file or d
    irectory
    Error: Cannot read file ‘C:\Users\Ivan\Eagle\3D\hyOzd-pcb2blender-ff88f98e984c\example1.brd’: No suc
    h file or directory

  5. I also tried to comment on the two lines of code in the old script

    ##############################
    # # makeTextures(file)
    # # bu.applyTextures()
    ##############################
    hereโ€™s the output:

    C:\Users\Ivan\Eagle\3D\Eagle2Blender>blender -P eagle2blender.py — C:\Users\Ivan\Eagle\3D\Eagle2Ble
    nder\boardfile.brd
    found bundled python: C:\Program Files\Blender Foundation\Blender\2.71\python
    Traceback (most recent call last):
    File “”, line 1, in
    File “”, line 104, in
    File “”, line 25, in run
    File “C:\Program Files\Blender Foundation\Blender\2.71\python\lib\xml\etree\ElementTree.py”, line
    1187, in parse
    tree.parse(source, parser)
    File “C:\Program Files\Blender Foundation\Blender\2.71\python\lib\xml\etree\ElementTree.py”, line
    598, in parse
    self._root = parser._parse_whole(source)
    xml.etree.ElementTree.ParseError: junk after document element: line 24319, column 0

    • Hi Ivan,

      In your previous comment it looks like you used only 1 dash (-) character before the filename. There must be 2 (-- filename).

      Now, looking at your latter post, it looks like there is a problem with the xml parser. Can you tell me which version of eagle you are using? You must be using at least v6. Because that’s the version eagle switched to XML file format. eagle2blender won’t work with the files created with earlier versions of eagle.

  6. I have now moved from example1 from etc to
    C:\Users\Ivan\Eagle\3D\hyOzd-pcb2blender-ff88f98e984c
    and if I give the command with double dash char:

    C:\Users\Ivan\Eagle\3D\hyOzd-pcb2blender-ff88f98e984c> blender -P eagle2blender.py — example1.brd
    the PCB now is loaded correctly, ๐Ÿ™‚

    but if I try to load a different file.brd does not work:
    C:\Users\Ivan\Eagle\3D\hyOzd-pcb2blender-ff88f98e984c> blender -P eagle2blender.py — pippo.brd

    • What doesn’t work? Are you getting the same as above XML parser error? I’m afraid I cannot help you without seeing your file.

  7. when I get the pcb of example1…
    for a moment I see a window appear probably with some options to select, then disappears…
    is normal that ir closes immediately ?

    • Yes, that’s normal. You should be seeing eagle’s window. Script uses eagle to generate textures.

  8. I also noticed that I get the following files from 9kbytes

    14/05/2015 20:03 8.243 bottomcopper.png
    14/05/2015 20:03 8.243 bottomsilk.png
    14/05/2015 20:03 8.243 bottomstop.png
    14/05/2015 20:03 8.243 dimension.png
    14/05/2015 20:03 8.243 topcopper.png
    14/05/2015 20:03 8.243 topsilk.png
    14/05/2015 20:03 8.243 topstop.png

    …but if I open them they are all white !

    • Well, that’s interesting ๐Ÿ™‚ . Did you get my e-mail? You can send the file to my e-mail. It’s “hy at ozderya.net”.

  9. it is possible that the link you gave me is refer to an old file ?

    hyOzd-pcb2blender-ff88f98e984c

    …it seem to have a name already used

  10. I can send you the file you want but I did not understand what file you need
    ….I can also try running the script from openSUSE

  11. I sent the “brd”
    …sorry but yesterday I fell asleep I was tired from overwork

    ciaoooo

  12. Here it is the output from openSUSE
    the PCB now is loaded ๐Ÿ™‚
    but the textures (8Kbytes) are all blank

    ivan@UltrabookSamsung:/run/media/ivan/DataDisk/Eagle/3D/hyOzd-pcb2blender-ff88f98e984c> blender -P eagle2blender.py — /run/media/ivan/DataDisk/Eagle/3D/hyOzd-pcb2blender-ff88f98e984c/Jupiter_,microheader_test.brd
    Color management: using fallback mode for management
    BLF_lang_init: ‘locale’ data path for translations not found, continuing
    Traceback (most recent call last):
    File “/run/media/ivan/DataDisk/Eagle/3D/hyOzd-pcb2blender-ff88f98e984c/eagle2blender.py”, line 104, in
    run()
    File “/run/media/ivan/DataDisk/Eagle/3D/hyOzd-pcb2blender-ff88f98e984c/eagle2blender.py”, line 96, in run
    makeTextures(file)
    File “/run/media/ivan/DataDisk/Eagle/3D/hyOzd-pcb2blender-ff88f98e984c/eagleutils.py”, line 42, in makeTextures
    eaglepath = getEagle()
    File “/run/media/ivan/DataDisk/Eagle/3D/hyOzd-pcb2blender-ff88f98e984c/eagleutils.py”, line 21, in getEagle
    raise FileNotFoundError(1,”Can’t find Eagle executable path”)
    FileNotFoundError: [Errno 1] Can’t find Eagle executable path

    • Well it’s obvious. Script cannot find eagle. You should add eagle directory to your PATH variable, similar to what you did in windows. By the way did you try the fix I’ve sent you over e-mail?

  13. I do not know if it’s good like that,
    if so l had already done ๐Ÿ™

    ###################
    # add eagle path #
    ###################
    C:\Users\Ivan\Eagle\3D>set path=%path%;C:\Users\Ivan\Eagle\bin
    C:\Users\Ivan\Eagle\3D>echo %path%

    C:\Program Files\ImageMagick-6.9.1-Q16;C:\Program Files\NVIDIA Corporation\PhysX\Common;C:\Windows\s
    ystem32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program F
    iles\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Int
    el\WirelessCommon\;C:\Program Files\Diskeeper Corporation\ExpressCache\;C:\Program Files\Blender Fou
    ndation\Blender\;C:\Users\Ivan\Eagle\bin

    • I’m confused. I was replying to your above message, which you were using linux. Now you are responding with windows error message..?

  14. I’m trying to look for “cropsize” but it can not find
    hyOzd-pcb2blender-ff88f98e984 ….eagle2blender
    is correct?

  15. After the “cropsize” fix

    ***************
    Example1 It works but without texture
    ***************

    C:\Users\Ivan>cd C:\Users\Ivan\Eagle\3D\hyOzd-pcb2blender-ff88f98e984c

    C:\Users\Ivan\Eagle\3D\hyOzd-pcb2blender-ff88f98e984c>blender -P eagle2blender.py — example1.brd
    found bundled python: C:\Program Files\Blender Foundation\Blender\2.71\python
    Parametro non valido – -format
    Traceback (most recent call last):
    File “”, line 1, in
    File “”, line 104, in
    File “”, line 96, in run
    File “C:\Users\Ivan\Eagle\3D\hyOzd-pcb2blender-ff88f98e984c\eagleutils.py”, line 82, in makeTextur
    es
    cropsize = sp.check_output(imcommand.split(),universal_newlines=True)
    File “C:\Program Files\Blender Foundation\Blender\2.71\python\lib\subprocess.py”, line 618, in che
    ck_output
    raise CalledProcessError(retcode, process.args, output=output)
    subprocess.CalledProcessError: Command ‘[‘convert’, ‘-trim’, ‘-format’, “‘%wx%h%O’”, ‘dimension.png’
    , ‘info:’]’ returned non-zero exit status 4

    Blender quit

    ***************
    test.brd Dont work !!!
    ***************

    C:\Users\Ivan\Eagle\3D\hyOzd-pcb2blender-ff88f98e984c>blender -P eagle2blender.py — C:\Users\Ivan\E
    agle\3D\hyOzd-pcb2blender-ff88f98e984c\test.brd
    found bundled python: C:\Program Files\Blender Foundation\Blender\2.71\python
    Traceback (most recent call last):
    File “”, line 1, in
    File “”, line 104, in
    File “”, line 25, in run
    File “C:\Program Files\Blender Foundation\Blender\2.71\python\lib\xml\etree\ElementTree.py”, line
    1187, in parse
    tree.parse(source, parser)
    File “C:\Program Files\Blender Foundation\Blender\2.71\python\lib\xml\etree\ElementTree.py”, line
    598, in parse
    self._root = parser._parse_whole(source)
    xml.etree.ElementTree.ParseError: junk after document element: line 24319, column 0

    • You must use “windows-compatibility” branch in windows. Otherwise textures won’t work. There is a conflict with a windows utility called “convert”. That’s why you are getting this line in the error message:

      subprocess.CalledProcessError: Command โ€˜['convert', '-trim', '-format', "'%wx%h%O'", 'dimension.png', 'info:']โ€˜ returned non-zero exit status 4

      Please download windows-compatibility branch from here: https://bitbucket.org/hyOzd/pcb2blender/get/windows-compatibility.zip

      About test.brd not working: this one looks like there is a problem with the file.

  16. ***************************
    example1 WOW AMAZING !!!
    *************************** ๐Ÿ˜€

    C:\Users\Ivan\Eagle\3D\hyOzd-pcb2blender-9a0ec55776db>blender -P eagle2blender.py –
    found bundled python: C:\Program Files\Blender Foundation\Blender\2.71\python
    convert.exe: geometry does not contain image `dimension.png’ @ warning/attribute.c/
    ox/247.
    convert.exe: geometry does not contain image `topsilk.png’ @ warning/transform.c/Cr
    convert.exe: geometry does not contain image `bottomsilk.png’ @ warning/transform.c
    convert.exe: geometry does not contain image `topcopper.png’ @ warning/transform.c/
    convert.exe: geometry does not contain image `bottomcopper.png’ @ warning/transform

    convert.exe: geometry does not contain image `topstop.png’ @ warning/transform.c/Cr
    convert.exe: geometry does not contain image `bottomstop.png’ @ warning/transform.c
    1 file copiati.
    1 file copiati.

    Blender quit

    ***************************
    test still not work ๐Ÿ™
    ***************************

    C:\Users\Ivan\Eagle\3D\hyOzd-pcb2blender-9a0ec55776db>blender -P eagle2blender.py –
    found bundled python: C:\Program Files\Blender Foundation\Blender\2.71\python
    Traceback (most recent call last):
    File “”, line 1, in
    File “”, line 104, in
    File “”, line 25, in run
    File “C:\Program Files\Blender Foundation\Blender\2.71\python\lib\xml\etree\Eleme
    1187, in parse
    tree.parse(source, parser)
    File “C:\Program Files\Blender Foundation\Blender\2.71\python\lib\xml\etree\Eleme
    598, in parse
    self._root = parser._parse_whole(source)
    xml.etree.ElementTree.ParseError: junk after document element: line 24319, column 0

    • You shouldn’t be seeing these messages:

      convert.exe: geometry does not contain image `dimension.pngโ€™ @ warning/attribute.c/
      ox/247

      Are you sure everything works? Do you see the silk screen?

      Can you send me the “test.brd” file?

      Also can you try using a newer version of eagle? Free version should be enough for this.

  17. no i can see
    colored red pcb
    components
    and drills

    but no pads, no traces and no silk print

    • So you are still having problem with the textures. I have never tried pcb2blender with eagle 6.4, so this might be the problem. Can you try a newer version?

  18. C:\Users\Ivan\Eagle\3D\hyOzd-pcb2blender-9a0ec55776db>blender -P eagle2blender.py — example1.brd
    found bundled python: C:\Program Files\Blender Foundation\Blender\2.71\python
    convert.exe: geometry does not contain image `dimension.png’ @ warning/attribute.c/GetImageBoundingB
    ox/247.
    convert.exe: geometry does not contain image `topsilk.png’ @ warning/transform.c/CropImage/666.
    convert.exe: geometry does not contain image `bottomsilk.png’ @ warning/transform.c/CropImage/666.
    convert.exe: geometry does not contain image `topcopper.png’ @ warning/transform.c/CropImage/666.
    convert.exe: geometry does not contain image `bottomcopper.png’ @ warning/transform.c/CropImage/666.

    convert.exe: geometry does not contain image `topstop.png’ @ warning/transform.c/CropImage/666.
    convert.exe: geometry does not contain image `bottomstop.png’ @ warning/transform.c/CropImage/666.
    1 file copiati.
    1 file copiati.
    Saved: C:\tmp001.png
    Saved: C:\tmp002.png
    Saved: C:\tmp003.png
    Saved: C:\tmp004.png
    Saved: C:\tmp005.png
    Saved: C:\tmp006.png
    Saved: C:\tmp007.png
    Saved: C:\tmp008.png
    Saved: C:\tmp009.png
    Saved: C:\tmp010.png
    Saved: C:\tmp011.png
    Saved: C:\tmp012.png
    Saved: C:\tmp013.png
    Saved: C:\tmp014.png
    Saved: C:\tmp015.png
    Saved: C:\tmp016.png
    Saved: C:\tmp017.png
    Saved: C:\tmp018.png
    Saved: C:\tmp019.png
    Saved: C:\tmp020.png
    Saved: C:\tmp021.png
    Saved: C:\tmp022.png

  19. Well I checked the file you sent me; “test.brd”. This is the ending of the file:

    ....
    </note>
    </compatibility>
    </eagle>
    found bundled python: C:\Program Files\Blender Foundation\Blender\2.71\python

    Blender quit

    Obviously it’s not valid XML. My guess is you accidentally run some command that modified the file. You can try removing everything after </eagle> .

  20. shit !!! (Eagle 7.2)
    I do not understand how it happened
    copied the file again test and now I can see:
    pcb red with lots of holes holes
    Oh well I’ll have to create libraries (strange that there are basic components of example1)

    However it is missing textrue track the pads and silk

    but already I’m happy so

    I love it really compliments ๐Ÿ˜€

  21. Amazing i got now the components just by editing the index.xml file


    …to avoid editing each time “index.xml”
    Do you think it’s possible to associate ln automatic, board’s library package “rcl,SmartPrj or other” and its case for example R0603 ?

  22. About the textures
    …I tried to run the script with the environment variable that points to the bin “eagle-win-7.2.0” but in this case the textures do not load

  23. Nothing to do and do not know why,
    I also tried to replace with your own textures and noticed that are not mounted and not overwritten. They remain as they are

  24. Now I’m trying to put some order in eagle’s libraries to be able to have more possible components by adding its STL libraries …for now I’ve added lqfp144

    • I have a suggestion for you. Kicad project has lots of 3d models in its library. They are in WRL format. My script doesn’t support WRL. But you can import WRL files to blender and create blender models from them. This guy also has a huge library of 3d models: http://smisioto.no-ip.org/elettronica/kicad/kicad-en.htm . They are also in WRL format. It requires some work, but better than nothing.

  25. I did not like how they were organized libraries of my project so I did some changes:
    1ยฐ- I created a library only ciamata “basics” and in which
    I put the following components:
    R0201, R0402, R0603, R0805, R1206,
    R0201R, R0402R, R0603R, R0805R, R1206R, (rounded pads)
    C0201, C0402, C0603, C0805, C1206,
    LQFP144

    2ยฐ- I replaced the package of test.brd with new packages of
    library “basics” just created

    3ยฐ- I changed “index.xml” with:

    …..

    4ยฐ- I modified the object names of the file blender “basics” in:
    from R0603 in res0603
    res0805 in R0805
    cap0603 in C0603
    cap0805 in C0805
    adding new objects like R0603R etc …

    credo di aver fatto modifiche corrette o no ?
    il fatto che ora non trovo piรน i componenti ๐Ÿ™

    ====================================================================
    riguardo le textrues e l’output dello script eccolo qui_
    found boundled python: c:\Program Files\Blender Foundation\Blender
    1 file copiati.
    1 file copiati,
    Traceback :
    File “”, line 1, in
    File “”, line 104, in
    File “”, line 101, in
    File “C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows\blenderutils.py”, line 159, in placeMode1 obj = bpy.context.selected_objects[0]
    IndexError:list index out of range

    ===============================================================
    about the last error message, it refers to the file “index.xml” I’ve changed?

    I hope I have transcribed the output properly because I could not do a copy and paste

  26. found bundled python: C:\Program Files\Blender Foundation\Blender\2.71\python
    1 file copiati.
    1 file copiati.
    Traceback (most recent call last):
    File “”, line 1, in
    File “”, line 104, in
    File “”, line 101, in run
    File “C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows\blenderutils.py”, line 159, in placeModel
    obj = bpy.context.selected_objects[0]
    IndexError: list index out of range

    • Hi Ivan,

      This probably happens because there is a problem with the model blender file or “index.xml” file. Are you sure the object names are correct?

      To find out at which file and which model problem occurs; you can add this line into file blenderutils.py right before the line numbered 159.

      print(file + " " + model)

  27. Hi Hasan ๐Ÿ˜€
    ok i get it
    some lines in the file index point to objects not yet included in basics.blender
    the script crashes after trying to load cap0402

    “C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows /models/basics.blend cap0402”

    after that I removed lines refer to C0402 from index.xml i get
    and all components including the LQFP appear ๐Ÿ™‚
    The strange thing is that I do not find in cap0402 “basic.blender”
    found bundled python: C:\Program Files\Blender Foundation\Blender

    \2.71\python
    1 file copiati.
    1 file copiati.
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/lqfp144_0.5.stl lqfp144_0.5.stl
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0603
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend C0603
    Traceback (most recent call last):
    File “”, line 1, in
    File “”, line 104, in
    File “”, line 101, in run
    File “C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows\blenderutils.py”, line 160, in placeModel
    obj = bpy.context.selected_objects[0]
    IndexError: list index out of range

    • It looks like there is no object named “C0603” in file “basics.blend”. You may have a typo in index.xml file or blender file. Please check them.

  28. it is possible to prevent the interruption of the script in these types of cases?
    and even by printing to video components not recognized?

    • Interruption is hard to implement. But I will make sure an appropriate error message is printed.

  29. I mean, so that if an object is not found, the script skip to next object ….. (cap0402 has blocked the rest of the components and after the elimination of its reference in “index.xml” everything that followed goes in place )

  30. Hi Hasan
    Now from blender I gave “render image” suddenly appeared the textrue silk screen traces pads c
    omponents all perfect though to be honest the quality of the texture is very bad …. but I was so idiot? : D …. all this mess and it was enough to give a simple “render”?

    but at this point you would you explain where you pulled out the pictures “png” you sent me? eagle2blender folder does not contain any image …. I thought the script would generate the images and instead I have no picture but the textures are still applied in blender

  31. SUPER Hasan your’ a genious ๐Ÿ˜€

    Blender is fantastic
    “Render image” quality is no good. But with your tip all go fine

    Amazing good Job !!!!

    as soon as i’ll sen you all file ๐Ÿ˜€

    but where are the images png ….. I have to save it from blender? the folder of the script contains no images png

    • PNG files (topcopper.png, bottomcopper.png, topsilk.png … etc) should be created in the same directory as your board file.

  32. The folder of the script contains no images png
    Is possible ?

    from blender’s รฌimage editor i can browser all layers image but i’m sure the folder contains no images

    • Where is your pcb file (.brd)? Textures should be in that directory. Not scripts directory.

  33. found bundled python: C:\Program Files\Blender Foundation\Blender\2.71\python
    1 file copiati.
    1 file copiati.
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/lqfp144_0.5.stl lqfp144_0.5.stl
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0402
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend R0603
    C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows/models/basics.blend C0603
    Traceback (most recent call last):
    File “”, line 1, in
    File “”, line 104, in
    File “”, line 101, in run
    File “C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows\blenderutils.py”, line 160, in placeModel
    obj = bpy.context.selected_objects[0]
    IndexError: list index out of range
    Saved: C:\tmp001.png Time: 00:07.57 (Saving: 00:00.24)

    Saved: C:\tmp002.png Time: 00:08.20 (Saving: 00:00.18)

    Saved: C:\tmp003.png Time: 00:10.50 (Saving: 00:00.21)

    Saved: C:\tmp004.png Time: 00:10.53 (Saving: 00:00.19)

    Saved: C:\tmp005.png Time: 00:10.81 (Saving: 00:00.19)

    Saved: C:\tmp006.png Time: 00:10.67 (Saving: 00:00.20)

    Saved: C:\tmp007.png Time: 00:10.58 (Saving: 00:00.19)

    Saved: C:\tmp008.png Time: 00:10.65 (Saving: 00:00.22)

    Saved: C:\tmp009.png Time: 00:10.73 (Saving: 00:00.21)

    Saved: C:\tmp010.png Time: 00:10.76 (Saving: 00:00.20)

    Saved: C:\tmp011.png Time: 00:10.49 (Saving: 00:00.19)

    Saved: C:\tmp012.png Time: 00:10.41 (Saving: 00:00.18)

    Saved: C:\tmp013.png Time: 00:10.76 (Saving: 00:00.19)

    Saved: C:\tmp014.png Time: 00:10.69 (Saving: 00:00.18)

    Saved: C:\tmp015.png Time: 00:10.85 (Saving: 00:00.17)

    Saved: C:\tmp016.png Time: 00:10.84 (Saving: 00:00.18)

    Saved: C:\tmp017.png Time: 00:11.06 (Saving: 00:00.21)

    Saved: C:\tmp018.png Time: 00:11.23 (Saving: 00:00.19)

    Saved: C:\tmp019.png Time: 00:10.67 (Saving: 00:00.20)

    Saved: C:\tmp020.png Time: 00:10.68 (Saving: 00:00.25)

    Saved: C:\tmp021.png Time: 00:10.57 (Saving: 00:00.19)

    Saved: C:\tmp022.png Time: 00:10.76 (Saving: 00:00.21)

    Saved: C:\tmp023.png Time: 00:10.66 (Saving: 00:00.20)

    Saved: C:\tmp024.png Time: 00:11.19 (Saving: 00:00.20)

    Saved: C:\tmp025.png Time: 00:10.74 (Saving: 00:00.22)

    Saved: C:\tmp026.png Time: 00:10.78 (Saving: 00:00.20)

    Saved: C:\tmp027.png Time: 00:10.73 (Saving: 00:00.20)

  34. sure !! They are in the file folder “brd”‘s folder I’ve not noticed because the script is launched from a button of the my script “ProjectAssistant.ulp”

    I repeat I am very satisfied of everything !!!

    hhmmmmmm ๐Ÿ™ I have to learn a bit of blender and python: D

    • I strongly advice you to learn python. It’s so easy and helpful. Actually I learned python while creating this project ๐Ÿ˜‰

  35. Ciaooooo
    Super Hasan ๐Ÿ™‚ would you give me a hint?
    eg., suppose you want to import a LQFP144
    ….. amount when his library “WRL” in “OutlinerMT_View” I get a list of objects to which I associate a name, now, eagle2pcb only recognize an object, therefore, on the PCB I can only see one of the “body” or a “pin” depending on which of the name that I dato- How can I do to regroup, rename and save all objects with the same name, is this possible? I think so at least I hope

    • Hi Ivan,

      You can combine these objects (case, pins etc.) together with “Join” command of Blender. Shortcut is ‘Ctrl-J’. Just select all objects and press ‘Ctrl-J’.

      Remember, in blender you can apply different materials (hence different colors) to faces of an object. So, combining different objects together doesn’t mean you will have a single colored object.

  36. help !!! after grouping objects and scale adjusting “index.xml” from 0.5 to 0.25 I get this output:
    ===============================================================

    ===============================================================

    found bundled python: C:\Program Files\Blender Foundation\Blender\2.71\python
    1 file copiati.
    1 file copiati.
    Traceback (most recent call last):
    File “”, line 1, in
    File “”, line 104, in
    File “”, line 101, in run
    File “C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows\blenderutils.py”, line 159, in placeModel
    obj = bpy.context.selected_objects[0]
    IndexError: list index out of range

  37. file name="LQFP144_0.5.blend"
    model name="LQFP144_0.5"
    package tool="eagle" library="atmel-arm" name="LQFP144_0.5"
    scale="0.25"/
    /model
    /file

  38. now i’ve restored scale 0.5

    and i get no LQFP

    found bundled python: C:\Program Files\Blender Foundation\Blender\2.71\python
    1 file copiati.
    1 file copiati.
    Traceback (most recent call last):
    File "", line 1, in
    File "", line 104, in
    File "", line 101, in run
    File "C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows\blenderutils.py", line 159, in placeModel
    obj = bpy.context.selected_objects[0]
    IndexError: list index out of range

    • I don’t think scale is the problem. It looks like model cannot be imported at all. Can you check the names. Or send me your blender file, so I can investigate it.

  39. Now I think, have to create a common linea base for all libraries to get right rotation right ?

    • Sorry I couldn’t understand that.

      But if you haven’t noticed, you can also add a “rot” field in the XML file. Similar to scale. This will allow you to rotate models without modifying the model file. But it only supports rotation around Z axis. I think I should add other axes as well.

  40. Today I was at the presentation of a machine for the 3D optical inspection of PCBs “AOI” and reminded me of your script ๐Ÿ˜‰

  41. I believe that this is applicable to PCB CAD data without the textures of course, maybe it could be handy and useful …like a kind of first pcb checking before mount processing or some think of similar

    • That’s interesting. But my priority with pcb2blender is visual quality. I aim to produce photo realistic renders. Not mechanically accurate models ๐Ÿ™‚ .

      For design and manufacturing purposes, I would prefer a 3d viewer embedded in my PCB design tool. That allows you to quickly see your mistakes and correct them. Nowadays I believe all major pcb design tools have embedded 3d viewers, such as Altium. Heck, even KiCAD has its 3d viewer, and it is pretty good.

  42. And about photo realistic renders is possible by python scripting set things like “GLSL” OR add a light source on start up ?

  43. Now I’ll try to make my pcb more realistic too
    but I can not set the materials,,, not find them I would have to apply the gold pin of “pin-headers”

    • Unfortunately materials requires important amount of manual work. I’m trying to find a solution to that as well.

      Creating good materials is really important for render quality. For metallic stuff such as pins, I suggest you to play with ‘mirror’ settings. Mirror really gives the metallic look.

  44. Hi
    i’m trying to set materials, to an “stl” pin-headers.
    Well, i can separate pins frrom the body but now when i try to re join all parts to assign an univoc name to the object, the body obtein the pin’s materials instead of maintain the plastic material that i’ve set
    in fact I could not assign any material to the body will not let me mmmmh and also do not understand this in any way the body inherits the characteristics of the pin, so as gray as the default switch to gold

  45. yes yes ๐Ÿ™‚ I saw that can import it.
    but opening up the model to look at it, I noticed it was devoid of the metallic pins …. also … the molel has ba a single block, I can not select only the pins that’s why I tried to separate it from …
    what you tell me it was not necessary

  46. I don’t know how but now pin-header has its materials ๐Ÿ˜‰

    Now,after noticing several crashes with 2.71 “after enabling GLS”
    i’ve installet rev 2.74 !!
    but it don’t recognize component and textures ๐Ÿ™

    found bundled python: C:\Program Files\Blender Foundation\Blender\2.74\python
    1 file copiati.
    1 file copiati.
    Traceback (most recent call last):
    File “”, line 1, in
    File “”, line 104, in
    File “”, line 101, in run
    File “C:\Users\Ivan\Eagle\3D\Eagle2Blender-windows\blenderutils.py”, line 156, in placeModel
    autoselect=True)
    File “C:\Program Files\Blender Foundation\Blender\2.74\scripts\modules\bpy\ops.py”, line 189, in _
    _call__
    ret = op_call(self.idname_py(), None, kw)
    AttributeError: Calling operator “bpy.ops.wm.link_append” error, could not be found

    • It seems, link_append is renamed to append after blender 2.72. I’ve fixed it. You can download the latest version from the bitbucket repository.

      But there are other problems with the textures. I’m currently investigating that.

  47. ok ๐Ÿ˜‰
    but in my pcb remain the crash also with the 2.74
    component placed are ok
    textures without gles is ok
    the rendering fail when i set gles

    • How does it fail? It’s ok with me. Both rendering and GLSL shading looks okay.

  48. Yesterday I sent two lines of code to implement pcb2blender on Eagle’s toolbar.

    does it work?

  49. I did several tests, excluding time to time, groups of parts and swapping their order.
    What I have noticed is that when renderizzo with “gles” a number of objects equal to about 90% of the total, blender crashes
    therefore it does not seem related to a particular library but to the amount of the workload
    I’m running Blender on “Pentium I5 4GBytes of ram”

    I think you run the script with the latest version but the textures are not seen. I may have downloaded the script a moment before you fix …. try again later … now I’m going to eat a dish of spaghetti with clams
    hahahahah ahaha ๐Ÿ˜€

    • If you send me your .blend file, I can try to run it on my machine. So that we can understand, if it’s really a resource issue.

  50. the image of the PCB sample appears with well-defined edges, smooth, outlined in black are special libraries or the merit is the rendering engine? the visual effect is truly impressive !!

    in my pcb the capacitors seem very unrealistic despite having tried to increase the vertex

    • That’s a lot! I’m not sure my e-mail will accept that. Can you upload it somewhere, and send me a link?

  51. Hi Hasan,
    that’s really cool stuff. I was looking for that for years now.
    Blender has alot more options and is more userfriendly than POV.
    I didn’t quit get how to add new components. Do you have more infos on that?
    btw: your scripts run perfectly on a mac.
    Cheers
    Peter

    • Hi Peter,

      I’m glad to hear that you liked it!

      Have you seen the ‘index.xml’ file in the models directory? It should
      give you an idea. Still let me summarize the process;

      First you create a blender file with your models in it. Each component
      model should be a single object (joined). You should give your objects
      descriptive names. And put your file into the models directory.

      Now you add this line to the ‘index.xml’ file

      <file name="filename.blend">

      </file>

      Then you add your models from the blender file like this;

      <file name="filename.blend">
      <model name="blender_object_name">

      </model>
      </file>

      After that you add which eagle packages your model corresponds to;

      <file name="filename.blend">
      <model name="blender_object_name">
      <package tool="eagle" library="library_name_here" name="package_name_here"/>
      </model>
      </file>

      ‘library’, must be the name of the eagle library, ‘package’ must be
      the name of the eagle package. tool=”eagle” is always the same. Note
      that you can add multiple package assignments to a single model. If
      your model has to be adjusted you can use these attributes:

      – xoffs
      – yoffs
      – rot
      – scale

      Search the index.xml file for examples.

      I hope this helps. If you have any further questions, do not hesitate
      to ask.

  52. Hi,
    is there any further support of this script?
    I got lots of errors, when I tried to run it.
    Thanks. It would be awesome!

Leave a Reply

Your email address will not be published.