GdsSharp 0.1.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package GdsSharp --version 0.1.5                
NuGet\Install-Package GdsSharp -Version 0.1.5                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GdsSharp" Version="0.1.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GdsSharp --version 0.1.5                
#r "nuget: GdsSharp, 0.1.5"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install GdsSharp as a Cake Addin
#addin nuget:?package=GdsSharp&version=0.1.5

// Install GdsSharp as a Cake Tool
#tool nuget:?package=GdsSharp&version=0.1.5                

GdsSharp

NuGet
A library for reading, editing, and writing Calma GDSII files.

Some helpers are also provided for drawing curves like circles and Bézier curves.

Usage

Reading a GDSii file

using var fileStream = File.OpenRead("file.gds");
var file = GdsFile.From(fileStream);

Writing a GDSii file

using var fileStream = File.OpenWrite("file.gds");
file.WriteTo(fileStream);

Editing example

An example of how to create a GDS file from scratch and creating some shapes using the helpers can be found in the example project. This is the created GDS file: image

Helpers

Some helper functions are provided to draw curved shapes like circles and Bézier curves.

Circle

// Creates a circle at (0, 0) with radius 100. 
// An optional fourth parameter can be used to specify the number of points to use for the discretization of the circle.
var elemCircle = CircleBuilder.CreateCircle(x: 0, y: 0, radius: 100, numPoints: 128),

Rect

// Creates a rectangle at (0, 0) with width 100 and height 200.
var elemRect = RectBuilder.CreateRect(x: 0, y: 0, width: 100, height: 200);

Bézier curve

The Bézier curve is created using a builder pattern. The curve is defined by a list of control points, the library supports a maximum of 16 control points per curve. Like the circle, an optional parameter can be used to specify the number of points to use for the discretization of the curve.

// Generate a line from a Bézier curve with width 200.
// When using BuildPolygon the curve will be a GdsBoundaryElement.
var elemPoly = new BezierBuilder()
    .AddPoint(x: 0, y: 0)
    .AddPoint(0, 1000)
    .AddPoint(1000, 1000)
    .AddPoint(1000, 0)
    .BuildPolygon(width: 200, numVertices: 128);

// When using BuildLine the curve will be a GdsPathElement.
// BuildPolygon is recommended because it produces a smaller error in the curve.
var elemLine = new BezierBuilder()
    .AddPoint(x: 0, y: 0)
    .AddPoint(0, 1000)
    .AddPoint(1000, 1000)
    .AddPoint(1000, 0)
    .BuildLine(width: 200, numVertices: 128);

Missing features

I have not implemented all features of the GDSii spec, some terminals like STRTYPE are not not released, and I am not sure if they are used in files. If you have a file and the library crashes because of this, let me know or open a PR!

Furthermore, I have also not implemented ATTRTABLE, none of the files I currently have use it and I'm not sure how it is formatted exactly. Again, if you have a file that uses it and want to contribute, let me know or open a PR!

Contributing

If you want to contribute, feel free to open a PR or issue.

License

This project is licensed under the LGPL license, see the license file for the full text.

If this does not suit your needs, feel free to contact me and we can work something out.

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.

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
0.3.2 88 11/8/2024
0.3.1 71 11/8/2024
0.3.0 78 11/8/2024
0.2.0 104 10/4/2024
0.1.6 79 8/2/2024
0.1.5 59 7/31/2024
0.1.4 91 7/30/2024
0.1.3 273 11/20/2023
0.1.3-origin-master0001 109 11/20/2023
0.1.2-origin-master0001 117 11/13/2023