icadkit 0.3.11__tar.gz → 0.3.13__tar.gz

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.
Files changed (153) hide show
  1. {icadkit-0.3.11 → icadkit-0.3.13}/Cargo.lock +2 -2
  2. {icadkit-0.3.11 → icadkit-0.3.13}/Cargo.toml +1 -1
  3. {icadkit-0.3.11 → icadkit-0.3.13}/PKG-INFO +2 -2
  4. {icadkit-0.3.11 → icadkit-0.3.13}/docs/changelog.md +11 -0
  5. {icadkit-0.3.11 → icadkit-0.3.13}/docs/drawing.md +1 -1
  6. {icadkit-0.3.11 → icadkit-0.3.13}/pyproject.toml +1 -1
  7. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/drawing.py +55 -14
  8. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_drawing.py +76 -0
  9. {icadkit-0.3.11 → icadkit-0.3.13}/uv.lock +7 -7
  10. {icadkit-0.3.11 → icadkit-0.3.13}/COMMERCIAL-LICENSE.md +0 -0
  11. {icadkit-0.3.11 → icadkit-0.3.13}/LICENSE +0 -0
  12. {icadkit-0.3.11 → icadkit-0.3.13}/LICENSES/Apache-2.0.txt +0 -0
  13. {icadkit-0.3.11 → icadkit-0.3.13}/LICENSES/PolyForm-Noncommercial-1.0.0.md +0 -0
  14. {icadkit-0.3.11 → icadkit-0.3.13}/LICENSES/parasolid-core-MIT.txt +0 -0
  15. {icadkit-0.3.11 → icadkit-0.3.13}/LICENSES/rust-dependencies.txt +0 -0
  16. {icadkit-0.3.11 → icadkit-0.3.13}/README.md +0 -0
  17. {icadkit-0.3.11 → icadkit-0.3.13}/THIRD_PARTY_NOTICES.md +0 -0
  18. {icadkit-0.3.11 → icadkit-0.3.13}/corpus/README.md +0 -0
  19. {icadkit-0.3.11 → icadkit-0.3.13}/corpus/generate.py +0 -0
  20. {icadkit-0.3.11 → icadkit-0.3.13}/corpus/public.jsonl +0 -0
  21. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/Cargo.toml +0 -0
  22. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/LICENSE +0 -0
  23. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/build.rs +0 -0
  24. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/src/compression.rs +0 -0
  25. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/src/container.rs +0 -0
  26. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/src/document.rs +0 -0
  27. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/src/error.rs +0 -0
  28. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/src/header.rs +0 -0
  29. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/src/lib.rs +0 -0
  30. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/src/limits.rs +0 -0
  31. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/src/native.rs +0 -0
  32. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/src/parasolid.rs +0 -0
  33. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/src/parts.rs +0 -0
  34. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/src/provenance.rs +0 -0
  35. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/src/reader.rs +0 -0
  36. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/src/record.rs +0 -0
  37. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/src/resource.rs +0 -0
  38. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/src/schema.rs +0 -0
  39. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/src/trailer.rs +0 -0
  40. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/src/views.rs +0 -0
  41. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/tests/container.rs +0 -0
  42. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/tests/header.rs +0 -0
  43. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-core/tests/resources.rs +0 -0
  44. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-python/Cargo.toml +0 -0
  45. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-python/LICENSE +0 -0
  46. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-python/src/brep.rs +0 -0
  47. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-python/src/document.rs +0 -0
  48. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-python/src/geometry.rs +0 -0
  49. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-python/src/lib.rs +0 -0
  50. {icadkit-0.3.11 → icadkit-0.3.13}/crates/icad-python/src/schema.rs +0 -0
  51. {icadkit-0.3.11 → icadkit-0.3.13}/docs/api.md +0 -0
  52. {icadkit-0.3.11 → icadkit-0.3.13}/docs/csg.md +0 -0
  53. {icadkit-0.3.11 → icadkit-0.3.13}/docs/license.md +0 -0
  54. {icadkit-0.3.11 → icadkit-0.3.13}/docs/native.md +0 -0
  55. {icadkit-0.3.11 → icadkit-0.3.13}/docs/parameters.md +0 -0
  56. {icadkit-0.3.11 → icadkit-0.3.13}/docs/parts.md +0 -0
  57. {icadkit-0.3.11 → icadkit-0.3.13}/docs/preview.md +0 -0
  58. {icadkit-0.3.11 → icadkit-0.3.13}/docs/references.md +0 -0
  59. {icadkit-0.3.11 → icadkit-0.3.13}/docs/roadmap.md +0 -0
  60. {icadkit-0.3.11 → icadkit-0.3.13}/docs/saved-bodies.md +0 -0
  61. {icadkit-0.3.11 → icadkit-0.3.13}/docs/shapes.md +0 -0
  62. {icadkit-0.3.11 → icadkit-0.3.13}/docs/support.md +0 -0
  63. {icadkit-0.3.11 → icadkit-0.3.13}/docs/trailer.md +0 -0
  64. {icadkit-0.3.11 → icadkit-0.3.13}/docs/viewer.md +0 -0
  65. {icadkit-0.3.11 → icadkit-0.3.13}/docs/writing.md +0 -0
  66. {icadkit-0.3.11 → icadkit-0.3.13}/scripts/bump_version.py +0 -0
  67. {icadkit-0.3.11 → icadkit-0.3.13}/scripts/check_license.py +0 -0
  68. {icadkit-0.3.11 → icadkit-0.3.13}/scripts/check_public_tree.py +0 -0
  69. {icadkit-0.3.11 → icadkit-0.3.13}/scripts/test_publication.py +0 -0
  70. {icadkit-0.3.11 → icadkit-0.3.13}/scripts/test_versions.py +0 -0
  71. {icadkit-0.3.11 → icadkit-0.3.13}/scripts/verify_artifacts.py +0 -0
  72. {icadkit-0.3.11 → icadkit-0.3.13}/scripts/verify_corpus.py +0 -0
  73. {icadkit-0.3.11 → icadkit-0.3.13}/scripts/verify_install.py +0 -0
  74. {icadkit-0.3.11 → icadkit-0.3.13}/scripts/verify_native_corpus.py +0 -0
  75. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/__init__.py +0 -0
  76. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/__main__.py +0 -0
  77. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/_core.pyi +0 -0
  78. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/_csg_occt.py +0 -0
  79. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/_preview_bridge.py +0 -0
  80. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/_saved_occt.py +0 -0
  81. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/_shape_occt.py +0 -0
  82. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/_viewer/index.html +0 -0
  83. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/_viewer/viewer.css +0 -0
  84. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/_viewer/viewer.js +0 -0
  85. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/_viewer_io.py +0 -0
  86. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/api.py +0 -0
  87. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/cli.py +0 -0
  88. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/container.py +0 -0
  89. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/csg.py +0 -0
  90. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/document.py +0 -0
  91. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/errors.py +0 -0
  92. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/geometry.py +0 -0
  93. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/models.py +0 -0
  94. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/native.py +0 -0
  95. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/parameters.py +0 -0
  96. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/parts.py +0 -0
  97. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/preview.py +0 -0
  98. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/py.typed +0 -0
  99. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/references.py +0 -0
  100. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/saved.py +0 -0
  101. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/schema.py +0 -0
  102. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/shape.py +0 -0
  103. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/trailer.py +0 -0
  104. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/versions.py +0 -0
  105. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/viewer.py +0 -0
  106. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/views.py +0 -0
  107. {icadkit-0.3.11 → icadkit-0.3.13}/src/icadkit/write.py +0 -0
  108. {icadkit-0.3.11 → icadkit-0.3.13}/tests/conftest.py +0 -0
  109. {icadkit-0.3.11 → icadkit-0.3.13}/tests/drawing_fixtures.py +0 -0
  110. {icadkit-0.3.11 → icadkit-0.3.13}/tests/fixture_builders.py +0 -0
  111. {icadkit-0.3.11 → icadkit-0.3.13}/tests/geometry_fixtures.py +0 -0
  112. {icadkit-0.3.11 → icadkit-0.3.13}/tests/parameter_fixtures.py +0 -0
  113. {icadkit-0.3.11 → icadkit-0.3.13}/tests/part_fixtures.py +0 -0
  114. {icadkit-0.3.11 → icadkit-0.3.13}/tests/preview_fixtures.py +0 -0
  115. {icadkit-0.3.11 → icadkit-0.3.13}/tests/saved_fixtures.py +0 -0
  116. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_api.py +0 -0
  117. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_cli.py +0 -0
  118. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_container.py +0 -0
  119. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_corpus.py +0 -0
  120. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_csg.py +0 -0
  121. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_distribution.py +0 -0
  122. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_extrusion.py +0 -0
  123. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_followup_parts.py +0 -0
  124. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_geometry.py +0 -0
  125. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_inspect.py +0 -0
  126. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_legacy_parts.py +0 -0
  127. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_mirrors.py +0 -0
  128. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_native.py +0 -0
  129. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_native_corpus.py +0 -0
  130. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_native_round.py +0 -0
  131. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_parameters.py +0 -0
  132. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_part_profiles.py +0 -0
  133. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_part_semantics.py +0 -0
  134. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_parts.py +0 -0
  135. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_parts_material.py +0 -0
  136. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_preview.py +0 -0
  137. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_profile_shapes.py +0 -0
  138. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_references.py +0 -0
  139. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_resource_cli.py +0 -0
  140. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_resources.py +0 -0
  141. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_saved.py +0 -0
  142. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_shape.py +0 -0
  143. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_trailer.py +0 -0
  144. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_v7_parts.py +0 -0
  145. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_v8l4_boundary.py +0 -0
  146. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_version_geometry.py +0 -0
  147. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_viewer.py +0 -0
  148. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_views_placement.py +0 -0
  149. {icadkit-0.3.11 → icadkit-0.3.13}/tests/test_write.py +0 -0
  150. {icadkit-0.3.11 → icadkit-0.3.13}/tests/trailer_fixtures.py +0 -0
  151. {icadkit-0.3.11 → icadkit-0.3.13}/tests/viewer_assembly_browser.mjs +0 -0
  152. {icadkit-0.3.11 → icadkit-0.3.13}/tests/viewer_browser.mjs +0 -0
  153. {icadkit-0.3.11 → icadkit-0.3.13}/tests/viewer_mirror_browser.mjs +0 -0
@@ -89,7 +89,7 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
89
89
 
90
90
  [[package]]
91
91
  name = "icad-core"
92
- version = "0.3.11"
92
+ version = "0.3.13"
93
93
  dependencies = [
94
94
  "flate2",
95
95
  "parasolid-core",
@@ -99,7 +99,7 @@ dependencies = [
99
99
 
100
100
  [[package]]
101
101
  name = "icad-python"
102
- version = "0.3.11"
102
+ version = "0.3.13"
103
103
  dependencies = [
104
104
  "icad-core",
105
105
  "parasolid-core",
@@ -4,7 +4,7 @@ resolver = "3"
4
4
 
5
5
  [workspace.package]
6
6
  # Release version source. Update with: python3 scripts/bump_version.py X.Y.Z
7
- version = "0.3.11"
7
+ version = "0.3.13"
8
8
  edition = "2024"
9
9
  rust-version = "1.88"
10
10
  license = "PolyForm-Noncommercial-1.0.0"
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: icadkit
3
- Version: 0.3.11
3
+ Version: 0.3.13
4
4
  Classifier: Development Status :: 2 - Pre-Alpha
5
5
  Classifier: Programming Language :: Python :: 3 :: Only
6
6
  Classifier: Programming Language :: Python :: Implementation :: CPython
7
7
  Classifier: Programming Language :: Rust
8
8
  Classifier: Typing :: Typed
9
- Requires-Dist: parasolid-kit[occt]==0.3.7 ; extra == 'preview'
9
+ Requires-Dist: parasolid-kit[occt]>=0.3.12,<0.4 ; extra == 'preview'
10
10
  Provides-Extra: preview
11
11
  License-File: LICENSE
12
12
  License-File: COMMERCIAL-LICENSE.md
@@ -2,6 +2,17 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ### Fixed
6
+
7
+ - Leader notes whose drawn leader has more than three points (the tip, two
8
+ or more elbows and the end of the shelf; a 2026 production drawing) read
9
+ `complete` with the full `path`. 0.3.11 unpacked exactly three points and
10
+ the whole drawing failed with "too many values to unpack".
11
+ - `read_drawing()` keeps an entity whose record raises while it is decoded
12
+ (`ValueError`, `IndexError`, `struct.error`) in place as `invalid` with a
13
+ `drawing.entity_error` diagnostic instead of failing the drawing; size
14
+ limits still raise `LimitExceededError`.
15
+
5
16
  ### Added
6
17
 
7
18
  - `DrawingText.underline`: view labels ("A-A", "Z矢視図") append one line
@@ -140,7 +140,7 @@ Layer values outside the observed one-byte layout remain unqualified.
140
140
  | Elliptical arc of V5-V7 (type 89, 448 bytes, subtype `0x10`) | `DrawingCurve` as a free curve with the ellipse words retained in the appended chunk; byte 7 of the header is `0x90` in these records (3D-derived drawings) | The 16 records of the corpus read `complete` |
141
141
  | Underlined text (type 21 with one line item) | `DrawingText.underline`: the start and end of the 48-byte line item that view labels ("A-A", "Z矢視図") append after their runs, any byte order; the fixed words differ from a plain text (header +14 = 3, +46 counts the run and the item, +60 = 0x40, +76 = `03 01`) and read `complete` for one line | The item's appearance bytes are not kept separately |
142
142
  | 3D projection frame (type 211) | Attribute record (`drawing.attribute_record`): a composite without drawn items whose words hold a 3×3 rotation matrix (isometric in the corpus) | Not drawn |
143
- | Leader note (types 22, 34, 44) | `DrawingNote`: the text runs (one per line), the arrowhead (a corner, the tip, the other corner), the drawn leader (tip, elbow, end; the older type 34 stores a two-point leader) and the arrow parameters; type 44 is a leader without text (partial, `drawing.note_text`) | Hidden alternative items are retained in `items` |
143
+ | Leader note (types 22, 34, 44) | `DrawingNote`: the text runs (one per line), the arrowhead (a corner, the tip, the other corner), the drawn leader (tip, one or more elbows, end; the older type 34 stores a two-point leader) and the arrow parameters; type 44 is a leader without text (partial, `drawing.note_text`) | Hidden alternative items are retained in `items` |
144
144
  | Symbol (types 212, 14, 28) | `DrawingSymbol`: drawn point markers, lines, arcs and vectors (a point with one, two or three vectors: the strokes of surface-texture symbols, type 28), the text runs (UTF-16LE or CP932) and the nested member list of a group as opaque ranges; `raw_kind` is the saved byte at `+31` (1 point markers, 50 labels); type 14 is a block of text lines | A run that does not decode is skipped with `drawing.symbol_text` |
145
145
  | Line information (type 224) | `DrawingSymbol` with the saved `name` (`Line`, `Junction`, `Connection Mark`, symbol names of P&ID and circuit drawings): the drawn lines, circles (marker `0x0444`) and text runs of the framed item stream | Records without a framed item stream (cable names, tables) are attribute records (`drawing.attribute_record`) |
146
146
  | Point with attributes (type 1, 128 bytes) | The point; the appended attribute record is retained | Connection points of P&ID symbols |
@@ -31,7 +31,7 @@ Licensing = "https://github.com/monozukuri-ai/icadkit/blob/main/docs/license.md"
31
31
  Commercial = "https://www.un-robotics.com/#contact"
32
32
 
33
33
  [project.optional-dependencies]
34
- preview = ["parasolid-kit[occt]==0.3.7"]
34
+ preview = ["parasolid-kit[occt]>=0.3.12,<0.4"]
35
35
 
36
36
  [dependency-groups]
37
37
  dev = ["maturin==1.15.0", "pytest>=8.3,<9", "ruff>=0.15,<1", "mypy>=1.15,<3"]
@@ -246,8 +246,9 @@ class DrawingNote:
246
246
  The record frames attribute blocks, the text runs (``texts``, one per
247
247
  line; ``text`` is the first) and ``vectors`` items: the arrowhead
248
248
  (``arrow``: a corner, the tip and the other corner), the drawn leader
249
- (``path``: the tip, the elbow and the end of the shelf under the text)
250
- and hidden alternatives that are not drawn. Balloons (the older type 34)
249
+ (``path``: the tip, one or more elbows and the end of the shelf under the
250
+ text; two points in the oldest layouts) and hidden alternatives that are
251
+ not drawn. Balloons (the older type 34)
251
252
  add the drawn ``circle`` (centre, radius) around the text. ``arrow_width``
252
253
  and ``arrow_angle`` (degrees) come from the attribute block shared with
253
254
  dimensions.
@@ -1085,18 +1086,19 @@ def _note(b: bytes, order: str, at: int) -> DrawingNote | None:
1085
1086
  continue
1086
1087
  if not item.raw_marker & 0x40:
1087
1088
  continue # hidden alternatives are retained in items, not drawn
1088
- if len(item.points) == 2:
1089
- # the two-point leader of the older layouts: the tip and the end
1090
- if not path:
1091
- path = item.points
1092
- else:
1093
- issue("drawing.note_item", offset, "Additional leader item")
1089
+ if len(item.points) < 2:
1090
+ issue("drawing.note_item", offset, "Leader item with fewer than two points")
1094
1091
  continue
1095
- p, q, r = item.points
1096
- if arrow is None and _symmetric_legs(p, q, r):
1097
- arrow = (p, q, r)
1098
- elif not path:
1099
- path = (p, q, r)
1092
+ if len(item.points) == 3 and arrow is None:
1093
+ p, q, r = item.points
1094
+ if _symmetric_legs(p, q, r):
1095
+ arrow = (p, q, r)
1096
+ continue
1097
+ if not path:
1098
+ # the drawn leader: the tip and the end (older layouts), the tip, the elbow
1099
+ # and the end of the shelf, or further elbows between them (a four-point
1100
+ # leader in a 2026 production drawing failed to unpack in 0.3.11)
1101
+ path = item.points
1100
1102
  else:
1101
1103
  issue("drawing.note_item", offset, "Additional leader item")
1102
1104
  if not path:
@@ -1970,6 +1972,40 @@ def _entity(
1970
1972
  )
1971
1973
 
1972
1974
 
1975
+ def _unreadable_entity(view: View, entry: ViewEntry, exc: Exception) -> DrawingEntity:
1976
+ """An entity whose record raised while it was decoded.
1977
+
1978
+ It stays in place as ``invalid`` with the error in its diagnostics, so one
1979
+ record of an unobserved layout does not fail the whole drawing (0.3.12; a
1980
+ production drawing was lost to a single leader note before that).
1981
+ """
1982
+ at = entry.byte_range.start
1983
+ return DrawingEntity(
1984
+ f"drawing@{at}",
1985
+ view.view_id,
1986
+ entry.byte_range,
1987
+ entry.owner_offset,
1988
+ None,
1989
+ None,
1990
+ None,
1991
+ None,
1992
+ None,
1993
+ None,
1994
+ None,
1995
+ None,
1996
+ None,
1997
+ "invalid",
1998
+ (
1999
+ Diagnostic(
2000
+ "invalid",
2001
+ "drawing.entity_error",
2002
+ at,
2003
+ f"Entity record could not be decoded: {type(exc).__name__}: {exc}",
2004
+ ),
2005
+ ),
2006
+ )
2007
+
2008
+
1973
2009
  def _read_drawing(
1974
2010
  document: "Document", limits: DrawingLimits | None, view_limits: ViewLimits | None
1975
2011
  ) -> DrawingIndex:
@@ -1990,7 +2026,12 @@ def _read_drawing(
1990
2026
  statuses.append(view.status)
1991
2027
  for entry in view.entries:
1992
2028
  if entry.kind == "entity":
1993
- entity = _entity(document, view, entry, limits)
2029
+ try:
2030
+ entity = _entity(document, view, entry, limits)
2031
+ except LimitExceededError:
2032
+ raise
2033
+ except (ValueError, IndexError, struct.error) as exc:
2034
+ entity = _unreadable_entity(view, entry, exc)
1994
2035
  entities.append(entity)
1995
2036
  statuses.append(entity.status)
1996
2037
  else:
@@ -1679,3 +1679,79 @@ def test_three_d_projection_frames_are_attribute_records():
1679
1679
  )
1680
1680
  assert e.status == "unsupported" and e.primitive is None and e.raw_type == 211
1681
1681
  assert any(d.code == "drawing.attribute_record" for d in e.diagnostics)
1682
+
1683
+
1684
+ # --- leader items with more than three points, per-entity decode guard (0.3.12) ----
1685
+
1686
+
1687
+ def test_leader_note_with_an_extra_elbow_is_read_as_a_four_point_path():
1688
+ # A 2026 production drawing (iCAD SX 2D, type 22) saved a leader whose drawn item
1689
+ # has four points: the tip, two elbows and the end of the shelf. 0.3.11 unpacked
1690
+ # exactly three and the whole drawing failed with "too many values to unpack".
1691
+ from icadkit import LeaderNote2D
1692
+ from icadkit.write import _item
1693
+
1694
+ writer = _sheet_writer()
1695
+ writer.add_entities(
1696
+ "XY", [LeaderNote2D(("注記",), (50.0, 50.0), (70.0, 70.0), (100.0, 70.0))]
1697
+ )
1698
+ (e,), doc = _entities(writer, (22,))
1699
+ assert e.note.path == ((50.0, 50.0), (70.0, 70.0), (100.0, 70.0))
1700
+ record = bytearray(doc.source_bytes(e.byte_range))
1701
+ # the drawn leader is the last item: 8 bytes of framing + 6 doubles
1702
+ size = struct.unpack_from("<H", record, len(record) - 56)[0]
1703
+ marker = struct.unpack_from("<H", record, len(record) - 54)[0]
1704
+ assert (size, marker) == (56, 0x0344)
1705
+ del record[-56:]
1706
+ drawn = e.note.items[-1]
1707
+ record += _item(
1708
+ "<",
1709
+ 0x0344,
1710
+ drawn.line_width,
1711
+ drawn.color_index,
1712
+ (50.0, 50.0, 20.0, 20.0, 30.0, 20.0, 50.0, 20.0),
1713
+ )
1714
+ struct.pack_into("<I", record, 0, len(record))
1715
+ again = (
1716
+ icadkit.read(drawing([bytes(record)], order="little", version=b"\0\x08\0\x03"))
1717
+ .read_drawing()
1718
+ .entities[0]
1719
+ )
1720
+ assert again.status == "complete" and again.note is not None
1721
+ assert again.note.path == (
1722
+ (50.0, 50.0),
1723
+ (70.0, 70.0),
1724
+ (80.0, 70.0),
1725
+ (100.0, 70.0),
1726
+ )
1727
+ assert again.note.arrow is not None and again.note.arrow[1] == (50.0, 50.0)
1728
+ assert again.note.box[2] >= 100.0
1729
+
1730
+
1731
+ def test_an_entity_record_that_raises_does_not_fail_the_drawing(monkeypatch):
1732
+ # One record of an unobserved layout stays in place as ``invalid`` with the error;
1733
+ # the other entities of the drawing are still read
1734
+ from icadkit import LeaderNote2D
1735
+ from icadkit import drawing as drawing_module
1736
+
1737
+ writer = _sheet_writer()
1738
+ writer.add_entities(
1739
+ "XY",
1740
+ [
1741
+ LeaderNote2D(("注記",), (50.0, 50.0), (70.0, 70.0), (100.0, 70.0)),
1742
+ icadkit.Line2D((0.0, 0.0), (10.0, 0.0)),
1743
+ ],
1744
+ )
1745
+ _, doc = _entities(writer, (22, 1))
1746
+
1747
+ def broken(*args, **kwargs):
1748
+ raise ValueError("too many values to unpack (expected 3)")
1749
+
1750
+ monkeypatch.setattr(drawing_module, "_note", broken)
1751
+ index = icadkit.read(writer.to_bytes()).read_drawing()
1752
+ assert [e.status for e in index.entities] == ["invalid", "complete"]
1753
+ bad = index.entities[0]
1754
+ assert bad.note is None and bad.primitive is None
1755
+ assert [d.code for d in bad.diagnostics] == ["drawing.entity_error"]
1756
+ assert "ValueError: too many values to unpack" in bad.diagnostics[0].message
1757
+ assert index.status == "invalid"
@@ -152,7 +152,7 @@ dev = [
152
152
  ]
153
153
 
154
154
  [package.metadata]
155
- requires-dist = [{ name = "parasolid-kit", extras = ["occt"], marker = "extra == 'preview'", specifier = "==0.3.7" }]
155
+ requires-dist = [{ name = "parasolid-kit", extras = ["occt"], marker = "extra == 'preview'", specifier = ">=0.3.12,<0.4" }]
156
156
  provides-extras = ["preview"]
157
157
 
158
158
  [package.metadata.requires-dev]
@@ -413,14 +413,14 @@ wheels = [
413
413
 
414
414
  [[package]]
415
415
  name = "parasolid-kit"
416
- version = "0.3.7"
416
+ version = "0.3.12"
417
417
  source = { registry = "https://pypi.org/simple" }
418
- sdist = { url = "https://files.pythonhosted.org/packages/11/6f/589fe32db0f5351e1cee00bc0eef5b62ebb1f7cd98ca1efa0267a11bb786/parasolid_kit-0.3.7.tar.gz", hash = "sha256:9983e489185440aaa61b7f40e81e491f8b5a185cd7b523d4d30628a6a53049d0", size = 1208507, upload-time = "2026-10-06T16:15:06.577Z" }
418
+ sdist = { url = "https://files.pythonhosted.org/packages/8a/89/969fc41c765cef38989f21912b0d5821c953dfddce6bd2a396cb2976ad77/parasolid_kit-0.3.12.tar.gz", hash = "sha256:8591a7ec1e7603eb596c9751004fa6f6695a253c9d73de6ec7eedd2bbdb64948", size = 1321550, upload-time = "2026-11-03T14:32:34.342Z" }
419
419
  wheels = [
420
- { url = "https://files.pythonhosted.org/packages/82/13/25feda08290ecf3b31243d0fb81abd0dd9713e0c52e957aab26c22a3885c/parasolid_kit-0.3.7-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:2261672972cc3bf47582cfdb17afd50042490daeef453dc39d83e0f397637c00", size = 1307589, upload-time = "2026-10-06T16:14:59.893Z" },
421
- { url = "https://files.pythonhosted.org/packages/fa/50/afd04f4c67125a2e61d739db7ec9465b58fafa92d8d78a0533a47d1820be/parasolid_kit-0.3.7-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:ea267a293607302f77c719a324542ab3dceb75eaf736882ed217e258e2c47d2b", size = 1297288, upload-time = "2026-10-06T16:15:01.835Z" },
422
- { url = "https://files.pythonhosted.org/packages/d8/e3/b0a98a69774dda4436df6933c2ebc0ec2e50f25c2cc76852530aad780b89/parasolid_kit-0.3.7-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6e3b90e9966b7194f5b8360357647101e9d1b9c298c221b587960da6cad3e6a2", size = 1375268, upload-time = "2026-10-06T16:15:03.449Z" },
423
- { url = "https://files.pythonhosted.org/packages/6c/36/fc1ff5550aed74a626fd4c1ad96659f17c6e8904bc91922f8b14403a3c7d/parasolid_kit-0.3.7-cp310-abi3-win_amd64.whl", hash = "sha256:18c75c1c1cc34f144ca38b053dc6965361d8f3ad0286a3796ed436566d43ed1a", size = 1210812, upload-time = "2026-10-06T16:15:05.021Z" },
420
+ { url = "https://files.pythonhosted.org/packages/bc/a1/7254c0c0dc1bda15a3c404ebec360f0be684851628c6cd510785f9d896d2/parasolid_kit-0.3.12-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:391a1cca7f3ee44fbb7aca0dc27691f0c3c2ee537930d61846b735d3c8f6fd28", size = 1421048, upload-time = "2026-11-03T14:32:27.192Z" },
421
+ { url = "https://files.pythonhosted.org/packages/39/01/0e6d66b66702b848fb3f8f93db0be976b84a478cabd554d6b755fc4804a5/parasolid_kit-0.3.12-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:f6776c70d63297bc8c1d48f94bf5dd7cda7b18f52e8473bb7e049f17dd0b591c", size = 1407358, upload-time = "2026-11-03T14:32:29.093Z" },
422
+ { url = "https://files.pythonhosted.org/packages/74/a7/ed785cdcdf099631e69b58aa8c3edf4393c8311f846f6e366a7e5367a7e3/parasolid_kit-0.3.12-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f0fad1f1d04d7928759aad79dbd8fa6e659bff8e60dc6ced6082312efa14c76", size = 1496697, upload-time = "2026-11-03T14:32:30.999Z" },
423
+ { url = "https://files.pythonhosted.org/packages/1e/53/5bf342743fa61be31f2893c4a486ca6425cd4cd6679e0efacd26ab6aacbd/parasolid_kit-0.3.12-cp310-abi3-win_amd64.whl", hash = "sha256:2088314ced589990d6fbe94a1737acb6bc0d5aa0761aaeba8c00b05b0164f9c3", size = 1328758, upload-time = "2026-11-03T14:32:32.882Z" },
424
424
  ]
425
425
 
426
426
  [package.optional-dependencies]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes