Skip to content

LCSC values not removed from board #566

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

Open
TAMPCO opened this issue Jan 22, 2025 · 4 comments
Open

LCSC values not removed from board #566

TAMPCO opened this issue Jan 22, 2025 · 4 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@TAMPCO
Copy link
Contributor

TAMPCO commented Jan 22, 2025

Hi everyone ! Not sure if that's just me or if the issue is common to everyone, so here it goes.

Problem : after setting an LCSC value to a component, a custom LCSC field appears for that specific component at board level. If you remove LCSC number from the plugin's interface, then close the interface and open it up again, the board's LCSC value has not been removed and now appears again. This behaviour prevents

Steps to reproduce the behavior:

  1. Create a new project, add a component to the schematic and update the board to place the component.
  2. In the PCB editor, open Bouni's plugin and assign an LCSC component to the database.
  3. Close the plugin interface, then open it again and click on "remove LCSC number" for the component.
  4. Close the plugin interface and open it again : the LCSC number has now been taken from the board.

Expected behaviour :
When removing the LCSC value on the plugin interface, value should also be removed from the custom field of the component in the board.

Side note : when removing the LCSC value, the LCSC number, type and stock numbers will not be removed immediately, only if you click somewhere else. Also, the new LCSC Params column is not removed at all, even if you click somewhere else. Should I open another issue for this visual problems ? I'm not really used to using Github a lot :)

Thank you very much for your help !
Best regards

Application: KiCad x64 on x64

Version: 8.0.8, release build

Libraries:
	wxWidgets 3.2.6
	FreeType 2.13.3
	HarfBuzz 10.0.1
	FontConfig 2.15.0
	libcurl/8.10.1-DEV Schannel zlib/1.3.1

Platform: Windows 11 (version 26100), édition 64-bit, 64 bit, Little endian, wxMSW

Build Info:
	Date: Jan 11 2025 18:59:49
	wxWidgets: 3.2.6 (wchar_t,wx containers)
	Boost: 1.86.0
	OCC: 7.8.1
	Curl: 8.10.1-DEV
	ngspice: 44
	Compiler: Visual C++ 1942 without C++ ABI

Build settings:

@TAMPCO
Copy link
Contributor Author

TAMPCO commented Jan 23, 2025

About the side note : I was able to fix this in datamodel.py line 215 (function remove_lcsc_number), by replacing item[self.columns["PARAMS_COL"]] = "" with obj[self.columns["PARAMS_COL"]] = ""

@TAMPCO
Copy link
Contributor Author

TAMPCO commented Jan 23, 2025

By looking at the code in mainwindow.py, it seems like assigning an LCSC number also adds it to the board automatically. However, removing it only removes the LCSC number from the main plugin interface, note from the board. I added the following code between line 740 and 741, and it seems to work :

board = self.pcbnew.GetBoard()
fp = board.FindFootprintByReference(ref)
set_lcsc_value(fp, "")

I'm not sure that this is the correct way to implement the solution though !

@Bouni
Copy link
Owner

Bouni commented Feb 3, 2025

Would you mind submiting a PR?
I will test it as soon as my free time allows me to do so and merge it if everything works fine.

@Bouni Bouni added bug Something isn't working enhancement New feature or request labels Feb 3, 2025
TAMPCO added a commit to TAMPCO/kicad-jlcpcb-tools that referenced this issue Feb 4, 2025
See issue Bouni#566. With this commit :
- When LCSC value is removed from a component in the main window, the params display gets updated as well.
- When LCSC value is removed from a component in the main window, the footprint's LCSC field is emptied as well, preventing the footprint from reloading its previous LCSC value into the database.
@TAMPCO
Copy link
Contributor Author

TAMPCO commented Feb 4, 2025

Thanks for your replied Bouni ! I think I managed to make a pull request.

Bouni pushed a commit that referenced this issue Mar 5, 2025
…569)

* Fixed params display in mainwindow and LCSC board value when removed

See issue #566. With this commit :
- When LCSC value is removed from a component in the main window, the params display gets updated as well.
- When LCSC value is removed from a component in the main window, the footprint's LCSC field is emptied as well, preventing the footprint from reloading its previous LCSC value into the database.

* Improve resistor unit management

Improvement : when a component designator starts with an "R" and its value ends either with R (like in a 180R resistor), r (like a 180r resistor) or an o (like a 180o resistor), replace the last letter with the Omega symbol. Will work with different value ranges (kR, kr, ko, MR, Mr, Mo, whatever people use...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants