diff --git a/InteractiveHtmlBom/ecad/kicad.py b/InteractiveHtmlBom/ecad/kicad.py
index 5e202a9c..0d8425b1 100644
--- a/InteractiveHtmlBom/ecad/kicad.py
+++ b/InteractiveHtmlBom/ecad/kicad.py
@@ -378,6 +378,7 @@ def parse_zones(self, zones):
if zone.GetLayer() in [pcbnew.F_Cu, pcbnew.B_Cu]:
zone_dict = {
"polygons": self.parse_poly_set(zone.GetFilledPolysList()),
+ "width": zone.GetMinThickness() * 1e-6,
}
if self.config.include_nets:
zone_dict["net"] = zone.GetNetname()
@@ -468,8 +469,12 @@ def parse(self):
}
if self.config.include_tracks:
pcbdata["tracks"] = self.parse_tracks(self.board.GetTracks())
- pcbdata["zones"] = self.parse_zones(self.board.Zones())
- if self.config.include_nets:
+ if hasattr(self.board, "Zones"):
+ pcbdata["zones"] = self.parse_zones(self.board.Zones())
+ else:
+ self.logger.info("Zones not supported for KiCad 4, skipping")
+ pcbdata["zones"] = {'F': [], 'B': []}
+ if self.config.include_nets and hasattr(self.board, "GetNetInfo"):
pcbdata["nets"] = self.parse_netlist(self.board.GetNetInfo())
components = [self.module_to_component(m) for m in pcb_modules]
diff --git a/InteractiveHtmlBom/web/render.js b/InteractiveHtmlBom/web/render.js
index e6da0fb4..2dde21c0 100644
--- a/InteractiveHtmlBom/web/render.js
+++ b/InteractiveHtmlBom/web/render.js
@@ -31,6 +31,7 @@ function drawtext(ctx, text, color, flip) {
ctx.fillStyle = color;
ctx.strokeStyle = color;
ctx.lineCap = "round";
+ ctx.lineJoin = "round";
ctx.lineWidth = text.thickness;
if (text.svgpath) {
ctx.stroke(new Path2D(text.svgpath));
@@ -74,14 +75,12 @@ function drawtext(ctx, text, color, flip) {
}
for (var c of txt[i]) {
for (var line of pcbdata.font_data[c].l) {
- // Drawing each segment separately instead of
- // polyline because round line caps don't work in joints
- for (var i = 0; i < line.length - 1; i++) {
- ctx.beginPath();
- ctx.moveTo(...calcFontPoint(line[i], text, offsetx, offsety, tilt));
- ctx.lineTo(...calcFontPoint(line[i + 1], text, offsetx, offsety, tilt));
- ctx.stroke();
+ ctx.beginPath();
+ ctx.moveTo(...calcFontPoint(line[0], text, offsetx, offsety, tilt));
+ for (var i = 1; i < line.length; i++) {
+ ctx.lineTo(...calcFontPoint(line[i], text, offsetx, offsety, tilt));
}
+ ctx.stroke();
}
offsetx += pcbdata.font_data[c].w * text.width;
}
@@ -344,7 +343,11 @@ function drawTracks(canvas, layer, color) {
function drawZones(canvas, layer, color) {
ctx = canvas.getContext("2d");
+ ctx.strokeStyle = color;
+ ctx.lineJoin = "round";
for(var zone of pcbdata.zones[layer]) {
+ ctx.lineWidth = zone.width;
+ drawPolygons(ctx, color, zone.polygons, ctx.stroke.bind(ctx));
drawPolygons(ctx, color, zone.polygons, ctx.fill.bind(ctx));
}
}