<commit_before>eagexp can export eagle_ partlist or image (2D/3D) of schematic or board.

Links:
 * home: https://github.com/ponty/eagexp
 * documentation: http://eagexp.readthedocs.org
 * PYPI: https://pypi.python.org/pypi/eagexp

|Travis| |Coveralls| |Latest Version| |Supported Python versions| |License| |Downloads| |Code Health| |Documentation|

Features:
 - written in python
 - it can be used as library or as a command line program
 - background processing (only if Xvfb_ and pyvirtualdisplay_ are installed)
 - timeout
 - 3D image export using Eagle3D and povray_
 - calculate airwires
 
Known problems:
 - slow: eagle is opened and closed for each export
 - high DPI does not work (memory problem?)
 - export can be blocked by Eagle -> timeout
 - 3D image export has a lot of options which are not supported
   
Basic usage
===========

    >>> from eagexp import image, partlist
    >>> brd='~/.eagle/projects/examples/singlesided/singlesided.brd'
    >>> image.export_image(brd, 'brd.png', resolution=600)
    >>> print partlist.raw_partlist(brd)


How it works
============

#. start Xvfb_ headless X server using pyvirtualdisplay_
#. redirect eagle display to Xvfb server by setting $DISPLAY variable.
#. start eagle_ with EXPORT and QUIT commands


Installation
============

General
-------

 * install eagle_
 * install povray_ (optional for 3D)
 * install pip_
 * install PIL_
 * install pyvirtualdisplay_ , Xvfb_
 * install the program::

    # as root
    pip install eagexp


Ubuntu 14.04
------------
::

    sudo apt-get install python-pip eagle povray  python-pil xvfb xdotool
    sudo pip install eagexp
    
Uninstall
---------
::

    # as root
    pip uninstall eagexp

Usage
=====


Export from python code
-----------------------

Example::

  #-- include('examples/image_example.py')--#
  '''
  Example for image export with various options
  '''

  from eagexp import image

  brd = '/usr/share/eagle/projects/examples/tutorial/demo2.brd'

  if __name__ == "__main__":
      # set resolution in DPI
      image.export_image(brd, 'api_brd_50.png', resolution=50)
      image.export_image(brd, 'api_brd_100.png', resolution=100)
      image.export_image(brd, 'api_brd_150.png', resolution=150)
      
      # mirror image
      image.export_image(brd, 'api_brd_mirror.png', mirror=True)
      
      # display only 2 layers
      image.export_image(brd, 'api_brd_layer.png', layers=['dimension', 'pads'])
      
      # display layer using eagle command
      image.export_image(
          brd, 'api_brd_command.png', command='display none dimension')
  #-#

Start the example program::

    python -m eagexp.examples.image_example

Result:

..  #-- sh('python -m eagexp.examples.image_example')--#
..  #-#

.. image::  _img/api_brd_50.png

.. image::  _img/api_brd_100.png

.. image::  _img/api_brd_150.png

.. image::  _img/api_brd_mirror.png

.. image::  _img/api_brd_layer.png

.. image::  _img/api_brd_command.png

Example for 3D::

  #-- include('examples/image3d_example.py')--#
  '''
  Example for 3D image export
  '''
  from eagexp import image3d

  brd = '/usr/share/eagle/projects/examples/tutorial/demo2.brd'

  if __name__ == "__main__":
      image3d.export_image3d(brd, 'api_3d.png')
      
      # size
      image3d.export_image3d(brd, 'api_3d_size1.png', size=(50, 50))
      image3d.export_image3d(brd, 'api_3d_size2.png', size=(50, 100))
      image3d.export_image3d(brd, 'api_3d_size3.png', size=(100, 50))
      
      # rotate
      image3d.export_image3d(
          brd, 'api_3d_xrot.png', pcb_rotate=(180, 0, 0), size=(200, 150))
      image3d.export_image3d(
          brd, 'api_3d_yrot1.png', pcb_rotate=(0, 45, 0), size=(200, 150))
      image3d.export_image3d(
          brd, 'api_3d_yrot2.png', pcb_rotate=(0, 90, 0), size=(200, 150))
      image3d.export_image3d(
          brd, 'api_3d_yrot3.png', pcb_rotate=(0, 135, 0), size=(200, 150))
  #-#

Start the example program:

    python -m eagexp.examples.image3d_example

Result:

..  #-- sh('python -m eagexp.examples.image3d_example')--#
..  #-#

.. image::  _img/api_3d.png
.. image::  _img/api_3d_xrot.png
.. image::  _img/api_3d_yrot1.png
.. image::  _img/api_3d_yrot2.png
.. image::  _img/api_3d_yrot3.png
.. image::  _img/api_3d_size1.png
.. image::  _img/api_3d_size2.png
.. image::  _img/api_3d_size3.png

Example for partlist export::

  #-- include('examples/partlist_example.py')--#
  from eagexp import partlist

  sch = '/usr/share/eagle/projects/examples/singlesided/singlesided.sch'
  brd = '/usr/share/eagle/projects/examples/singlesided/singlesided.brd'

  if __name__ == "__main__":
      print( 'raw_partlist of ' + sch )
      print( "'''" )<commit_msg>doc: fix format<commit_after>eagexp can export eagle_ partlist or image (2D/3D) of schematic or board.

Links:
 * home: https://github.com/ponty/eagexp
 * documentation: http://eagexp.readthedocs.org
 * PYPI: https://pypi.python.org/pypi/eagexp

|Travis| |Coveralls| |Latest Version| |Supported Python versions| |License| |Downloads| |Code Health| |Documentation|

Features:
 - written in python
 - it can be used as library or as a command line program
 - background processing (only if Xvfb_ and pyvirtualdisplay_ are installed)
 - timeout
 - 3D image export using Eagle3D and povray_
 - calculate airwires
 
Known problems:
 - slow: eagle is opened and closed for each export
 - high DPI does not work (memory problem?)
 - export can be blocked by Eagle -> timeout
 - 3D image export has a lot of options which are not supported
   
Basic usage
===========

    >>> from eagexp import image, partlist
    >>> brd='~/.eagle/projects/examples/singlesided/singlesided.brd'
    >>> image.export_image(brd, 'brd.png', resolution=600)
    >>> print partlist.raw_partlist(brd)


How it works
============

#. start Xvfb_ headless X server using pyvirtualdisplay_
#. redirect eagle display to Xvfb server by setting $DISPLAY variable.
#. start eagle_ with EXPORT and QUIT commands


Installation
============

General
-------

 * install eagle_
 * install povray_ (optional for 3D)
 * install pip_
 * install PIL_
 * install pyvirtualdisplay_ , Xvfb_
 * install the program::

    # as root
    pip install eagexp


Ubuntu 14.04
------------
::

    sudo apt-get install python-pip eagle povray  python-pil xvfb xdotool
    sudo pip install eagexp
    
Uninstall
---------
::

    # as root
    pip uninstall eagexp

Usage
=====


Export from python code
-----------------------

Example::

  #-- include('examples/image_example.py')--#
  '''
  Example for image export with various options
  '''

  from eagexp import image

  brd = '/usr/share/eagle/projects/examples/tutorial/demo2.brd'

  if __name__ == "__main__":
      # set resolution in DPI
      image.export_image(brd, 'api_brd_50.png', resolution=50)
      image.export_image(brd, 'api_brd_100.png', resolution=100)
      image.export_image(brd, 'api_brd_150.png', resolution=150)
      
      # mirror image
      image.export_image(brd, 'api_brd_mirror.png', mirror=True)
      
      # display only 2 layers
      image.export_image(brd, 'api_brd_layer.png', layers=['dimension', 'pads'])
      
      # display layer using eagle command
      image.export_image(
          brd, 'api_brd_command.png', command='display none dimension')
  #-#

Start the example program::

    python -m eagexp.examples.image_example

Result:

..  #-- sh('python -m eagexp.examples.image_example')--#
..  #-#

.. image::  _img/api_brd_50.png

.. image::  _img/api_brd_100.png

.. image::  _img/api_brd_150.png

.. image::  _img/api_brd_mirror.png

.. image::  _img/api_brd_layer.png

.. image::  _img/api_brd_command.png

Example for 3D::

  #-- include('examples/image3d_example.py')--#
  '''
  Example for 3D image export
  '''
  from eagexp import image3d

  brd = '/usr/share/eagle/projects/examples/tutorial/demo2.brd'

  if __name__ == "__main__":
      image3d.export_image3d(brd, 'api_3d.png')
      
      # size
      image3d.export_image3d(brd, 'api_3d_size1.png', size=(50, 50))
      image3d.export_image3d(brd, 'api_3d_size2.png', size=(50, 100))
      image3d.export_image3d(brd, 'api_3d_size3.png', size=(100, 50))
      
      # rotate
      image3d.export_image3d(
          brd, 'api_3d_xrot.png', pcb_rotate=(180, 0, 0), size=(200, 150))
      image3d.export_image3d(
          brd, 'api_3d_yrot1.png', pcb_rotate=(0, 45, 0), size=(200, 150))
      image3d.export_image3d(
          brd, 'api_3d_yrot2.png', pcb_rotate=(0, 90, 0), size=(200, 150))
      image3d.export_image3d(
          brd, 'api_3d_yrot3.png', pcb_rotate=(0, 135, 0), size=(200, 150))
  #-#

Start the example program::

    python -m eagexp.examples.image3d_example

Result:

..  #-- sh('python -m eagexp.examples.image3d_example')--#
..  #-#

.. image::  _img/api_3d.png
.. image::  _img/api_3d_xrot.png
.. image::  _img/api_3d_yrot1.png
.. image::  _img/api_3d_yrot2.png
.. image::  _img/api_3d_yrot3.png
.. image::  _img/api_3d_size1.png
.. image::  _img/api_3d_size2.png
.. image::  _img/api_3d_size3.png

Example for partlist export::

  #-- include('examples/partlist_example.py')--#
  from eagexp import partlist

  sch = '/usr/share/eagle/projects/examples/singlesided/singlesided.sch'
  brd = '/usr/share/eagle/projects/examples/singlesided/singlesided.brd'

  if __name__ == "__main__":
      print( 'raw_partlist of ' + sch )
      print( "'''" )
{'fraction_non_alphanumeric': 0.144, 'fraction_numerical': 0.031146666666666666, 'mean_word_length': 3.1104778605874617, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 29, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4454644', 'n_tokens_mistral': 3636, 'n_tokens_neox': 3379, 'n_words': 772}