GithubHelp home page GithubHelp logo

vanipm / altiumsharp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from issus/altiumsharp

0.0 0.0 0.0 192 KB

C# .NET Standard library to read Altium library files and render them

License: Apache License 2.0

C# 100.00%

altiumsharp's Introduction

AltiumSharp

Reads and writes Altium library files, rendering them with C#. Many thanks to Tiago Trinidad (@Kronal on Discord) for his huge efforts on this library.

Usage

Opening a PcbLib File

// open a PcbLib file.
using (var reader = new PcbLibReader(fileName))
{
    // read the file
    reader.Read();

    // iterate through each component in the library
    foreach (var component in reader.Components)
    {
        Console.WriteLine($"{component.Name}, {component.Pads}, {component.Primitives.Count()}");
    }

    // Settings in the header.
    _displayUnit = reader.Header.DisplayUnit;
    _snapGridSize = reader.Header.SnapGridSize;
    _components = reader.Components.Cast<IComponent>().ToList();
}

Open a SchLib File

// open a SchLib file.
using (var reader = new SchLibReader(fileName))
{
    reader.Read();

    // iterate through each component in the library
    foreach (var component in reader.Components)
    {
        Console.WriteLine($"{component.Name}, {component.Description}");
    }

    // settings in header.
    _displayUnit = reader.Header.DisplayUnit;
    _snapGridSize = reader.Header.SnapGridSize;
    _components = reader.Components.Cast<IComponent>().ToList();
}

Rendering a Component

_renderer = new PcbLibRenderer();

if (_renderer != null)
{
    _renderer.Component = _activeComponent;
    
    if (_pictureBoxImage == null) _pictureBoxImage = new Bitmap(pictureBox.Width, pictureBox.Height);
    using (var g = Graphics.FromImage(_pictureBoxImage))
    {
        _renderer.Render(g, pictureBox.Width, pictureBox.Height, _autoZoom, fastRendering);
    }
    _autoZoom = false;
}

altiumsharp's People

Contributors

issus avatar ttrinidad avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.