CADence.GerberParser.Core
1.0.1-pre-release
dotnet add package CADence.GerberParser.Core --version 1.0.1-pre-release
NuGet\Install-Package CADence.GerberParser.Core -Version 1.0.1-pre-release
<PackageReference Include="CADence.GerberParser.Core" Version="1.0.1-pre-release" />
<PackageVersion Include="CADence.GerberParser.Core" Version="1.0.1-pre-release" />
<PackageReference Include="CADence.GerberParser.Core" />
paket add CADence.GerberParser.Core --version 1.0.1-pre-release
#r "nuget: CADence.GerberParser.Core, 1.0.1-pre-release"
#:package CADence.GerberParser.Core@1.0.1-pre-release
#addin nuget:?package=CADence.GerberParser.Core&version=1.0.1-pre-release&prerelease
#tool nuget:?package=CADence.GerberParser.Core&version=1.0.1-pre-release&prerelease
Library Documentation
Overview
This library is a comprehensive solution for working with Gerber files and layers in PCB design. Currently, it supports 274-x. It provides a set of classes to manage various types of PCB layers, including copper layers, solder masks, silkscreen, and substrate. These layers are processed with the help of parsers and factories, which simplifies data manipulation, performing geometric calculations, and creating the final design.
Installation
To use this library, add the project to your C# solution. .NET Core 6 or later is required.
Getting Started
1. Initializing the Parser
To use the library, you need to initialize the DI containers, obtain the service for parsing the archive, get the factory service, and initialize the layers. For example:
ServiceCollectionExtensions.Initial();
Then:
List<ILayer> layers;
// path - path to the PCB data archive
using (var stream = new MemoryStream(File.ReadAllBytes(path)))
{
var reader = ServiceCollectionExtensions.GetService<IReader>();
var data = reader.ParseArchive(stream, Path.GetFileName(path));
var fabric = ServiceCollectionExtensions.GetService<ILayerFabric>();
layers = await fabric.GetLayers(data);
}
2. Creating SVG
After obtaining the layers, you can generate SVG files (back layer, front layer), for example:
var svgWriter = ServiceCollectionExtensions.GetService<IWriter>();
// layers - list of layers
// 2 - scale
// true - back layer, false - front layer
// outputPathBack - path to save the file
svgWriter.Execute(layers, 2, true, outputPathBack);
svgWriter.Execute(layers, 2, false, outputPathFront);
This will generate SVG files and save them to the specified paths.
3. Calculating the Distance Between PCB Objects
You can calculate the distance between a hole and a pad, as well as the distance between copper traces. To do this, set the flag to true:
ExecuteAccuracy.SetExecute(true);
After that, obtain the layers with the required interface, then execute the distance calculation method:
var coppers = layers.OfType<ICopper>().ToList();
var box = CalculateAccuracyHelper.Execute(await coppers[0].GetAccuracy(),
await coppers[1].GetAccuracy());
⚠️ Attention!
Due to the nature of the Clipper2 library and floating-point precision (double), the calculated distances may have a margin of error ranging from 0.5% to 10%. Keep this in mind when using the results in critical design constraints.
PCB Layer Previews
Nuget
📦 NuGet: CADence.Core
📦 NuGet: CADence.Abstractions
Conclusion
This library provides a powerful and flexible way to work with Gerber files and their layers. It combines parsing, rendering, and precision calculation into a simple and convenient API. Following the provided examples, you can quickly integrate it into your project and start working efficiently with PCB layers.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- CADence.GerberParser.Abstractions (>= 1.0.1-pre-release)
- SharpCompress (>= 0.39.0)
-
net7.0
- CADence.GerberParser.Abstractions (>= 1.0.1-pre-release)
- SharpCompress (>= 0.39.0)
-
net8.0
- CADence.GerberParser.Abstractions (>= 1.0.1-pre-release)
- SharpCompress (>= 0.39.0)
-
net9.0
- CADence.GerberParser.Abstractions (>= 1.0.1-pre-release)
- SharpCompress (>= 0.39.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 1.0.1-pre-release | 185 | 4/5/2025 | |
| 1.0.0 | 276 | 4/12/2025 | |
| 1.0.0-pre-release | 184 | 4/4/2025 |