issus / altiumsharp Goto Github PK
View Code? Open in Web Editor NEWC# .NET Standard library to read Altium library files and render them
License: Apache License 2.0
C# .NET Standard library to read Altium library files and render them
License: Apache License 2.0
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.
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.
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');
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?
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
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
System.IndexOutOfRangeException: Read past the end of the block
at AltiumSharp.CompoundFileReader1.ReadBlock[T](BinaryReader reader, Func
2 interpreter, Func1 onEmpty, Int32 emptySize) in C:\AltiumSharp\AltiumSharp\CompoundFileReader.cs:line 371 at AltiumSharp.CompoundFileReader
1.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.CompoundFileReader
1.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)
Hello,
First of all, thank you very much for developing and maintaining the AltiumSharp project. This tool is incredibly useful and greatly simplifies the handling of Altium files.
I am currently facing an issue and would like to ask for your assistance: how can I use AltiumSharp to read ".PcbDoc" files? Is there any sample code or documentation available that I could refer to?
Specifically, I would like to:
Thank you once again for your hard work and help!
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>();
}
// ...
When rendering big components with small pins, such as this microcontroller, the pad designators are too big and overlap
Footprint resource not found: RX10-18155
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.
Hello,
I'm interested in this library. can you please explain how it's possible to produce gerber files and NC drill files using this library?
Hi, the name and year is missing from the license
Line 189 in 953188d
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.