easyeda 0.0.268 → 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.
@@ -9226,6 +9226,11 @@ var handleSilkscreenPath = (track, index) => {
9226
9226
  });
9227
9227
  };
9228
9228
  var isCourtyardLayer = (layer) => layer === 13 || layer === 14 || layer === 15;
9229
+ var isSilkscreenLayer = (layer) => layer === 3 || layer === 4;
9230
+ var getSideFromLayer = (layer) => {
9231
+ if (layer === 4 || layer === 14) return "bottom";
9232
+ return "top";
9233
+ };
9229
9234
  var handleSilkscreenArc = (arc, index) => {
9230
9235
  const arcPath = generateArcFromSweep(
9231
9236
  arc.start.x,
@@ -9249,6 +9254,27 @@ var handleSilkscreenArc = (arc, index) => {
9249
9254
  stroke_width: mil10ToMm(arc.width)
9250
9255
  });
9251
9256
  };
9257
+ var SILKSCREEN_CIRCLE_SEGMENTS = 24;
9258
+ var handleSilkscreenCircle = (circle, index) => {
9259
+ const route = Array.from(
9260
+ { length: SILKSCREEN_CIRCLE_SEGMENTS + 1 },
9261
+ (_, segmentIndex) => {
9262
+ const angle = Math.PI * 2 * segmentIndex / SILKSCREEN_CIRCLE_SEGMENTS;
9263
+ return {
9264
+ x: milx10(circle.center.x + Math.cos(angle) * circle.radius),
9265
+ y: milx10(circle.center.y + Math.sin(angle) * circle.radius)
9266
+ };
9267
+ }
9268
+ );
9269
+ return pcb_silkscreen_path.parse({
9270
+ type: "pcb_silkscreen_path",
9271
+ pcb_silkscreen_path_id: `pcb_silkscreen_circle_${index + 1}`,
9272
+ pcb_component_id: "pcb_component_1",
9273
+ layer: getSideFromLayer(circle.layer),
9274
+ route,
9275
+ stroke_width: mil10ToMm(circle.width)
9276
+ });
9277
+ };
9252
9278
  var handleHole = (hole, index) => {
9253
9279
  return pcb_hole.parse({
9254
9280
  type: "pcb_hole",
@@ -9511,6 +9537,10 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
9511
9537
  if (!isCourtyardLayer(shape.layer)) {
9512
9538
  circuitElements.push(handleSilkscreenPath(shape, index));
9513
9539
  }
9540
+ } else if (shape.type === "CIRCLE") {
9541
+ if (isSilkscreenLayer(shape.layer)) {
9542
+ circuitElements.push(handleSilkscreenCircle(shape, index));
9543
+ }
9514
9544
  } else if (shape.type === "ARC") {
9515
9545
  if (!isCourtyardLayer(shape.layer)) {
9516
9546
  circuitElements.push(handleSilkscreenArc(shape, index));