Giter Site home page Giter Site logo

Comments (14)

jnavila avatar jnavila commented on May 26, 2024 1

It's feasible and it's indeed a useful degraded mode.

from plotkicadsch.

leoheck avatar leoheck commented on May 26, 2024

If you have any idea on how to implement this, you could try to guide me in making these changes if you don't have much time or energy.

from plotkicadsch.

jnavila avatar jnavila commented on May 26, 2024

It may be a bit difficult for a first issue. I may have some time tomorrow for this. If you still want to try and tackle it, here is the line where the component is looked for in the library and where the exception is raised:

let thecomp =
try Lib.find lib (fix_illegal_chars comp_name)
with _ -> raise (Component_Not_Found comp_name)

So we have to add a parameter to the function, and bypass the raising of exception in case of component not found. Something in the lines of:

  let plot_comp (lib, _, _) comp_name part rotation origin fail_on_missing (ctx : drawContext)
      =
    let rot = rotate rotation origin in
    try let thecomp =
      Lib.find lib (fix_illegal_chars comp_name)
      in
      ( List.fold_left (plot_elt rot thecomp part) ctx thecomp.graph
    , thecomp.multi )
    with _ -> if fail_on_missing then raise (Component_Not_Found comp_name) else (ctx, false)

Then, the parameter must be passed on at the level of kicadsch.ml

let canevas', is_multi =
CPainter.plot_comp lib sym m_unitnr origin transfo

and then from

let parse_line line (ctx:schContext) =

and up from:

let process_file initctx filename =
let parse c l = S.parse_line l c in

where parse_line is used, and up again to all prototypes and call sites of process_file. Then the option can be added to:

let doit from_fs to_fs file_to_diff differ textdiff libs keep colors zone_color =

and finally as a command line parameter to plotgitsch.ml. Of course, the interface change of the kicadlib will also affect plotkicadsch.

So the core of the change is trivial, but the management of the option is quite work intensive. Good news is, OCaml won't let the compilation finish until everything typechecks correctly, so once it compiles, it's almost sure to work as expected.

If you're still interested, I recommend that you use VS Code and the OCaml mode to help you with the typing.

from plotkicadsch.

jnavila avatar jnavila commented on May 26, 2024

Ah, the interface files (*.mli) need also to be updated.

from plotkicadsch.

leoheck avatar leoheck commented on May 26, 2024

Alright, I was struggling to put everything you said working. And it looks you put clear instructions for me here. So the big barrier now is the language and the syntax. Every little thing I do doesn't compile.

Trying a new approach. If I got everything right, I could ignore this because most of the part is just to make the tool user-friendly. So to test the functionality, I can then:

with _ -> raise (Component_Not_Found comp_name)

With this

with _ -> (ctx, false)

Then I removing this

exception Component_Not_Found of string

I was able to compile it without failing.

And WOW. It works. Finally, I could make a change in OCaml. This was hard.
Now I am not seeing exceptions but the plot itself.

Interesting that I am not seeing any point where the missing component is.
But I am not using Plotgitsch to compare. I am using plotgitsch to generate images only.
image

And this is the issue I was seeing for this design.

plotgitsch-dir -d ./ -l .//board-cache.lib -c FF0000:008FFF:FFFFFF:222222 5d48ef7 7e1baef # &> /dev/null
Use compare (ImageMagick) between bitmaps between Git rev 5d48ef7 and Git rev 7e1baef
Exception Kicadsch__Kicadlib.MakePainter(P).Component_Not_Found("Connector_Generic:Conn_01x03")

from plotkicadsch.

jnavila avatar jnavila commented on May 26, 2024

Try removing the -l .//board-cache.lib option.

from plotkicadsch.

leoheck avatar leoheck commented on May 26, 2024

It seems to be working. So does it mean the library is not needed anymore?

➜ plotgitsch -c FF0000:008FFF:FFFFFF:222222 5d48ef7 e0bb0ff

Use compare (ImageMagick) between bitmaps between Git rev 5d48ef7 and Git rev e0bb0ff
Exporting...
sch1-board.svg (e0005d)
sch2-board.svg (1348a8)

Ah, this is the output of my git-imgdiff

This is the project that was giving the exception. The project is not at the root of the repo too.

What did you expected to see?

from plotkicadsch.

jnavila avatar jnavila commented on May 26, 2024

Adding the library would help find components in case the cache lib has not been committed.

About my expectations, assuming that the connector's component was missing in the cache lib of oldest revision, I would expect it to not be drawn there, while still present in the newest one, so the diff would show the component's shape being added, but not its reference and label which are drawn at the sheet level.

What did you expect?

from plotkicadsch.

leoheck avatar leoheck commented on May 26, 2024

Adding the library would help find components in case the cache lib has not been committed.

Oh, so the -l is not for the -cache-lib since you are saying cache lib is already the default place for looking for missing parts.

What should I use with the -l then? For instance, my project uses too many libraries. Does this flag accept a list of files or a duplication of the same flag? I am using it as default, to make sure I will have a plot of the schematics but with the -cache-lib instead.

Alternatively, maybe you are saying that it tries to use the cached.lib from the commit's history by default, but if you pass -l it will use this current file (latest version of this file) instead of or as the alternative.

I am not pretty sure if I got the whole behavior of this -l flag

What did you expect?

The same as you described. But I am not sure if that has happened.
For instance, I am comparing (actually generating images for) the current commit with every other commit in the whole git history.
Then I am comparing the images using an image comparing tool externally (the one in Kicad-Diff, for instance)
So, I am not sure if I saw a diff where I have this missing part in blue/red indicating that it was missing.

I am going to double-check it.

from plotkicadsch.

leoheck avatar leoheck commented on May 26, 2024

My commit tree just has 7 commits.

This is the HEAD vs HEAD^1
image

This is the HEAD vs 1st commit
This image shows both versions have this missing header J1.
image

This is the HEAD vs 3rd commit
image

I was expecting to see at least one diff that shows a missing header, but none of them was. And also, at least one with the header in blue but no red one (or the opposite, with the header in red but the blue missing).

from plotkicadsch.

jnavila avatar jnavila commented on May 26, 2024

The -l option preloads the given lib (be it cache or not) from the file system before trying to find the -cache.lib in the given commit for each commit to compare. You can add several --lib=<library.lib> options on your command line and all the libs will be preloaded in turn for both versions to compare.

From your screen capture
https://user-images.githubusercontent.com/1277920/118813550-a4cd2100-b885-11eb-8c0e-bcf9f40e9622.png

We can see the missing connector. So, I'm not quite sure what we are looking for here. Maybe could you share a minimal project that exhibits your issue.

Anyway, I can implement the correct option management for the change you've made if you find it useful.

from plotkicadsch.

leoheck avatar leoheck commented on May 26, 2024

from plotkicadsch.

leoheck avatar leoheck commented on May 26, 2024

You were right. The image you have referenced shows the missing part. It happened that the change in that specific commit was in the same spot and I got confused a bit.

from plotkicadsch.

jnavila avatar jnavila commented on May 26, 2024

fixed by c7513d1

from plotkicadsch.

Related Issues (20)

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.