InteractiveHtmlBom
InteractiveHtmlBom copied to clipboard
Work-in-progress: Centroid file parser
Generic Centroid parser
This patch introduces the GenericCentroidParser class to process the PCB pick-n-place / centroid file. This cripples the script
generate_interactive_bom.py
, so users are advised to invoke the centroid2pcbdata.py
instead.
The input centroid file follows the following pattern:
# PcbXY Version 1.0
# Date: Fri 02 Oct 2020 05:39:00 AM GMT UTC
# Author: author
# Title: (unknown) - PCB X-Y
# RefDes, Description, Value, X, Y, rotation, top/bottom
# X,Y in mm. rotation in degrees.
# --------------------------------------------
CR1,"diode-bridge-kbp2g.fp","Bridge_Rect",121.92,85.72,90,top
C19,"0603","0.1uF/16v",100.33,66.04,0,bottom
C6,"0805","10uF/16v",24.77,78.11,180,top
pad4,"hole-155mil.fp","hole-155",133.35,82.55,0,top
C5,"0603","1uF/16v",24.13,85.09,180,top
...
The command generate_interactive_bom.py file.xy
produces the HTML with a complete list of components on front and back side. However, the graphical view of the PCBs are empty because of missing image data plus size information.
A script centroid2pcbdata.py
is provided to assist users to convert a centroid file to a valid json-serialized pcbdata object:
usage: centroid2pcbdata.py [-h] [-i board.xy] [-o pcbdata.json] [-W M] [-H N]
Parse centroid file
optional arguments:
-h, --help show this help message and exit
-i board.xy, --input board.xy
Input centroid file
-o pcbdata.json, --output pcbdata.json
Output pcbdata file
-W M, --width M Width of image, in mm
-H N, --height N Height of image, in mm
Photorealistic PCB rendering on back side
A UX breaking change is introduced to the render.js script, where the back side canvas is rotated by 180 degree, and without any horizontal flip.
Such change is necessary because the back side rendering of the PCB is already flipped horizontally.
Here, the photorealistic rendering of the PCB is assumed to be exported by the PCB software as 'basename-front.png', 'basename-back.png' at a specific millimeter-per-pixel scale. The absolute coordinate of each component, as defined in the centroid file (basename.xy), should match the corresponding rendered element of the PCB.