LibEagle is a library for Cadsoft Eagle PCB Design Software. Eagle uses xml based files. This library implements Eagle xml files and converts it to Objects and reverse.
Requirements:
- Nokogiri
- HTMLEntities
- Eagle PCB Design Software > 6.0 (only)
Installation:
Bundler:
gem 'libeagle'
Rubygems:
$ gem install libeagle
Usage:
The usage is really simple first you include gem in your file:
require "libeagle"
Parsing:
Parsing eagle files (schematic, board or library) or block of eagle elements (packages, devices, symbols and etc.) you have two options parse from file or string:
eagle = LibEagle::Parser.parseFile(file_name)
=> #<LibEagle::Eagle:0x007fd5ca956738>
or string:
eagle = LibEagle::Parser.parseXML("…")
=> #<LibEagle::Eagle:0x007fd5ca956738>
Hand Crafting:
To Create eagle files with hands or dynamically. Just use as simple objects:
eagle = LibEagle::Eagle.new
# Create a drawing object
eagle.object_drawing = LibEagle::Drawing.new
Setting attributes
eagle.attribute_version = "6.0"
Setting object
eagle.object_drawing = LibEagle::Drawing.new
XML Saving:
After creating, parsing, editing if you want to save file use .saveXML
will generate xml code of that object:
eagle = LibEagle::Eagle.new
eagle.attribute_version = "6.0"
eagle.saveXML
=> "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE eagle SYSTEM \"eagle.dtd\">\n<eagle version=\"6.0\">\n</eagle>\n"
Todo:
- Create API DOcs
- Optimize source code
Thank you:
- Martin DeMello (for pointing out how to optimize code)
Contributing:
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
License
Copyright (c) 2012 Aurimas Niekis Dual licensed under the MIT license and GPL license.