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.
package/dist/index.js CHANGED
@@ -6121,6 +6121,40 @@ var handleSilkscreenCircle = (circle, index) => {
6121
6121
  stroke_width: mil10ToMm(circle.width)
6122
6122
  });
6123
6123
  };
6124
+ var handleRect = (rect, index) => {
6125
+ const width = milx10(rect.width);
6126
+ const height = milx10(rect.height);
6127
+ const center = {
6128
+ x: milx10(rect.x) + width / 2,
6129
+ y: milx10(rect.y) + height / 2
6130
+ };
6131
+ const layer = getSideFromLayer(rect.layer);
6132
+ if (isCourtyardLayer(rect.layer)) {
6133
+ return pcb_courtyard_rect.parse({
6134
+ type: "pcb_courtyard_rect",
6135
+ pcb_courtyard_rect_id: `pcb_courtyard_rect_${index + 1}`,
6136
+ pcb_component_id: "pcb_component_1",
6137
+ center,
6138
+ width,
6139
+ height,
6140
+ layer,
6141
+ ccw_rotation: rect.rotation
6142
+ });
6143
+ }
6144
+ return pcb_silkscreen_rect.parse({
6145
+ type: "pcb_silkscreen_rect",
6146
+ pcb_silkscreen_rect_id: `pcb_silkscreen_rect_${index + 1}`,
6147
+ pcb_component_id: "pcb_component_1",
6148
+ center,
6149
+ width,
6150
+ height,
6151
+ layer,
6152
+ stroke_width: mil2mm(rect.lineWidth),
6153
+ is_filled: rect.fillStyle !== "none",
6154
+ has_stroke: rect.lineWidth > 0,
6155
+ ccw_rotation: rect.rotation
6156
+ });
6157
+ };
6124
6158
  var handleHole = (hole, index) => {
6125
6159
  return pcb_hole.parse({
6126
6160
  type: "pcb_hole",
@@ -6396,6 +6430,8 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
6396
6430
  if (isSilkscreenLayer(shape.layer)) {
6397
6431
  circuitElements.push(handleSilkscreenCircle(shape, index));
6398
6432
  }
6433
+ } else if (shape.type === "RECT") {
6434
+ circuitElements.push(handleRect(shape, index));
6399
6435
  } else if (shape.type === "ARC") {
6400
6436
  if (!isCourtyardLayer(shape.layer)) {
6401
6437
  circuitElements.push(handleSilkscreenArc(shape, index));
@@ -6453,7 +6489,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
6453
6489
  );
6454
6490
  }
6455
6491
  const pcbElements = circuitElements.filter(
6456
- (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"
6492
+ (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"
6457
6493
  );
6458
6494
  if (pcbElements.length > 0) {
6459
6495
  const bounds = findBoundsAndCenter(pcbElements);