libeagle 1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +18 -0
- data/GPL_license.txt +278 -0
- data/Gemfile +9 -0
- data/LICENSE +301 -0
- data/MIT_license.txt +21 -0
- data/README.md +86 -0
- data/Rakefile +2 -0
- data/lib/libeagle.rb +12 -0
- data/lib/libeagle/base.rb +184 -0
- data/lib/libeagle/eagle.rb +680 -0
- data/lib/libeagle/libeagle.rb +26 -0
- data/lib/libeagle/types.rb +83 -0
- data/lib/libeagle/version.rb +3 -0
- data/lib/libeagle/xml.rb +118 -0
- data/libeagle.gemspec +19 -0
- metadata +94 -0
data/MIT_license.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2011-2012 Aurimas Niekis
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# LibEagle [](https://codeclimate.com/github/gcds/libeagle)
|
2
|
+
|
3
|
+
LibEagle is a library for __[Cadsoft Eagle PCB Design Software](http://www.cadsoftusa.com/eagle-pcb-design-software/product-overview/?language=en)__. Eagle uses xml based files. This library implements Eagle xml files and converts it to Objects and reverse.
|
4
|
+
|
5
|
+
## Requirements:
|
6
|
+
* Nokogiri
|
7
|
+
* HTMLEntities
|
8
|
+
* [Eagle PCB Design Software](http://www.cadsoftusa.com/eagle-pcb-design-software/product-overview/?language=en) __> 6.0 (only)__
|
9
|
+
|
10
|
+
## Installation:
|
11
|
+
|
12
|
+
### Bundler:
|
13
|
+
|
14
|
+
gem 'libeagle'
|
15
|
+
|
16
|
+
### Rubygems:
|
17
|
+
|
18
|
+
$ gem install libeagle
|
19
|
+
|
20
|
+
## Usage:
|
21
|
+
|
22
|
+
The usage is really simple first you include gem in your file:
|
23
|
+
|
24
|
+
require "libeagle"
|
25
|
+
|
26
|
+
### Parsing:
|
27
|
+
|
28
|
+
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:
|
29
|
+
|
30
|
+
eagle = LibEagle::Parser.parseFile(file_name)
|
31
|
+
=> #<LibEagle::Eagle:0x007fd5ca956738>
|
32
|
+
|
33
|
+
or string:
|
34
|
+
|
35
|
+
eagle = LibEagle::Parser.parseXML("…")
|
36
|
+
=> #<LibEagle::Eagle:0x007fd5ca956738>
|
37
|
+
|
38
|
+
|
39
|
+
### Hand Crafting:
|
40
|
+
|
41
|
+
To Create eagle files with hands or dynamically. Just use as simple objects:
|
42
|
+
|
43
|
+
eagle = LibEagle::Eagle.new
|
44
|
+
# Create a drawing object
|
45
|
+
eagle.object_drawing = LibEagle::Drawing.new
|
46
|
+
|
47
|
+
#### Setting attributes
|
48
|
+
|
49
|
+
eagle.attribute_version = "6.0"
|
50
|
+
|
51
|
+
#### Setting object
|
52
|
+
|
53
|
+
eagle.object_drawing = LibEagle::Drawing.new
|
54
|
+
|
55
|
+
### XML Saving:
|
56
|
+
|
57
|
+
After creating, parsing, editing if you want to save file use `.saveXML` will generate xml code of that object:
|
58
|
+
|
59
|
+
|
60
|
+
eagle = LibEagle::Eagle.new
|
61
|
+
eagle.attribute_version = "6.0"
|
62
|
+
eagle.saveXML
|
63
|
+
=> "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE eagle SYSTEM \"eagle.dtd\">\n<eagle version=\"6.0\">\n</eagle>\n"
|
64
|
+
|
65
|
+
|
66
|
+
## Todo:
|
67
|
+
1. Create API DOcs
|
68
|
+
2. Optimize source code
|
69
|
+
|
70
|
+
## Thank you:
|
71
|
+
* __Martin DeMello__ (for pointing out how to optimize code)
|
72
|
+
|
73
|
+
## Contributing:
|
74
|
+
|
75
|
+
1. Fork it
|
76
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
77
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
78
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
79
|
+
5. Create new Pull Request
|
80
|
+
|
81
|
+
## License
|
82
|
+
|
83
|
+
Copyright (c) 2012 Aurimas Niekis Dual licensed under the MIT license and GPL license.
|
84
|
+
|
85
|
+
## Links:
|
86
|
+
* [Cadsoft Eagle PCB Design Software](http://www.cadsoftusa.com/eagle-pcb-design-software/product-overview/?language=en)
|
data/Rakefile
ADDED
data/lib/libeagle.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'pp'
|
3
|
+
require 'yaml'
|
4
|
+
require 'nokogiri'
|
5
|
+
require 'HTMLEntities'
|
6
|
+
require_relative "libeagle/xml"
|
7
|
+
require_relative "libeagle/base"
|
8
|
+
require_relative "libeagle/eagle"
|
9
|
+
require_relative "libeagle/types"
|
10
|
+
require_relative "libeagle/libeagle"
|
11
|
+
|
12
|
+
raise "LibEagle requires Ruby >= 1.8.6" if RUBY_VERSION < "1.8.6"
|
@@ -0,0 +1,184 @@
|
|
1
|
+
module LibEagle
|
2
|
+
class AttributeRequired < StandardError; end
|
3
|
+
class AttributeValueInvalid < StandardError; end
|
4
|
+
class Base
|
5
|
+
|
6
|
+
def self.iname(name)
|
7
|
+
name.gsub(/^class$/, "clazz")
|
8
|
+
end
|
9
|
+
|
10
|
+
#
|
11
|
+
# Getter of LibEagle objects
|
12
|
+
def self.lib_eagle_objects
|
13
|
+
@lib_eagle_objects ||= Hash.new
|
14
|
+
@lib_eagle_objects[:attributes] ||= {}
|
15
|
+
@lib_eagle_objects[:objects] ||= {}
|
16
|
+
@lib_eagle_objects[:empty_element] ||= false
|
17
|
+
@lib_eagle_objects[:root_element] ||= false
|
18
|
+
@lib_eagle_objects[:text_content] ||= false
|
19
|
+
@lib_eagle_objects[:element_name] ||= false
|
20
|
+
@lib_eagle_objects
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.empty_element
|
24
|
+
lib_eagle_objects[:empty_element] = true
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.root_element
|
28
|
+
lib_eagle_objects[:root_element] = true
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.text_content
|
32
|
+
lib_eagle_objects[:text_content] = true
|
33
|
+
|
34
|
+
# Define Setter and getter
|
35
|
+
attr_accessor :content
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.change_element_name(element_name)
|
39
|
+
lib_eagle_objects[:element_name] = true
|
40
|
+
define_method "element_name".to_sym do
|
41
|
+
instance_variable_set("@element_name", element_name) unless instance_variable_defined?("@element_name")
|
42
|
+
instance_variable_get("@element_name")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
def self.attribute(attribute_name, params = {})
|
48
|
+
attribute_name = attribute_name.to_s
|
49
|
+
variable_name = "@attribute_#{attribute_name}"
|
50
|
+
|
51
|
+
# Initialize place inside LibEagle objects
|
52
|
+
lib_eagle_objects[:attributes][attribute_name] ||= {}
|
53
|
+
lib_eagle_objects[:attributes][attribute_name][:required] = true if params[:required]
|
54
|
+
lib_eagle_objects[:attributes][attribute_name][:type] = params[:type] if params[:type]
|
55
|
+
lib_eagle_objects[:attributes][attribute_name][:valid_values] = params[:valid_values] if params[:valid_values]
|
56
|
+
|
57
|
+
# If default value is set return default value
|
58
|
+
if params[:default]
|
59
|
+
define_method "attribute_#{attribute_name}".to_sym do
|
60
|
+
instance_variable_set(variable_name, params[:default]) unless instance_variable_defined?(variable_name)
|
61
|
+
instance_variable_get(variable_name)
|
62
|
+
end
|
63
|
+
else
|
64
|
+
define_method "attribute_#{attribute_name}".to_sym do
|
65
|
+
instance_variable_get(variable_name)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Attribute setter
|
70
|
+
define_method "attribute_#{attribute_name}=".to_sym do |value|
|
71
|
+
if is_valid?(attribute_name,value)
|
72
|
+
instance_variable_set(variable_name,value)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.object(object_name, params = {})
|
78
|
+
object_name = object_name.to_s
|
79
|
+
variable_name = "@object_#{object_name}"
|
80
|
+
|
81
|
+
# Initialize place inside LibEagle objects
|
82
|
+
lib_eagle_objects[:objects][object_name] ||= {}
|
83
|
+
lib_eagle_objects[:objects][object_name][:class] = params[:class] if params[:class]
|
84
|
+
lib_eagle_objects[:objects][object_name][:class] = object_name.capitalize unless params[:class]
|
85
|
+
|
86
|
+
# Object getter
|
87
|
+
define_method "object_#{object_name}".to_sym do
|
88
|
+
instance_variable_get(variable_name)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Object setter
|
92
|
+
define_method "object_#{object_name}=".to_sym do |value|
|
93
|
+
instance_variable_set(variable_name,value)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def self.newFile(file)
|
98
|
+
xml = LibEagle::XML::Loader.new.loadFile(file)
|
99
|
+
self.new_with_xml(xml)
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.newXML(block_xml)
|
103
|
+
xml = LibEagle::XML::Loader.new.loadBlock(block_xml)
|
104
|
+
self.new_with_xml(xml)
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.new_with_xml(xml)
|
108
|
+
@base_class = self.new
|
109
|
+
|
110
|
+
if @lib_eagle_objects[:text_content]
|
111
|
+
@base_class.instance_variable_set("@content", xml.content)
|
112
|
+
end
|
113
|
+
|
114
|
+
if @lib_eagle_objects[:attributes].size > 0
|
115
|
+
@lib_eagle_objects[:attributes].each_pair do |attribute_name, params|
|
116
|
+
@base_class.instance_variable_set("@attribute_#{attribute_name}",xml[attribute_name]) if xml[attribute_name]
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
if @lib_eagle_objects[:objects].size > 0
|
121
|
+
@lib_eagle_objects[:objects].each_pair do |object_name, params|
|
122
|
+
if xml.xpath(object_name).size > 1
|
123
|
+
objects = []
|
124
|
+
xml.xpath(object_name).each do |xml_node|
|
125
|
+
objects << LibEagle::const_get(params[:class]).new_with_xml(xml_node)
|
126
|
+
end
|
127
|
+
@base_class.instance_variable_set("@object_#{object_name}",objects)
|
128
|
+
elsif xml.xpath(object_name).size == 1
|
129
|
+
xml_node = xml.xpath(object_name).first
|
130
|
+
object = LibEagle::const_get(params[:class]).new_with_xml(xml_node)
|
131
|
+
@base_class.instance_variable_set("@object_#{object_name}",object)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
return @base_class
|
137
|
+
end
|
138
|
+
|
139
|
+
def is_valid?(attribute,value)
|
140
|
+
params = self.class.lib_eagle_objects[:attributes][attribute]
|
141
|
+
if params[:required]
|
142
|
+
unless value
|
143
|
+
raise AttributeRequired.new("#{self.class.name}: #{attribute} is required")
|
144
|
+
return false
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
if params[:type] && value
|
149
|
+
unless params[:type] =~ value
|
150
|
+
raise AttributeValueInvalid.new("`#{attribute}` value: \"#{value}\" isn't in valid range (#{params[:type]})")
|
151
|
+
return false
|
152
|
+
end
|
153
|
+
end
|
154
|
+
return true
|
155
|
+
end
|
156
|
+
|
157
|
+
def valid?
|
158
|
+
self.class.lib_eagle_objects[:attributes].each_pair do |attribute, params|
|
159
|
+
value = self.instance_variable_get("@attribute_#{attribute}")
|
160
|
+
if params[:required]
|
161
|
+
unless value
|
162
|
+
raise AttributeRequired.new("#{self.class.name}: #{attribute} is required")
|
163
|
+
return false
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
if params[:type] && value
|
168
|
+
unless params[:type] =~ value
|
169
|
+
raise AttributeValueInvalid.new("`#{attribute}` value: \"#{value}\" isn't in valid range (#{params[:type]})")
|
170
|
+
return false
|
171
|
+
end
|
172
|
+
end
|
173
|
+
return true
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
def saveXML
|
178
|
+
if valid?
|
179
|
+
LibEagle::XML::Saver.new(self.class.lib_eagle_objects,self).parse
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
184
|
+
end
|
@@ -0,0 +1,680 @@
|
|
1
|
+
require_relative "types"
|
2
|
+
module LibEagle
|
3
|
+
|
4
|
+
CLASS_NAMES = {
|
5
|
+
'eagle' => "Eagle",
|
6
|
+
'compatibility' => "Compatibility",
|
7
|
+
'note' => "Note",
|
8
|
+
'drawing' => "Drawing",
|
9
|
+
'library' => "Library",
|
10
|
+
'schematic' => "Schematic",
|
11
|
+
'board' => "Board",
|
12
|
+
'sheet' => "Sheet",
|
13
|
+
'package' => "Package",
|
14
|
+
'symbol' => "Symbol",
|
15
|
+
'deviceset' => "Deviceset",
|
16
|
+
'device' => "Device",
|
17
|
+
'bus' => "Bus",
|
18
|
+
'net' => "Net",
|
19
|
+
'segment' => "Segment",
|
20
|
+
'signal' => "Signal",
|
21
|
+
'variantdef' => "Variantdef",
|
22
|
+
'variant' => "Variant",
|
23
|
+
'gate' => "Gate",
|
24
|
+
'wire' => "Wire",
|
25
|
+
'dimension' => "Dimension",
|
26
|
+
'text' => "Text",
|
27
|
+
'circle' => "Circle",
|
28
|
+
'rectangle' => "Rectangle",
|
29
|
+
'frame' => "Frame",
|
30
|
+
'hole' => "Hole",
|
31
|
+
'pad' => "Pad",
|
32
|
+
'smd' => "Smd",
|
33
|
+
'element' => "Element",
|
34
|
+
'via' => "Via",
|
35
|
+
'polygon' => "Polygon",
|
36
|
+
'vertex' => "Vertex",
|
37
|
+
'pin' => "Pin",
|
38
|
+
'part' => "Part",
|
39
|
+
'instance' => "Instance",
|
40
|
+
'label' => "Label",
|
41
|
+
'junction' => "Junction",
|
42
|
+
'connect' => "Connect",
|
43
|
+
'technology' => "Technology",
|
44
|
+
'attribute' => "Attribute",
|
45
|
+
'pinref' => "Pinref",
|
46
|
+
'contactref' => "Contactref",
|
47
|
+
'variantdefs' => "Variantdefs",
|
48
|
+
'settings' => "Settings",
|
49
|
+
'sheets' => "Sheets",
|
50
|
+
'layers' => "Layers",
|
51
|
+
'packages' => "Packages",
|
52
|
+
'symbols' => "Symbols",
|
53
|
+
'devicesets' => "Devicesets",
|
54
|
+
'gates' => "Gates",
|
55
|
+
'devices' => "Devices",
|
56
|
+
'libraries' => "Libraries",
|
57
|
+
'connects' => "Connects",
|
58
|
+
'technologies' => "Technologies",
|
59
|
+
'attributes' => "Attributes",
|
60
|
+
'classes' => "Classes",
|
61
|
+
'parts' => "Parts",
|
62
|
+
'instances' => "Instances",
|
63
|
+
'errors' => "Errors",
|
64
|
+
'plain' => "Plain",
|
65
|
+
'autorouter' => "Autorouter",
|
66
|
+
'elements' => "Elements",
|
67
|
+
'signals' => "Signals",
|
68
|
+
'busses' => "Busses",
|
69
|
+
'nets' => "Nets",
|
70
|
+
'setting' => "Setting",
|
71
|
+
'designrules' => "Designrules",
|
72
|
+
'grid' => "Grid",
|
73
|
+
'layer' => "Layer",
|
74
|
+
'cclass' => "CClass",
|
75
|
+
'clearance' => "Clearance",
|
76
|
+
'description' => "Description",
|
77
|
+
'param' => "Param",
|
78
|
+
'pass' => "Pass",
|
79
|
+
'approved' => "Approved"}
|
80
|
+
|
81
|
+
#
|
82
|
+
# Drawing definitions
|
83
|
+
#
|
84
|
+
class Eagle < LibEagle::Base
|
85
|
+
root_element
|
86
|
+
object :compatibility
|
87
|
+
object :drawing
|
88
|
+
attribute :version, :required => true
|
89
|
+
end
|
90
|
+
|
91
|
+
class Compatibility < LibEagle::Base
|
92
|
+
object :note
|
93
|
+
end
|
94
|
+
|
95
|
+
class Note < LibEagle::Base
|
96
|
+
text_content
|
97
|
+
attribute :version, :required => true
|
98
|
+
attribute :severity, :required => true, :type => LibEagle::Types.Severity
|
99
|
+
end
|
100
|
+
|
101
|
+
class Drawing < LibEagle::Base
|
102
|
+
object :settings
|
103
|
+
object :grid
|
104
|
+
object :layers
|
105
|
+
object :library
|
106
|
+
object :schematic
|
107
|
+
object :board
|
108
|
+
end
|
109
|
+
|
110
|
+
class Library < LibEagle::Base
|
111
|
+
object :description
|
112
|
+
object :packages
|
113
|
+
object :symbols
|
114
|
+
object :devicesets
|
115
|
+
attribute :name
|
116
|
+
end
|
117
|
+
|
118
|
+
class Schematic < LibEagle::Base
|
119
|
+
object :description
|
120
|
+
object :libraries
|
121
|
+
object :attributes
|
122
|
+
object :variantdefs
|
123
|
+
object :classes
|
124
|
+
object :parts
|
125
|
+
object :sheets
|
126
|
+
object :errors
|
127
|
+
attribute :xreflabel
|
128
|
+
attribute :xrefpart
|
129
|
+
end
|
130
|
+
|
131
|
+
class Board < LibEagle::Base
|
132
|
+
object :description
|
133
|
+
object :plain
|
134
|
+
object :libraries
|
135
|
+
object :attributes
|
136
|
+
object :variantdefs
|
137
|
+
object :classes
|
138
|
+
object :designrules
|
139
|
+
object :autorouter
|
140
|
+
object :elements
|
141
|
+
object :signals
|
142
|
+
object :errors
|
143
|
+
end
|
144
|
+
|
145
|
+
#
|
146
|
+
# High Level Objects
|
147
|
+
#
|
148
|
+
class Sheet < LibEagle::Base
|
149
|
+
object :description
|
150
|
+
object :plain
|
151
|
+
object :instances
|
152
|
+
object :busses
|
153
|
+
object :nets
|
154
|
+
end
|
155
|
+
|
156
|
+
class Package < LibEagle::Base
|
157
|
+
object :description
|
158
|
+
object :wire
|
159
|
+
object :circle
|
160
|
+
object :frame
|
161
|
+
object :hole
|
162
|
+
object :pad
|
163
|
+
object :smd
|
164
|
+
object :text
|
165
|
+
object :rectangle
|
166
|
+
object :polygon
|
167
|
+
attribute :name, :required => true
|
168
|
+
end
|
169
|
+
|
170
|
+
class Symbol < LibEagle::Base
|
171
|
+
object :description
|
172
|
+
object :polygon
|
173
|
+
object :wire
|
174
|
+
object :text
|
175
|
+
object :pin
|
176
|
+
object :circle
|
177
|
+
object :rectangle
|
178
|
+
object :frame
|
179
|
+
attribute :name, :required => true
|
180
|
+
end
|
181
|
+
|
182
|
+
class Deviceset < LibEagle::Base
|
183
|
+
object :description
|
184
|
+
object :gates
|
185
|
+
object :devices
|
186
|
+
attribute :name, :required => true
|
187
|
+
attribute :prefix, :default => ""
|
188
|
+
attribute :uservalue, :default => "no", :type => LibEagle::Types.Bool
|
189
|
+
end
|
190
|
+
|
191
|
+
class Device < LibEagle::Base
|
192
|
+
object :connects
|
193
|
+
object :technologies
|
194
|
+
attribute :name, :default => ""
|
195
|
+
attribute :package
|
196
|
+
end
|
197
|
+
|
198
|
+
class Bus < LibEagle::Base
|
199
|
+
object :segment
|
200
|
+
attribute :name, :required => true
|
201
|
+
end
|
202
|
+
|
203
|
+
class Net < LibEagle::Base
|
204
|
+
object :segment
|
205
|
+
attribute :name, :required => true
|
206
|
+
attribute :class, :default => "0"
|
207
|
+
end
|
208
|
+
|
209
|
+
class Segment < LibEagle::Base
|
210
|
+
object :pinref
|
211
|
+
object :wire
|
212
|
+
object :junction
|
213
|
+
object :label
|
214
|
+
end
|
215
|
+
|
216
|
+
class Signal < LibEagle::Base
|
217
|
+
attribute :name, :required => true
|
218
|
+
attribute :class, :default => "0"
|
219
|
+
attribute :airwireshidden, :default => "no", :type => LibEagle::Types.Bool
|
220
|
+
object :contactref
|
221
|
+
object :polygon
|
222
|
+
object :wire
|
223
|
+
object :via
|
224
|
+
end
|
225
|
+
|
226
|
+
#
|
227
|
+
# Basic Objects
|
228
|
+
#
|
229
|
+
class Variantdef < LibEagle::Base
|
230
|
+
empty_element
|
231
|
+
attribute :name, :required => true
|
232
|
+
attribute :current, :default => "no", :type => LibEagle::Types.Bool
|
233
|
+
end
|
234
|
+
|
235
|
+
class Variant < LibEagle::Base
|
236
|
+
empty_element
|
237
|
+
attribute :name, :required => true
|
238
|
+
attribute :populate, :default => "yes", :type => LibEagle::Types.Bool
|
239
|
+
attribute :value
|
240
|
+
attribute :technology
|
241
|
+
end
|
242
|
+
|
243
|
+
class Gate < LibEagle::Base
|
244
|
+
empty_element
|
245
|
+
attribute :name, :required => true
|
246
|
+
attribute :symbol, :required => true
|
247
|
+
attribute :x, :required => true
|
248
|
+
attribute :y, :required => true
|
249
|
+
attribute :addlevel, :default => "next", :type => LibEagle::Types.GateAddLevel
|
250
|
+
attribute :swaplevel, :default => 0
|
251
|
+
end
|
252
|
+
|
253
|
+
class Wire < LibEagle::Base
|
254
|
+
empty_element
|
255
|
+
attribute :x1, :required => true
|
256
|
+
attribute :y1, :required => true
|
257
|
+
attribute :x2, :required => true
|
258
|
+
attribute :y2, :required => true
|
259
|
+
attribute :width, :required => true
|
260
|
+
attribute :layer, :required => true
|
261
|
+
attribute :extent
|
262
|
+
attribute :style, :default => "continuous", :type => LibEagle::Types.WireStyle
|
263
|
+
attribute :curve, :default => "0"
|
264
|
+
attribute :cap, :default => "round", :type => LibEagle::Types.WireCap
|
265
|
+
end
|
266
|
+
|
267
|
+
class Dimension < LibEagle::Base
|
268
|
+
empty_element
|
269
|
+
attribute :x1, :required => true
|
270
|
+
attribute :y2, :required => true
|
271
|
+
attribute :x2, :required => true
|
272
|
+
attribute :y2, :required => true
|
273
|
+
attribute :x3, :required => true
|
274
|
+
attribute :y3, :required => true
|
275
|
+
attribute :layer, :required => true
|
276
|
+
attribute :dtype, :default => "continuous", :type => LibEagle::Types.DimensionType
|
277
|
+
end
|
278
|
+
|
279
|
+
class Text < LibEagle::Base
|
280
|
+
text_content
|
281
|
+
attribute :x, :required => true
|
282
|
+
attribute :y, :required => true
|
283
|
+
attribute :size, :required => true
|
284
|
+
attribute :layer, :required => true
|
285
|
+
attribute :font, :default => "proportional", :type => LibEagle::Types.TextFont
|
286
|
+
attribute :ratio, :default => "8"
|
287
|
+
attribute :rot, :default => "R0"
|
288
|
+
attribute :align, :default => "bottom-left", :type => LibEagle::Types.Align
|
289
|
+
attribute :distance, :default => "50"
|
290
|
+
end
|
291
|
+
|
292
|
+
class Circle < LibEagle::Base
|
293
|
+
empty_element
|
294
|
+
attribute :x, :required => true
|
295
|
+
attribute :y, :required => true
|
296
|
+
attribute :radius, :required => true
|
297
|
+
attribute :width, :required => true
|
298
|
+
attribute :layer, :required => true
|
299
|
+
end
|
300
|
+
|
301
|
+
class Rectangle < LibEagle::Base
|
302
|
+
empty_element
|
303
|
+
attribute :x1, :required => true
|
304
|
+
attribute :y1, :required => true
|
305
|
+
attribute :x2, :required => true
|
306
|
+
attribute :y2, :required => true
|
307
|
+
attribute :layer, :required => true
|
308
|
+
attribute :rot, :default => "R0"
|
309
|
+
end
|
310
|
+
|
311
|
+
class Frame < LibEagle::Base
|
312
|
+
empty_element
|
313
|
+
attribute :x1, :required => true
|
314
|
+
attribute :y2, :required => true
|
315
|
+
attribute :x2, :required => true
|
316
|
+
attribute :y2, :required => true
|
317
|
+
attribute :columns, :required => true
|
318
|
+
attribute :rows, :required => true
|
319
|
+
attribute :layer, :required => true
|
320
|
+
attribute :border_left, :default => "yes", :type => LibEagle::Types.Bool
|
321
|
+
attribute :border_top, :default => "yes", :type => LibEagle::Types.Bool
|
322
|
+
attribute :border_right, :default => "yes", :type => LibEagle::Types.Bool
|
323
|
+
attribute :border_bottom, :default => "yes", :type => LibEagle::Types.Bool
|
324
|
+
end
|
325
|
+
|
326
|
+
class Hole < LibEagle::Base
|
327
|
+
empty_element
|
328
|
+
attribute :x, :required => true
|
329
|
+
attribute :y, :required => true
|
330
|
+
attribute :drill, :required => true
|
331
|
+
end
|
332
|
+
|
333
|
+
|
334
|
+
class Pad < LibEagle::Base
|
335
|
+
empty_element
|
336
|
+
attribute :name, :required => true
|
337
|
+
attribute :x, :required => true
|
338
|
+
attribute :y, :required => true
|
339
|
+
attribute :drill, :required => true
|
340
|
+
attribute :diameter, :default => "0"
|
341
|
+
attribute :shape, :default => "round", :type => LibEagle::Types.PadShape
|
342
|
+
attribute :rot, :default => "R0"
|
343
|
+
attribute :stop, :default => "yes", :type => LibEagle::Types.Bool
|
344
|
+
attribute :thermals, :default => "yes", :type => LibEagle::Types.Bool
|
345
|
+
attribute :first, :default => "no", :type => LibEagle::Types.Bool
|
346
|
+
end
|
347
|
+
|
348
|
+
class Smd < LibEagle::Base
|
349
|
+
empty_element
|
350
|
+
attribute :name, :required => true
|
351
|
+
attribute :x, :required => true
|
352
|
+
attribute :y, :required => true
|
353
|
+
attribute :dx, :required => true
|
354
|
+
attribute :dy, :required => true
|
355
|
+
attribute :layer, :required => true
|
356
|
+
attribute :roundness, :default => "0"
|
357
|
+
attribute :rot, :default => "R0"
|
358
|
+
attribute :stop, :default => "yes", :type => LibEagle::Types.Bool
|
359
|
+
attribute :thermals, :default => "yes", :type => LibEagle::Types.Bool
|
360
|
+
attribute :cream, :default => "yes", :type => LibEagle::Types.Bool
|
361
|
+
end
|
362
|
+
|
363
|
+
class Element < LibEagle::Base
|
364
|
+
object :attribute
|
365
|
+
object :variant
|
366
|
+
attribute :name, :required => true
|
367
|
+
attribute :library, :required => true
|
368
|
+
attribute :package, :required => true
|
369
|
+
attribute :value, :required => true
|
370
|
+
attribute :x, :required => true
|
371
|
+
attribute :y, :required => true
|
372
|
+
attribute :locked, :default => "no", :type => LibEagle::Types.Bool
|
373
|
+
attribute :smashed, :default => "no", :type => LibEagle::Types.Bool
|
374
|
+
attribute :rot, :default => "R0"
|
375
|
+
end
|
376
|
+
|
377
|
+
class Via < LibEagle::Base
|
378
|
+
empty_element
|
379
|
+
attribute :x, :required => true
|
380
|
+
attribute :y, :required => true
|
381
|
+
attribute :extent, :required => true
|
382
|
+
attribute :drill, :required => true
|
383
|
+
attribute :diameter, :default => "0"
|
384
|
+
attribute :shape, :default => "round", :type => LibEagle::Types.ViaShape
|
385
|
+
attribute :alwaysstop, :default => "no", :type => LibEagle::Types.Bool
|
386
|
+
end
|
387
|
+
|
388
|
+
class Polygon < LibEagle::Base
|
389
|
+
object :vertex
|
390
|
+
attribute :width, :required => true
|
391
|
+
attribute :layer, :required => true
|
392
|
+
attribute :spacing
|
393
|
+
attribute :pour, :default => "solid", :type => LibEagle::Types.PolygonPour
|
394
|
+
attribute :isolate
|
395
|
+
attribute :orphans, :default => "no", :type => LibEagle::Types.Bool
|
396
|
+
attribute :thermals, :default => "yes", :type => LibEagle::Types.Bool
|
397
|
+
attribute :rank, :default => "0"
|
398
|
+
end
|
399
|
+
|
400
|
+
class Vertex < LibEagle::Base
|
401
|
+
empty_element
|
402
|
+
attribute :x, :required => true
|
403
|
+
attribute :y, :required => true
|
404
|
+
attribute :curve, :default => "0"
|
405
|
+
end
|
406
|
+
|
407
|
+
class Pin < LibEagle::Base
|
408
|
+
empty_element
|
409
|
+
attribute :name, :required => true
|
410
|
+
attribute :x, :required => true
|
411
|
+
attribute :y, :required => true
|
412
|
+
attribute :visible, :default => "both", :type => LibEagle::Types.PinVisible
|
413
|
+
attribute :length, :default => "long", :type => LibEagle::Types.PinLength
|
414
|
+
attribute :direction, :default => "io", :type => LibEagle::Types.PinDirection
|
415
|
+
attribute :function, :default => "none", :type => LibEagle::Types.PinFunction
|
416
|
+
attribute :swaplevel, :default => "0"
|
417
|
+
attribute :rot, :default => "R0"
|
418
|
+
end
|
419
|
+
|
420
|
+
class Part < LibEagle::Base
|
421
|
+
empty_element
|
422
|
+
object :attribute
|
423
|
+
object :variant
|
424
|
+
attribute :name, :required => true
|
425
|
+
attribute :library, :required => true
|
426
|
+
attribute :deviceset, :required => true
|
427
|
+
attribute :device, :required => true
|
428
|
+
attribute :technology, :default => ""
|
429
|
+
attribute :value
|
430
|
+
end
|
431
|
+
|
432
|
+
class Instance < LibEagle::Base
|
433
|
+
empty_element
|
434
|
+
object :attribute
|
435
|
+
attribute :part, :required => true
|
436
|
+
attribute :gate, :required => true
|
437
|
+
attribute :x, :required => true
|
438
|
+
attribute :y, :required => true
|
439
|
+
attribute :smashed, :default => "no", :type => LibEagle::Types.Bool
|
440
|
+
attribute :rot, :default => "R0"
|
441
|
+
end
|
442
|
+
|
443
|
+
class Label < LibEagle::Base
|
444
|
+
empty_element
|
445
|
+
attribute :x, :required => true
|
446
|
+
attribute :y, :required => true
|
447
|
+
attribute :size, :required => true
|
448
|
+
attribute :layer, :required => true
|
449
|
+
attribute :font, :default => "proportional", :type => LibEagle::Types.TextFont
|
450
|
+
attribute :ratio, :default => "8"
|
451
|
+
attribute :rot, :default => "R0"
|
452
|
+
attribute :xref, :default => "no", :type => LibEagle::Types.Bool
|
453
|
+
end
|
454
|
+
|
455
|
+
class Junction < LibEagle::Base
|
456
|
+
empty_element
|
457
|
+
attribute :x, :required => true
|
458
|
+
attribute :y, :required => true
|
459
|
+
end
|
460
|
+
|
461
|
+
class Connect < LibEagle::Base
|
462
|
+
empty_element
|
463
|
+
attribute :gate, :required => true
|
464
|
+
attribute :pin, :required => true
|
465
|
+
attribute :pad, :required => true
|
466
|
+
attribute :route, :default => "all", :type => LibEagle::Types.ContactRoute
|
467
|
+
end
|
468
|
+
|
469
|
+
class Technology < LibEagle::Base
|
470
|
+
object :attribute
|
471
|
+
attribute :name, :required => true
|
472
|
+
end
|
473
|
+
|
474
|
+
class Attribute < LibEagle::Base
|
475
|
+
empty_element
|
476
|
+
attribute :name, :required => true
|
477
|
+
attribute :value
|
478
|
+
attribute :x
|
479
|
+
attribute :y
|
480
|
+
attribute :size
|
481
|
+
attribute :layer
|
482
|
+
attribute :font, :type => LibEagle::Types.TextFont
|
483
|
+
attribute :ratio
|
484
|
+
attribute :rot, :default => "R0"
|
485
|
+
attribute :display, :default => "value", :type => LibEagle::Types.AttributeDisplay
|
486
|
+
attribute :constant, :default => "no", :type => LibEagle::Types.Bool
|
487
|
+
end
|
488
|
+
|
489
|
+
class Pinref < LibEagle::Base
|
490
|
+
empty_element
|
491
|
+
attribute :part, :required => true
|
492
|
+
attribute :gate, :required => true
|
493
|
+
attribute :pin, :required => true
|
494
|
+
end
|
495
|
+
|
496
|
+
class Contactref < LibEagle::Base
|
497
|
+
empty_element
|
498
|
+
attribute :element, :required => true
|
499
|
+
attribute :pad, :required => true
|
500
|
+
attribute :route, :default => "all", :type => LibEagle::Types.ContactRoute
|
501
|
+
attribute :routetag, :default => ""
|
502
|
+
end
|
503
|
+
|
504
|
+
#
|
505
|
+
# Object Lists
|
506
|
+
#
|
507
|
+
class Variantdefs < LibEagle::Base
|
508
|
+
object :variantdef
|
509
|
+
end
|
510
|
+
|
511
|
+
class Settings < LibEagle::Base
|
512
|
+
object :setting
|
513
|
+
end
|
514
|
+
|
515
|
+
class Sheets < LibEagle::Base
|
516
|
+
object :sheet
|
517
|
+
end
|
518
|
+
|
519
|
+
class Layers < LibEagle::Base
|
520
|
+
object :layer
|
521
|
+
end
|
522
|
+
|
523
|
+
class Packages < LibEagle::Base
|
524
|
+
object :package
|
525
|
+
end
|
526
|
+
|
527
|
+
class Symbols < LibEagle::Base
|
528
|
+
object :symbol
|
529
|
+
end
|
530
|
+
|
531
|
+
class Devicesets < LibEagle::Base
|
532
|
+
object :deviceset
|
533
|
+
end
|
534
|
+
|
535
|
+
class Gates < LibEagle::Base
|
536
|
+
object :gate
|
537
|
+
end
|
538
|
+
|
539
|
+
class Devices < LibEagle::Base
|
540
|
+
object :device
|
541
|
+
end
|
542
|
+
|
543
|
+
class Libraries < LibEagle::Base
|
544
|
+
object :library
|
545
|
+
end
|
546
|
+
|
547
|
+
class Connects < LibEagle::Base
|
548
|
+
object :connect
|
549
|
+
end
|
550
|
+
|
551
|
+
class Technologies < LibEagle::Base
|
552
|
+
object :technology
|
553
|
+
end
|
554
|
+
|
555
|
+
class Attributes < LibEagle::Base
|
556
|
+
object :attribute
|
557
|
+
end
|
558
|
+
|
559
|
+
class Classes < LibEagle::Base
|
560
|
+
object :class, :class => "CClass"
|
561
|
+
end
|
562
|
+
|
563
|
+
class Parts < LibEagle::Base
|
564
|
+
object :part
|
565
|
+
end
|
566
|
+
|
567
|
+
class Instances < LibEagle::Base
|
568
|
+
object :instance
|
569
|
+
end
|
570
|
+
|
571
|
+
class Errors < LibEagle::Base
|
572
|
+
object :error
|
573
|
+
end
|
574
|
+
|
575
|
+
class Plain < LibEagle::Base
|
576
|
+
object :polygon
|
577
|
+
object :wire
|
578
|
+
object :text
|
579
|
+
object :circle
|
580
|
+
object :rectangle
|
581
|
+
object :frame
|
582
|
+
object :hole
|
583
|
+
end
|
584
|
+
|
585
|
+
class Autorouter < LibEagle::Base
|
586
|
+
object :pass
|
587
|
+
end
|
588
|
+
|
589
|
+
class Elements < LibEagle::Base
|
590
|
+
object :element
|
591
|
+
end
|
592
|
+
|
593
|
+
class Signals < LibEagle::Base
|
594
|
+
object :signal
|
595
|
+
end
|
596
|
+
|
597
|
+
class Busses < LibEagle::Base
|
598
|
+
object :busse
|
599
|
+
end
|
600
|
+
|
601
|
+
class Nets < LibEagle::Base
|
602
|
+
object :net
|
603
|
+
end
|
604
|
+
|
605
|
+
#
|
606
|
+
# Miscellaneous Objects
|
607
|
+
#
|
608
|
+
class Setting < LibEagle::Base
|
609
|
+
empty_element
|
610
|
+
attribute :alwaysvectorfont, :type => LibEagle::Types.Bool
|
611
|
+
attribute :verticaltext, :type => LibEagle::Types.VerticalText
|
612
|
+
end
|
613
|
+
|
614
|
+
class Designrules < LibEagle::Base
|
615
|
+
object :description
|
616
|
+
object :param
|
617
|
+
attribute :name, :required => true
|
618
|
+
end
|
619
|
+
|
620
|
+
class Grid < LibEagle::Base
|
621
|
+
empty_element
|
622
|
+
attribute :distance
|
623
|
+
attribute :unitdist, :type => LibEagle::Types.GridUnit
|
624
|
+
attribute :unit, :type => LibEagle::Types.GridUnit
|
625
|
+
attribute :style, :default => "lines", :type => LibEagle::Types.GridStyle
|
626
|
+
attribute :multiple, :default => "0"
|
627
|
+
attribute :display, :default => "no", :type => LibEagle::Types.Bool
|
628
|
+
attribute :altdistance
|
629
|
+
attribute :altunitdist, :type => LibEagle::Types.GridUnit
|
630
|
+
attribute :altunit, :type => LibEagle::Types.GridUnit
|
631
|
+
end
|
632
|
+
|
633
|
+
class Layer < LibEagle::Base
|
634
|
+
empty_element
|
635
|
+
attribute :number, :required => true
|
636
|
+
attribute :name, :required => true
|
637
|
+
attribute :color, :required => true
|
638
|
+
attribute :fill, :required => true
|
639
|
+
attribute :visible, :default => "yes"
|
640
|
+
attribute :active, :default => "yes"
|
641
|
+
end
|
642
|
+
|
643
|
+
class CClass < LibEagle::Base
|
644
|
+
change_element_name "class"
|
645
|
+
object :clearance
|
646
|
+
attribute :number, :required => true
|
647
|
+
attribute :name, :required => true
|
648
|
+
attribute :width, :default => "0"
|
649
|
+
attribute :drill, :default => "0"
|
650
|
+
end
|
651
|
+
|
652
|
+
class Clearance < LibEagle::Base
|
653
|
+
empty_element
|
654
|
+
attribute :class, :required => true
|
655
|
+
attribute :value, :default => "0"
|
656
|
+
end
|
657
|
+
|
658
|
+
class Description < LibEagle::Base
|
659
|
+
text_content
|
660
|
+
attribute :language
|
661
|
+
end
|
662
|
+
|
663
|
+
class Param < LibEagle::Base
|
664
|
+
empty_element
|
665
|
+
attribute :name, :required => true
|
666
|
+
attribute :value, :required => true
|
667
|
+
end
|
668
|
+
|
669
|
+
class Pass < LibEagle::Base
|
670
|
+
object :param
|
671
|
+
attribute :name, :required => true
|
672
|
+
attribute :refer
|
673
|
+
attribute :active, :default => "yes"
|
674
|
+
end
|
675
|
+
|
676
|
+
class Approved < LibEagle::Base
|
677
|
+
empty_element
|
678
|
+
attribute :hash, :required => true
|
679
|
+
end
|
680
|
+
end
|