-
Notifications
You must be signed in to change notification settings - Fork 0
Description
π Before submitting the issue
- I have searched among the existing issues
- I am using a Python virtual environment
π Description of the bug
When using the import_copper_files API using pysherlock, importing Image, XML, Gerber, Trace, and ICP2581 files result in errors.
File: copper-02.gbr, Status: value: -1
message: "Error while parsing file 'GerberTestFile': Failed while parsing IPC-2581 file: Content is not allowed in prolog."
File: copper-04.png, Status: value: -1
message: "Error while parsing file 'ImageTestFile': org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.\r\n\tat org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)\r\n\tat sherlock.common.XMLParser.parse(XMLParser.java:31)\r\n\tat sherlock.common.XMLParser.parse(XMLParser.java:24)\r\n\tat sherlock.file.valor.ValorFileParser.parseFile(ValorFileParser.java:45)\r\n\tat sherlock.file.eda.EDAFileParseTask.parseLayer(EDAFileParseTask.java:416)\r\n\tat sherlock.file.eda.EDAFileParseTask.parseFile(EDAFileParseTask.java:217)\r\n\tat sherlock.file.eda.EDAFileParseTask.run(EDAFileParseTask.java:84)\r\n\tat java.base/java.lang.Thread.run(Unknown Source)\r\n"
File: copper-05.odb.traces, Status: value: -1
message: "Error while parsing file 'TraceTestFile': INTERNAL ERROR: EDAFileParseTask is unable to parse file type 'Copper Layer (UNRECOGNIZED)'"
File: copper-02.xml, Status: value: -1
message: "Error while parsing file 'XMLTestFile': Line(2539): Unknown command ''"
return_codes = sherlock.project.import_copper_files(
ImportCopperFilesRequest(
project="Tutorial Project",
copper_files=[
# Example 1: Gerber file
ImportCopperFile("copper-02.gbr",
copper_file_properties=CopperFile(
file_name="GerberTestFile",
file_type=project_service.CopperFile.FileType.Gerber,
file_comment="This is the Gerber file for the import copper file test",
copper_layer="Layer 2",
polarity=project_service.CopperFile.Polarity.Negative,
layer_snapshot_enabled=False,
cca=["Main Board"],
gerber_file=CopperGerberFile(parse_decimal_first_enabled=True)
)
),
ImportCopperFile(
copper_file="copper-04.png",
copper_file_properties=CopperFile(
file_name="ImageTestFile",
file_type=project_service.CopperFile.FileType.Image,
file_comment="This is the Image file for the import copper file test",
copper_layer="Layer 2",
polarity=project_service.CopperFile.Polarity.Negative,
layer_snapshot_enabled=False,
cca=["Main Board"],
image_file=CopperImageFile(
image_type=project_service.CopperFile.ImageType.Background,
image_color="Red"
)
)
),
ImportCopperFile(
copper_file="copper-05.odb.traces",
copper_file_properties=CopperFile(
file_name="TraceTestFile",
file_type=project_service.CopperFile.FileType.Trace,
file_comment="This is the Trace file for the import copper file test",
copper_layer="Bottom Layer",
polarity=project_service.CopperFile.Polarity.Negative,
layer_snapshot_enabled=True,
cca=["Main Board"]
)
),
ImportCopperFile(
# copper_file="copper-02.xml",
copper_file = "Icepak\\TestExport\\IPC2581A-TestCase2\\copper-12.xml",
copper_file_properties=CopperFile(
file_name="XMLTestFile",
file_type=project_service.CopperFile.FileType.ODB_XML,
file_comment="This is the Trace XML file for the import copper file test",
copper_layer="Layer 1",
polarity=project_service.CopperFile.Polarity.Positive,
layer_snapshot_enabled=True,
cca=["Main Board"]
)
)
]
)
)
for response in return_codes:
print(f"File: {response.fileName}, Status: {response.returnCode}")
π Steps to reproduce
Use import_copper_files() with any of the file types
π» Which operating system are you using?
Windows
π Which ANSYS version are you using?
Version 2026 R1 (26.1b20250721), build 20250721.1
Unified Package Created: 202507220047P00
Unified Package Name: 2025-07-22 00:47 P00
π Which Python version are you using?
3.10
π¦ Installed packages
PS C:\Users\mmarkowi> python -m pip freeze
annotated-types==0.7.0
ansys-api-sherlock==0.1.47
ansys-sherlock-core-0.9.0
grpcio==1.67.1
protobuf==5.29.5
pydantic==2.11.7
pydantic_core==2.33.2
typing-inspection==0.4.1
typing_extensions==4.14.0