Git Product home page Git Product logo

Comments (10)

qu1ck avatar qu1ck commented on August 24, 2024

It's mainly called from ibom.js through redrawCanvas()

from interactivehtmlbom.

ankithavn avatar ankithavn commented on August 24, 2024

Ohh okay, where is redrawCanvas() called in the self contained html file?

from interactivehtmlbom.

qu1ck avatar qu1ck commented on August 24, 2024

Use the search function on github or in your IDE and you will easily see where it is called.

I'll give you brief overview of how it works but I can't teach you how to read code.
There is ibom.html template in the web directory, it has basic frame of the page and placeholders for javascript, css and pcb data. When python part generates the bom it compiles the pcb data into format that is described in DATAFORMAT.md and injects that data along with all the javascript and css into the template as output. The resulting html file has a window.onload handler which gets executed first thing as browser loads the page, that handler renders initial image and generates the bom table. Each time you resize the window or manipulate the bom in a way that affects the drawing things get rerendered again.

from interactivehtmlbom.

ankithavn avatar ankithavn commented on August 24, 2024

Thank you! I seemed to miss the window.onload handler when initially reading the code and was getting lost. That cleared it up.

from interactivehtmlbom.

ankithavn avatar ankithavn commented on August 24, 2024

I am using https://github.com/juulsA/exportJson in order to extracty json data from Allegro pcb files. And then I edited the json to add a field in every component, called "numdefects". When I try to generate the the html, I am led to an error that is thrown here in "genericjson.py". I cannot follow it further though and I was wondering where the validation occurs and if I can add this extra field in the expected json structure.

image

from interactivehtmlbom.

qu1ck avatar qu1ck commented on August 24, 2024

Validation happens here
https://github.com/openscopeproject/InteractiveHtmlBom/blob/master/InteractiveHtmlBom/ecad/genericjson.py#L41

Most likely you edited the json in a way that breaks schema compliance, make sure you read the schema https://github.com/openscopeproject/InteractiveHtmlBom/blob/master/InteractiveHtmlBom/ecad/schema/genericjsonpcbdata_v1.schema

The error message should tell you what the issue is.

from interactivehtmlbom.

ankithavn avatar ankithavn commented on August 24, 2024

Thank you, that cleared it up.

How can I reference the components in the javascript as I am putting my defect data in the "extra_fields" section of components?

Also, in render.js, what type of object is pcbdata.footprints ? I thought it was a dictionary based off of the dataformat but then in "drawfootprints" and specifically line 388 I see that you iterated through it using pcbdata.footprints.length.

from interactivehtmlbom.

qu1ck avatar qu1ck commented on August 24, 2024

It's an array, you can check such things in browser dev tools console.

from interactivehtmlbom.

ankithavn avatar ankithavn commented on August 24, 2024

Okay, thanks! How can I reference components in the javascript? It is not a part of pcbdata upon checking devtools

from interactivehtmlbom.

qu1ck avatar qu1ck commented on August 24, 2024

I don't understand the question, you reference items in an array as you normally would, by index or you just iterate over it with for (.. of ..) construct. What isn't part of pcbdata?

from interactivehtmlbom.

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.