drawing-axi 0.1.2 → 0.1.3

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/README.md CHANGED
@@ -21,7 +21,7 @@ It was built to run inside Comis, and it also works on its own.
21
21
  ## Requirements
22
22
 
23
23
  - Node.js 22.18 or later.
24
- - Drawings plotted to PDF from the CAD file (vector PDF). A scan or a photo holds no lines to measure, and the tool says so. So does a print of the drawing through a PDF printer, where the drawing becomes picture tiles under a few real lines such as the column grid: `info` says how much of the page pictures cover, `measure` warns, and `render` shows where the pictures are.
24
+ - Drawings plotted to PDF from the CAD file (vector PDF), one sheet a page; a file that joins several sheets works too, `--page` picks one. A scan or a photo holds no lines to measure, and the tool says so. So does a print of the drawing through a PDF printer, where the drawing becomes picture tiles under a few real lines such as the column grid: `info` says how much of the page pictures cover, `measure` warns, and `render` shows where the pictures are.
25
25
 
26
26
  ## Install
27
27
 
@@ -10,6 +10,8 @@ const MAX_LABELS = 200_000;
10
10
  const MAX_FORM_DEPTH = 12;
11
11
  /** The longest side a sheet may have, in points: 200 inches at a unit of 20. */
12
12
  const MAX_SHEET = 288_000;
13
+ /** The most layers a sheet learns from its pages when the catalog lists none. */
14
+ const MAX_LAYERS = 10_000;
13
15
  /** The most picture boxes a sheet keeps; the count goes on past it. */
14
16
  const MAX_PICTURES = 5000;
15
17
  /** Cells along each side when measuring how much pictures cover. */
@@ -205,6 +207,20 @@ export function readSheet(doc, pageIndex, options = {}) {
205
207
  const dict = doc.dict(target);
206
208
  if (!dict)
207
209
  return -1;
210
+ // A layer the catalog does not list: a tool that joins sheets into one
211
+ // file drops the list, and each page still names its own layers.
212
+ const type = dict.get('Type');
213
+ if (target instanceof Ref &&
214
+ type instanceof Name &&
215
+ type.name === 'OCG' &&
216
+ layers.length < MAX_LAYERS) {
217
+ byObject.set(target.num, layers.length);
218
+ layers.push({
219
+ name: doc.text(dict.get('Name')) ?? `layer ${layers.length + 1}`,
220
+ hidden: false,
221
+ });
222
+ return layers.length - 1;
223
+ }
208
224
  const groups = dict.get('OCGs');
209
225
  if (groups instanceof Ref)
210
226
  return ocLayer(groups);
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Kept equal to package.json by test/unit/version.test.ts.
2
- export const VERSION = '0.1.2';
2
+ export const VERSION = '0.1.3';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drawing-axi",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "A command-line tool that lets AI agents read CAD drawings saved as PDF: layers, labels, scale, pipe runs and counts",
5
5
  "license": "MIT",
6
6
  "type": "module",