Skip to content
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

Copying Gerber data to reuse it #3

Open
BAndiT1983 opened this issue May 30, 2020 · 2 comments
Open

Copying Gerber data to reuse it #3

BAndiT1983 opened this issue May 30, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@BAndiT1983
Copy link

Hi, this is a very nice module and a great addition to pcb-tools.

At the moment we try to create a panel for several PCBs, which are placed in arrays like 2x5, and it takes quite a lot of time as the Gerber data has to be loaded over and over from the disk for the placement, as offset() moves the whole data. Tried to do deepcopy() but this fails with a message about dict_values.

One workaround i can think of is to offset the data back, but this could probably lead to problems and slight offsets

Is there a way to create a copy of Gerber data and reuse it? Would speed up the process a lot.

@opiopan
Copy link
Owner

opiopan commented May 31, 2020

Thank you for using this library and your comment.
Unfortunately, There is no way to deprecate gerber object that can be merged individually at this moment.
I agree with you, parsing a gerber file should be only once each file.
I try to modify code.

Please wait a while until this modification is done.

@opiopan opiopan added the enhancement New feature or request label May 31, 2020
@BAndiT1983
Copy link
Author

Back to this topic after a while, as we're creating new panels and loading takes a lot of time, but with following workaround it seems to allow to clone the data:

def clone_gerber_file(file):
    return GerberFile(copy.deepcopy(file.statements), copy.deepcopy(file.settings),
                      copy.deepcopy(file.primitives), file.apertures)

Note: Looks like apertures are preventing deep copy on the object itself -> TypeError: cannot pickle 'dict_values' object

Tests still ongoing, so no warranty given and possible side-effects unknown yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants