-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add footprint Parameter to Kicad Footprint mapping #44
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
af11704
Implement footprint_parameter to kicad footprint mapping
30350n 9d860eb
Revert bad refactoring
30350n b5a7c92
Reimplement footprint mapping via new Model, Revert old migration
30350n d7febf0
Fix migration, formatting
30350n ad70e1d
Fix migration again
30350n 1340bbd
Add documentation
30350n caccf0f
Add image for documentation
30350n d2e4dfb
Merge remote-tracking branch 'origin/main' into footprint-mapping
30350n 3602d19
Fix README formatting (trailing spaces, headings, image links)
30350n 2249ac8
Limit README to 96 columns
30350n 33239f2
Fix png case
30350n 1e30c11
Revert "Limit README to 96 columns"
30350n 2486e6e
Merge remote-tracking branch 'origin/main' into footprint-mapping
30350n 291bfa1
Fix formatting, Add __str__ function to mapping model
30350n 049d86c
Fix README formatting
30350n f95e882
Update migration
30350n fc47cf4
Add footprint parameter override example, clarify help message
30350n 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 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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,32 @@ | ||
# Generated by Django 3.2.20 on 2023-12-12 16:20 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('inventree_kicad', '0006_progressindicator'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='selectedcategory', | ||
name='footprint_parameter_template', | ||
field=models.ForeignKey(blank=True, help_text='Footprint parameter template for this category, will use KICAD_FOOTPRINT_PARAMETER setting if not set', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='footprint_kicad_categories', to='part.partparametertemplate', verbose_name='Footprint Parameter Template'), | ||
), | ||
migrations.CreateModel( | ||
name='FootprintParameterMapping', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('parameter_value', models.CharField(max_length=200, verbose_name='Footprint Parameter Value')), | ||
('kicad_footprint', models.CharField(max_length=200, verbose_name='KiCad Footprint')), | ||
('kicad_category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventree_kicad.selectedcategory')), | ||
], | ||
options={ | ||
'verbose_name': 'Footprint Mapping', | ||
'unique_together': {('kicad_category', 'parameter_value')}, | ||
}, | ||
), | ||
] |
This file contains 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 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was your intention with that extra parameter? It confused me a fair bit initially.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's just the existing KICAD_FOOTPRINT_PARAMETER setting, but on a per KiCad category level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm uncertain about this particular case. We already have the settings parameter in place for that purpose. I can't envision a scenario where the footprint would be stored across multiple parameters instead of just one. It seems like that could become confusing quite rapidly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well pretty much exactly for the reason this whole PR exists.
In my case for example, I've got a whole bunch of components in InvenTree already. Some of the (resistors, capacitors, etc.) already have a "Package Type" parameter set, which I can use with the introduced functionality here, to map from said "Package Type" to a KiCad Footprint. But that "Package Type" parameter isn't set for all parts. So for some more specialized parts, like Potentiometers or certain ICs or whatever, I'd prefer to actually just add a "KiCad Footprint" parameter directly, which I can change from the InvenTree UI.
So what I'd do is set the global
KICAD_FOOTPRINT_PARAMETER
setting to the "KiCad Footprint" parameter and then override it for certain categories (resistors and capacitors for example) to the "Package Type" parameter.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing confusing about that really, it's just a simple override.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah okay that makes sense now.
Would you be able to add a bit more information to the readme about when you would use which way. There are pretty much 3 then now.
Maybe include an example of some sort.
Cheers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.