easyeda 0.0.267 → 0.0.269

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/index.js CHANGED
@@ -5343,6 +5343,11 @@ var handleSilkscreenPath = (track, index) => {
5343
5343
  });
5344
5344
  };
5345
5345
  var isCourtyardLayer = (layer) => layer === 13 || layer === 14 || layer === 15;
5346
+ var isSilkscreenLayer = (layer) => layer === 3 || layer === 4;
5347
+ var getSideFromLayer = (layer) => {
5348
+ if (layer === 4 || layer === 14) return "bottom";
5349
+ return "top";
5350
+ };
5346
5351
  var handleSilkscreenArc = (arc, index) => {
5347
5352
  const arcPath = generateArcFromSweep(
5348
5353
  arc.start.x,
@@ -5366,6 +5371,27 @@ var handleSilkscreenArc = (arc, index) => {
5366
5371
  stroke_width: mil10ToMm(arc.width)
5367
5372
  });
5368
5373
  };
5374
+ var SILKSCREEN_CIRCLE_SEGMENTS = 24;
5375
+ var handleSilkscreenCircle = (circle, index) => {
5376
+ const route = Array.from(
5377
+ { length: SILKSCREEN_CIRCLE_SEGMENTS + 1 },
5378
+ (_, segmentIndex) => {
5379
+ const angle = Math.PI * 2 * segmentIndex / SILKSCREEN_CIRCLE_SEGMENTS;
5380
+ return {
5381
+ x: milx10(circle.center.x + Math.cos(angle) * circle.radius),
5382
+ y: milx10(circle.center.y + Math.sin(angle) * circle.radius)
5383
+ };
5384
+ }
5385
+ );
5386
+ return pcb_silkscreen_path.parse({
5387
+ type: "pcb_silkscreen_path",
5388
+ pcb_silkscreen_path_id: `pcb_silkscreen_circle_${index + 1}`,
5389
+ pcb_component_id: "pcb_component_1",
5390
+ layer: getSideFromLayer(circle.layer),
5391
+ route,
5392
+ stroke_width: mil10ToMm(circle.width)
5393
+ });
5394
+ };
5369
5395
  var handleHole = (hole, index) => {
5370
5396
  return pcb_hole.parse({
5371
5397
  type: "pcb_hole",
@@ -5628,6 +5654,10 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
5628
5654
  if (!isCourtyardLayer(shape.layer)) {
5629
5655
  circuitElements.push(handleSilkscreenPath(shape, index));
5630
5656
  }
5657
+ } else if (shape.type === "CIRCLE") {
5658
+ if (isSilkscreenLayer(shape.layer)) {
5659
+ circuitElements.push(handleSilkscreenCircle(shape, index));
5660
+ }
5631
5661
  } else if (shape.type === "ARC") {
5632
5662
  if (!isCourtyardLayer(shape.layer)) {
5633
5663
  circuitElements.push(handleSilkscreenArc(shape, index));