juulsA / exportJson

Skill script for Allegro PCB designer, which generates a JSON representation of the board.
MIT License
17 stars 8 forks source link

Does this change the actual alegro file as well? #4

Closed ankithjv closed 1 year ago

ankithjv commented 1 year ago

Does this change the alegro file it is exporting too?

juulsA commented 1 year ago

Sorry for my late response ... no, the script does not change the allegro file.

ankithjv commented 1 year ago

thank you! Is there a way for me to change the script so the json that gets outputted includes all of the inner layers as well, not just the front and back?

juulsA commented 1 year ago

Theoretically you could changed it this way, but I'm not sure, if the interactive html bom supports this ... To do so, you have to expand the case statement and append the copper to the correct position afterwards ...

ankithjv commented 1 year ago

can you give a little bit more guidance? How should I change the case statement and where do I append the copper? Sorry for the inconvenience.

juulsA commented 1 year ago

You should first verify, that the interactive html bom does support displaying the inner layers ... I don't want to say something wrong, but the time I wrote the script, it did not! If the ibom supports it, I think I would implement this feature anyway.

ankithjv commented 1 year ago

The ibom doesn't currently feature inner layers however I am thinking of adding the support myself. I also found another hard fork that does implement the extra layers (Written for Eagle CAD but I think I can make it work with json). The allegro skill script is just Mandarin to me so the json conversion is tough.

juulsA commented 1 year ago

Ok, but I can only recommend you to try to understand what is happening here, although I know it is not easy the first time ...

The "only" thing you have to do is, to fit the addCopper() procecdure to your needs. And at this moment I see, that my code could run a lot faster, because the inner layers are already parsed, but not stored ...

So any time there is a case( child->layer ... loop you need to add code to the t case, which is whenever the copper is not on top or bottom or you could eliminate the whole case loop and do the storing of the elements more dynamically, what is the best solution I think, because the number of layers can be different.

I would suggest to to declare two tables, one for the tracks and one for the zones. This is done by:

tracks = makeTable( "tracks" nil )
zones = makeTable( "zones" nil )

In the following you have to assign parsed elements depending on their layers (this needs to be done for the zones as well):

if( tracks[ child->layer ] then ; checks, if the list exists
   tconc( tracks[child->layer] track ) ; appends the track to the list
else
   tracks[child->layer] = tconc( nil track ) ; creates a new list
)

At the end you have to loop over all layers layers = tracks->? and build the json string as I did in line 2090 to 2144

juulsA commented 1 year ago

I have almost finished what you need, because I think this makes my code more "elegant". The only questions is, what is the naming convention for the inner layers?

juulsA commented 1 year ago

Check out my latest commit. It supports the export of the inner layers.

ankithjv commented 1 year ago

thank you so much I appreciate it! Will this still work for the existing ibom? This is the hard fork I am going to use ----- > https://github.com/oceanofthelost/InteractivePCB

juulsA commented 1 year ago

If you don't pass exportInnerLayers t it is the normal export, without the inner layers.

This is the hard fork I am going to use ----- > https://github.com/oceanofthelost/InteractivePCB

I already looked it up, unfortunately there is no "rendered" demo ... so I can't imagine how it looks ....

ankithjv commented 1 year ago

okay thanks again, I can probably edit ibom to allow for inner layer integration if https://github.com/oceanofthelost/InteractivePCB doesn't work out. Will let you know how it goes thanks again!

ankithjv commented 1 year ago

I am getting this error when exporting and resulted in an empty json Error eval: unbound variable - indentedStrings. What do yo uthink is the issue because I saw the code and it looked like you handled it? Only for one file

ankithjv commented 1 year ago

I would put the file up but github doesnt support the file type.

juulsA commented 1 year ago

Can you put everything in a zip-folder?

ankithjv commented 1 year ago

Sample.zip

juulsA commented 1 year ago

Please check out my latest commit. It should be working now.

ankithjv commented 1 year ago

It worked thank you!