hildogjr / KiCost

Build cost spreadsheet for a KiCad project.
MIT License
519 stars 98 forks source link

feature request: data export to json #431

Closed sebo83910 closed 3 years ago

sebo83910 commented 3 years ago

Hello,

I'm currently struggling to understand the data (parts) structure within the projet. I'm interested by adding an export feature to the tool as I'd like to use output of the tool with another custom tool. So far, I guess I'm not good enough at Python to do this. Because, I'm trying to build a "complex" dictionary but I encounter a structure I'm not familiar with.

What I'd like to have is a list/dictionary like this:

Part1:

so far, no luck. What do you think?

thanks.

hildogjr commented 3 years ago

Hi @sebo83910. Nice to ear some other used of enlargement of the output format.

General aspects

You could use the same software flux control of collapse_refs and suppress_cat_url to control the choice (spreadsheet or your new format), check how they affect __main__.py and kicost.py.

Variables

The parts variable (passed to create_spreadsheet(foo)) is a list of elements, each one is a dictionary with two parts:

sebo83910 commented 3 years ago

Thanks @hildogjr for your inputs. I've been able to make some progress. But it's more a hack than a nice solution so far. I'll see how I could adapt my code based on the elements you've desribed in your comment.

hildogjr commented 3 years ago

Which tool you aim to integrate? Whats is the output format need?

(If is of your interest) keep the code as branch to we keep on track here.

sebo83910 commented 3 years ago

This is a custom tool. So far I use altium to generate an input bom. My first project was to create a simple django project to have a web interface for kicost. But now this is done, I want to use the tool to get some information as the price_tiers in order to update an ERP.

sebo83910 commented 3 years ago

@hildogjr I'm not very familier either with github. I'd like to make sure I understand, you'd allow me to use a branch on your project where I could commit this feature? If you're ok, i'd be more than happy to share this with you. Let me know.

hildogjr commented 3 years ago

At https://github.com/xesscorp/KiCost you fork the project and edit it was you want, you will be a owner of https://github.com/sebo83910/KiCost.

When finished the changes you can merge it (pull request) to be merged to this main repository.

sebo83910 commented 3 years ago

Ok thanks. I'll do it when I finish some tests.