easyeda 0.0.265 → 0.0.267

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.cjs CHANGED
@@ -997,7 +997,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
997
997
  var package_default = {
998
998
  name: "easyeda",
999
999
  type: "module",
1000
- version: "0.0.264",
1000
+ version: "0.0.266",
1001
1001
  files: [
1002
1002
  "dist"
1003
1003
  ],
@@ -6435,13 +6435,14 @@ var handleHoleCutout = (hole, index) => {
6435
6435
  });
6436
6436
  };
6437
6437
  var handleVia = (via, index) => {
6438
+ const holeDiameter = via.holeRadius * 2;
6438
6439
  return pcb_via.parse({
6439
6440
  type: "pcb_via",
6440
6441
  pcb_via_id: `pcb_via_${index + 1}`,
6441
6442
  x: milx10(via.center.x),
6442
6443
  y: milx10(via.center.y),
6443
6444
  outer_diameter: milx10(via.outerDiameter),
6444
- hole_diameter: milx10(via.holeDiameter),
6445
+ hole_diameter: milx10(holeDiameter),
6445
6446
  layers: ["top", "bottom"]
6446
6447
  });
6447
6448
  };
@@ -6456,6 +6457,10 @@ var handleCutout = (solidRegion, index) => {
6456
6457
  }))
6457
6458
  });
6458
6459
  };
6460
+ var LEAD_SHAPE_LAYER = 100;
6461
+ var isPcbSolidRegionCutout = (shape) => {
6462
+ return shape.fillStyle === "cutout" && shape.layermask !== LEAD_SHAPE_LAYER;
6463
+ };
6459
6464
  var getCadPositionZMmFromMetadata = (easyEdaJson) => {
6460
6465
  const svgNode = easyEdaJson.packageDetail.dataStr.shape.find(
6461
6466
  (shape) => shape.type === "SVGNODE" && shape.svgData.attrs?.uuid
@@ -6662,7 +6667,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
6662
6667
  circuitElements.push(handleVia(v, index));
6663
6668
  });
6664
6669
  easyEdaJson.packageDetail.dataStr.shape.filter(
6665
- (shape) => shape.type === "SOLIDREGION" && shape.fillStyle === "cutout"
6670
+ (shape) => shape.type === "SOLIDREGION" && isPcbSolidRegionCutout(shape)
6666
6671
  ).forEach((sr, index) => {
6667
6672
  circuitElements.push(handleCutout(sr, index));
6668
6673
  });
@@ -6714,7 +6719,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
6714
6719
  circuitElements.push(
6715
6720
  pcb_silkscreen_text.parse({
6716
6721
  type: "pcb_silkscreen_text",
6717
- pcb_silkscreen_text_id: `pcb_silkscreen_text_designator_fallback`,
6722
+ pcb_silkscreen_text_id: "pcb_silkscreen_text_designator_fallback",
6718
6723
  pcb_component_id: "pcb_component_1",
6719
6724
  text: "{NAME}",
6720
6725
  anchor_position: {
@@ -6999,7 +7004,7 @@ var ViaSchema = BaseShapeSchema.extend({
6999
7004
  type: import_zod161.z.literal("VIA"),
7000
7005
  center: PointSchema,
7001
7006
  outerDiameter: import_zod161.z.number(),
7002
- holeDiameter: import_zod161.z.number()
7007
+ holeRadius: import_zod161.z.number()
7003
7008
  });
7004
7009
  var RectSchema = BaseShapeSchema.extend({
7005
7010
  type: import_zod161.z.literal("RECT"),
@@ -7149,13 +7154,13 @@ var ShapeItemSchema = import_zod161.z.object({
7149
7154
  });
7150
7155
  }
7151
7156
  case "VIA": {
7152
- const [x, y, outerDiameter, , holeDiameter, id] = shape.data.split("~");
7157
+ const [x, y, outerDiameter, , holeRadius, id] = shape.data.split("~");
7153
7158
  const center = [Number(x), Number(y)];
7154
7159
  return ViaSchema.parse({
7155
7160
  type: "VIA",
7156
7161
  center,
7157
7162
  outerDiameter: Number(outerDiameter),
7158
- holeDiameter: Number(holeDiameter),
7163
+ holeRadius: Number(holeRadius),
7159
7164
  id
7160
7165
  });
7161
7166
  }