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

[PyGerber]: When I am trying to import and render .art Gerber Files from Cadence Allegro, it shows error #333

Open
6 tasks done
Rajkisan opened this issue Nov 6, 2024 · 2 comments
Assignees
Labels
bug Something isn't working ready-for-reproduction Issue is ready for reproduction after all required checkboxes was reported as acknowledged
Milestone

Comments

@Rajkisan
Copy link

Rajkisan commented Nov 6, 2024

PyGerber Bug Report

Mandatory checks

Checks listed below are mandatory for opening a new issue.

If haven't done any of the checks listed below, please do that, we will not look into
the issue until all of the checks in mandatory checks section are checked.

Before opening this issue:

  • I have reviewed the README for guidelines and haven't found a solution there.
  • I have reviewed the PyGerber documentation and haven't found a solution there.
  • I have reviewed the existing open issues and verified that this is not a
    duplicate.
  • I have reviewed the existing closed issues and verified that this was already
    resolved or marked as won't fix.
  • I have reviewed the existing pull requests and verified that this is not a already
    known issue.
  • I have reviewed the existing discussions and verified that this is not a already
    known issue.

This is my code

from pygerber.gerber.api import GerberFile


# Function to read the file content and process it with pygerber
def process_gerber_file(file_path):
        # Open the Gerber file and read the entire content into a string
        with open(file_path, 'r') as gerber_file:
            gerber_content = gerber_file.read()

        # Create a GerberFile object using pygerber and load the content as a string
        outline_layer = GerberFile.from_str(gerber_content)
        vm = outline_layer.render_with_pillow()
        bounding_box = vm.get_image_space()
        width = bounding_box.max_x_mm - bounding_box.min_x_mm
        height = bounding_box.max_y_mm - bounding_box.min_y_mm
        print(width, height)



# Example usage: Replace with the path to your Gerber file
gerber_file_path = "BOTTOM.art"
process_gerber_file(gerber_file_path)

It shows raise EmptyAutoSizedLayerNotAllowedError(top_layer.layer_id)
pygerber.vm.types.errors.EmptyAutoSizedLayerNotAllowedError: id='%main%'

Expected behavior

It has to return the size by width and height of the layer

Environment:

Please complete the following information:

  • Operating system: [macOS24.04]
  • Python version: [3.12.0]
  • PyGerber version: [3.0.0a3]
@Rajkisan Rajkisan added bug Something isn't working waiting-for-checkboxes Issue is waiting for reporter to check all relevant checkboxes in issue template labels Nov 6, 2024
@Rajkisan
Copy link
Author

Rajkisan commented Nov 6, 2024

Flexray_board_fabrication_and_assembly.zip
TOP.art and BOTTOM.art

@Argmaster
Copy link
Owner

Hi, thanks for reporting the issue. If I were to quickly point some fingers on possible culprits, this behavior can be triggered by for example rendering empty file or rendering with too low resolution. I haven't yet investigated deeper, I will do that soon. I acknowledge that this is not the most helpful message one could get, I will work on that in the future releases. Issue #313 is somewhat related, but I haven't yet started working on that.

@Argmaster Argmaster added ready-for-reproduction Issue is ready for reproduction after all required checkboxes was reported as acknowledged and removed waiting-for-checkboxes Issue is waiting for reporter to check all relevant checkboxes in issue template labels Nov 6, 2024
@Argmaster Argmaster moved this to Research in PyGerber Nov 6, 2024
@Argmaster Argmaster added this to the 3.0.0a4 milestone Nov 6, 2024
This was referenced Nov 24, 2024
@Argmaster Argmaster modified the milestones: 3.0.0a4, 3.0.0b1 Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready-for-reproduction Issue is ready for reproduction after all required checkboxes was reported as acknowledged
Projects
Status: Research
Development

No branches or pull requests

2 participants