-
Notifications
You must be signed in to change notification settings - Fork 534
Support for Eagle / Fusion 360 Electronics #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
f24540e
initial commit - added EagleParser
Funkenjaeger a635ba5
Stylistic fixes
Funkenjaeger 41cbc46
Refactored EagleParser to GenericJsonParser, added 'spec version' log…
Funkenjaeger 83dbbc7
_type and _spec_version in top level object only
Funkenjaeger 5c900c7
#216 code review updates
Funkenjaeger 2816e8a
Fix format string syntax
Funkenjaeger 9bbceae
Initial implementation of JSON validation with schema in GenericJsonP…
Funkenjaeger d363618
Updated to implement the rest of the pcbdata struct as defined in DAT…
Funkenjaeger 976f1c5
Fix ExtraData (array vs. object)
Funkenjaeger ca9e92a
Initial cut at support for extra_fields in generic JSON schema & parser
Funkenjaeger 6cc6c96
Merge branch 'master' into eagle_support
Funkenjaeger ccb2f55
Merge upstream, some changes to address code review comments
Funkenjaeger c7a5e44
Merge branch 'genericjson_extra_fields' into eagle_support
Funkenjaeger 44c8d22
More schema updates based on code review
Funkenjaeger 63ed7fd
Removed parser-specific code from the core code in ibom.py
Funkenjaeger 021723e
#216 code review updates
Funkenjaeger 2b46456
2afaf02
Extra field data embedded in components for kicad parser also
Funkenjaeger 65f4afb
Merge remote-tracking branch 'upstream/master' into eagle_support
Funkenjaeger eb31d9f
Override board bounding box from generic JSON based on edges
Funkenjaeger 7ac7d8a
Restore warning for outdated netlist/xml in kicad parser
Funkenjaeger 667b0c1
Fix clerical issues noted in code review
Funkenjaeger f023f0d
Fix improper access of footprint ref in kicad.py
Funkenjaeger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import io | ||
|
|
||
| from .common import EcadParser, Component | ||
|
|
||
|
|
||
| class EagleParser(EcadParser): | ||
| import json | ||
Funkenjaeger marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| class EagleJsonDecoder(json.JSONDecoder): | ||
| def __init__(self, *args, **kwargs): | ||
| import json | ||
| json.JSONDecoder.__init__(self, object_hook=self.object_hook, *args, **kwargs) | ||
|
|
||
| def object_hook(self, obj): | ||
| if '_type' in obj and obj['_type'] == 'InteractiveHtmlBom.ecad.common.Component': | ||
| return [Component(c['ref'], c['val'], c['footprint'], c['layer'], c['attr']) for c in obj['object']] | ||
Funkenjaeger marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| else: | ||
| return obj | ||
|
|
||
| def get_eagle_pcb(self): | ||
| import json | ||
| with io.open(self.file_name, 'r') as f: | ||
| return json.load(f, cls=self.EagleJsonDecoder) | ||
|
|
||
| def _verify(self, pcb): | ||
|
|
||
| """Spot check the pcb object.""" | ||
| if 'pcbdata' not in pcb: | ||
| self.logger.error('No pcbdata object.') | ||
| return False | ||
|
|
||
| if 'components' not in pcb: | ||
| self.logger.error('No components object.') | ||
| return False | ||
|
|
||
| return True | ||
|
|
||
| def parse(self): | ||
| pcb = self.get_eagle_pcb() | ||
| if not self._verify(pcb): | ||
| self.logger.error('File ' + self.file_name + | ||
| ' does not appear to be valid Eagle json file.') | ||
| return None, None | ||
|
|
||
| return pcb['pcbdata'], pcb['components'] | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.