GithubHelp home page GithubHelp logo

altiumsharp's People

Contributors

alexgubanow avatar issus avatar thomas-linder-grafgroup avatar ttrinidad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

altiumsharp's Issues

Footprint rename

Is it possible to rename a footprint inside a PcbLib? I can change the designID in the SchLib for symbols but for footprints I see the pattern variable but this does not change the footprint name. Kind regards.

Footprint name clamping at 32 chars generates Exception in case of similar names of footprints

I noticed an issue when trying to import footprints with more than 32 chars and a similar name up until the 32nd char.

The problem appears in the function ReadSectionKeys of PcbLibReader.cs, and both libRef and sectionKey appear to clamp the name at 32 chars. The first item is added to the SectionKeys List, while the second one, which shows the same libRef, is not added and triggers the exception.

The debugger shows the Exception System.ArgumentException: Another element with the same key has been already added.

I attached a picture with the result and the same pcblib file used for the screenshot with just two footprints with similar names which will prompt the issue.

image
PcbLib3.zip

usage of AltiumSharp as an bridge to EasyEDA

I have in mind to create some kind of bridge between LCSC.com library and altium. Draft idea is:

Most likely user will know lcsc part number, so this gives possibility to use local database with some weekly update or by user button click
EasyEDA don't have many 3d models, api is https://easyeda.com/analyzer/api/3dmodel/02b05a0ee22f4d9baf3db5f593f6303a? but currently I have no clue where from this uid, can be wiresharked, if needed. 3d model itself is an obj file format, tho
I'm planning to try out some in next days, but before start, would like to hear your thoughts on such idea.

Support PinTextData R/W

09cb8bd Add preliminary support for reading PinTextData from SchLib. But the data is discarded after read out, nor saved when writing to file. Currently I'm adding a byte array field to SchPin to store the raw data. However, I don't know the meaning of it.

I reverse engineered AD KiCad Importer plugin (including the SDK dll with it) but not finding any useful components (regarding the binary file format). But this class looks close to it.

namespace KiCadLib.SCH
{
    internal class SchTextBase : SchItemBase
    {
        public SchTextBase()
        {
            this.Value = string.Empty;
            this.Orient = SchTextBase.Orientation.Left;
            this.Height = 0;
            this.Width = 0;
            this.Bold = false;
            this.Italic = false;
            this.Mirrored = false;
            this.HorizAlign = SchTextBase.HorizontalAlign.Center;
            this.VertAlign = SchTextBase.VerticalAlign.Center;
            this.Shape = SchTextBase.PinShape.Input;
            this.IsV6 = false;
            this.FieldsAutoplaced = false;
            this.Properties = new List<SymField>();
        }
    // ...

IndexOutOfRangeException: Read past the end of the block

Hi @issus
Thanks a lot in advanced for your effort to develop such a usefull library.
I'm using it to read PcbLib files and get footprint data.
But I have a problem that backs to some PcbLib files.
When I want to read some of them, I get "IndexOutOfRangeException: Read past the end of the block" error.
I will send some of files that generate the error.
Best Regards

some of the PcbLib files:

https://mega.nz/file/PtgS0DbA#ofp-oE-v18lkyyYgY03K13Z5M84yj0XUUUKnCXiKUXo
https://mega.nz/file/D14XxTrD#kP_rl4B0LWp_uDNa2zcc11IBV2RnmYBlW0N6ultHfPA
https://mega.nz/file/G8wmCKDC#6v5ZkirAvwHgRYj_9CIbjO-tpjI_0vbvLGy3vbEd8KQ
https://mega.nz/file/XhBRQTiI#a_abZWu6RFgE0Zx_F3mmzCB_LmSFr0_Q1ksnDQ-9eZc

Stack Trace:

System.IndexOutOfRangeException: Read past the end of the block
at AltiumSharp.CompoundFileReader1.ReadBlock[T](BinaryReader reader, Func2 interpreter, Func1 onEmpty, Int32 emptySize) in C:\AltiumSharp\AltiumSharp\CompoundFileReader.cs:line 371 at AltiumSharp.CompoundFileReader1.ReadBlock(BinaryReader reader, Action1 interpreter, Action onEmpty, Int32 emptySize) in C:\AltiumSharp\AltiumSharp\CompoundFileReader.cs:line 322 at AltiumSharp.PcbLibReader.ReadFootprintPad(BinaryReader reader) in C:\AltiumSharp\AltiumSharp\PcbLibReader.cs:line 282 at AltiumSharp.PcbLibReader.ReadFootprint(String sectionKey) in C:\AltiumSharp\AltiumSharp\PcbLibReader.cs:line 104 at AltiumSharp.PcbLibReader.ReadLibraryData(CFStorage library) in C:\AltiumSharp\AltiumSharp\PcbLibReader.cs:line 643 at AltiumSharp.PcbLibReader.ReadLibrary() in C:\AltiumSharp\AltiumSharp\PcbLibReader.cs:line 676 at AltiumSharp.PcbLibReader.DoRead() in C:\AltiumSharp\AltiumSharp\PcbLibReader.cs:line 26 at AltiumSharp.CompoundFileReader1.Read(String fileName) in C:\AltiumSharp\AltiumSharp\CompoundFileReader.cs:line 90
at AltiuService.Server.Controllers.FileReaderController.Get(String file) in C:\altium\altium\FileReader.cs:line 25
at lambda_method1(Closure, Object, Object[])
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

System.FormatException : Input string was not in a correct format

I've incurred in a not managed Exception when loading a .PcbLib with multiple footprints.
The execution is stopped on line 65 of Parameters.cs when: _data=""
Looks like it happens because AsEnumerable() add empty elements if the string _data contains empty strings (or is empty).
It works better if line 139 of file "Parameters.cs" is changed to:

if (!string.IsNullOrEmpty(item))
                    yield return new ParameterValue(item, '\0');

Dependency on System.Drawing.Common

AltiumSharp has a dependency on System.Drawing.Common and as far as I saw, this is the only dependency tying this project to Windows.

It is technically possible to run System.Drawing.Common outside Windows, but advised not to do so.

Is it planned to exchange this dependency, how high is the priority, and would pull requests be considered?
What would the desired alternative be?

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.