easyeda 0.0.305 → 0.0.306

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.
@@ -9984,6 +9984,40 @@ var handleSilkscreenCircle = (circle, index) => {
9984
9984
  stroke_width: mil10ToMm(circle.width)
9985
9985
  });
9986
9986
  };
9987
+ var handleRect = (rect, index) => {
9988
+ const width = milx10(rect.width);
9989
+ const height = milx10(rect.height);
9990
+ const center = {
9991
+ x: milx10(rect.x) + width / 2,
9992
+ y: milx10(rect.y) + height / 2
9993
+ };
9994
+ const layer = getSideFromLayer(rect.layer);
9995
+ if (isCourtyardLayer(rect.layer)) {
9996
+ return pcb_courtyard_rect.parse({
9997
+ type: "pcb_courtyard_rect",
9998
+ pcb_courtyard_rect_id: `pcb_courtyard_rect_${index + 1}`,
9999
+ pcb_component_id: "pcb_component_1",
10000
+ center,
10001
+ width,
10002
+ height,
10003
+ layer,
10004
+ ccw_rotation: rect.rotation
10005
+ });
10006
+ }
10007
+ return pcb_silkscreen_rect.parse({
10008
+ type: "pcb_silkscreen_rect",
10009
+ pcb_silkscreen_rect_id: `pcb_silkscreen_rect_${index + 1}`,
10010
+ pcb_component_id: "pcb_component_1",
10011
+ center,
10012
+ width,
10013
+ height,
10014
+ layer,
10015
+ stroke_width: mil2mm(rect.lineWidth),
10016
+ is_filled: rect.fillStyle !== "none",
10017
+ has_stroke: rect.lineWidth > 0,
10018
+ ccw_rotation: rect.rotation
10019
+ });
10020
+ };
9987
10021
  var handleHole = (hole, index) => {
9988
10022
  return pcb_hole.parse({
9989
10023
  type: "pcb_hole",
@@ -10259,6 +10293,8 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
10259
10293
  if (isSilkscreenLayer(shape.layer)) {
10260
10294
  circuitElements.push(handleSilkscreenCircle(shape, index));
10261
10295
  }
10296
+ } else if (shape.type === "RECT") {
10297
+ circuitElements.push(handleRect(shape, index));
10262
10298
  } else if (shape.type === "ARC") {
10263
10299
  if (!isCourtyardLayer(shape.layer)) {
10264
10300
  circuitElements.push(handleSilkscreenArc(shape, index));
@@ -10316,7 +10352,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
10316
10352
  );
10317
10353
  }
10318
10354
  const pcbElements = circuitElements.filter(
10319
- (e) => e.type === "pcb_smtpad" || e.type === "pcb_plated_hole" || e.type === "pcb_hole" || e.type === "pcb_via" || e.type === "pcb_courtyard_outline" || e.type === "pcb_silkscreen_path" || e.type === "pcb_silkscreen_text"
10355
+ (e) => e.type === "pcb_smtpad" || e.type === "pcb_plated_hole" || e.type === "pcb_hole" || e.type === "pcb_via" || e.type === "pcb_courtyard_outline" || e.type === "pcb_courtyard_rect" || e.type === "pcb_silkscreen_path" || e.type === "pcb_silkscreen_rect" || e.type === "pcb_silkscreen_text"
10320
10356
  );
10321
10357
  if (pcbElements.length > 0) {
10322
10358
  const bounds = findBoundsAndCenter(pcbElements);