draftwright 0.1.5__tar.gz → 0.1.6__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.
- {draftwright-0.1.5 → draftwright-0.1.6}/CHANGELOG.md +21 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/PKG-INFO +1 -1
- {draftwright-0.1.5 → draftwright-0.1.6}/pyproject.toml +1 -1
- {draftwright-0.1.5 → draftwright-0.1.6}/src/draftwright/make_drawing.py +41 -1
- {draftwright-0.1.5 → draftwright-0.1.6}/tests/test_e2e_standards.py +6 -5
- {draftwright-0.1.5 → draftwright-0.1.6}/.gitignore +0 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/LICENSE +0 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/README.md +0 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/skills/SKILL.md +0 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/src/draftwright/__init__.py +0 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/src/draftwright/pmi.py +0 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/tests/fixtures/nist_ctc_01_asme1_ap203.stp +0 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/tests/fixtures/nist_ctc_01_asme1_ap242.stp +0 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/tests/fixtures/nist_ctc_02_asme1_ap203.stp +0 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/tests/fixtures/nist_ctc_02_asme1_ap242.stp +0 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/tests/fixtures/nist_ctc_03_asme1_ap203.stp +0 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/tests/fixtures/nist_ctc_03_asme1_ap242.stp +0 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/tests/fixtures/nist_ctc_04_asme1_ap203.stp +0 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/tests/fixtures/nist_ctc_04_asme1_ap242.stp +0 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/tests/fixtures/nist_ctc_05_asme1_ap203.stp +0 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/tests/fixtures/nist_ctc_05_asme1_ap242.stp +0 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/tests/test_make_drawing.py +0 -0
- {draftwright-0.1.5 → draftwright-0.1.6}/tests/test_pmi.py +0 -0
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## v0.1.5 — 2026-06-15
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- CTC-02 spurious full-page line: build123d's `ExportSVG` projected
|
|
10
|
+
circle-edge-on edges (hole/fillet rims seen edge-on) as elliptical arcs with
|
|
11
|
+
a near-zero minor radius, which renderers blow up into full-page lines.
|
|
12
|
+
`sanitize_svg_arcs()` rewrites any arc with a sub-1e-3 mm radius into the
|
|
13
|
+
straight line it actually is, leaving real arcs untouched (#19). Not a PMI
|
|
14
|
+
issue — the file is AP203 geometry-only.
|
|
15
|
+
|
|
16
|
+
### Tests
|
|
17
|
+
|
|
18
|
+
- Added the full NIST CTC set (01–05) as fixtures, both AP203 geometry-only and
|
|
19
|
+
AP242 (with-PMI) variants.
|
|
20
|
+
- Heavy end-to-end CTC fixture builds are marked `slow` and deselected from the
|
|
21
|
+
default `pytest` run (fast normal run, ~4.5 min); CI runs the fast tier across
|
|
22
|
+
the OS/Python matrix and the slow tier once.
|
|
23
|
+
- Known: AP242 CTC-02 and both CTC-04 variants crash OCCT on import (#20); their
|
|
24
|
+
fixtures are excluded from build tests.
|
|
25
|
+
|
|
5
26
|
## v0.1.4 — 2026-06-15
|
|
6
27
|
|
|
7
28
|
### Changed
|
|
@@ -71,7 +71,9 @@ from build123d_drafting.helpers import (
|
|
|
71
71
|
view_axes,
|
|
72
72
|
)
|
|
73
73
|
from OCP.BRepAdaptor import BRepAdaptor_Surface
|
|
74
|
+
from OCP.BRepAlgoAPI import BRepAlgoAPI_Cut
|
|
74
75
|
from OCP.GeomAbs import GeomAbs_Plane
|
|
76
|
+
from OCP.TopTools import TopTools_ListOfShape
|
|
75
77
|
|
|
76
78
|
_log = logging.getLogger(__name__)
|
|
77
79
|
|
|
@@ -2311,6 +2313,39 @@ def _section_hatch_edges(face, SX, SZ, spacing):
|
|
|
2311
2313
|
return result
|
|
2312
2314
|
|
|
2313
2315
|
|
|
2316
|
+
def _fuzzy_cut(body, cutter, fuzzy: float = 1e-3):
|
|
2317
|
+
"""Boolean-subtract *cutter* from *body* with a fuzzy tolerance.
|
|
2318
|
+
|
|
2319
|
+
Returns a build123d ``Solid`` (or ``Compound`` of solids), or ``None`` if the
|
|
2320
|
+
boolean fails or yields no solid.
|
|
2321
|
+
|
|
2322
|
+
build123d's plain ``body - cutter`` runs an exact (zero-fuzzy) boolean which
|
|
2323
|
+
raises an *uncatchable* ``Standard_DomainError`` on some cast geometry — the
|
|
2324
|
+
C++ exception escapes to ``libc++abi: terminating`` (SIGABRT) and a
|
|
2325
|
+
surrounding ``try/except`` never sees it, killing the whole drawing (NIST
|
|
2326
|
+
CTC-04 section cut, #20). A small fuzzy value makes ``BRepAlgoAPI_Cut`` robust
|
|
2327
|
+
on the same input. We drive the OCCT op directly (build123d's
|
|
2328
|
+
``Shape._bool_op`` result-processing aborts on the resulting compound) and
|
|
2329
|
+
keep only the solids, so non-solid boolean artefacts can't crash the
|
|
2330
|
+
downstream hidden-line projection.
|
|
2331
|
+
"""
|
|
2332
|
+
args = TopTools_ListOfShape()
|
|
2333
|
+
args.Append(body.wrapped)
|
|
2334
|
+
tools = TopTools_ListOfShape()
|
|
2335
|
+
tools.Append(cutter.wrapped)
|
|
2336
|
+
op = BRepAlgoAPI_Cut()
|
|
2337
|
+
op.SetArguments(args)
|
|
2338
|
+
op.SetTools(tools)
|
|
2339
|
+
op.SetFuzzyValue(fuzzy)
|
|
2340
|
+
op.Build()
|
|
2341
|
+
if not op.IsDone():
|
|
2342
|
+
return None
|
|
2343
|
+
solids = Compound(op.Shape()).solids()
|
|
2344
|
+
if not solids:
|
|
2345
|
+
return None
|
|
2346
|
+
return solids[0] if len(solids) == 1 else Compound(children=list(solids))
|
|
2347
|
+
|
|
2348
|
+
|
|
2314
2349
|
def _add_section_view(dwg, a, axis_letter, holes=None):
|
|
2315
2350
|
"""Full section A–A when blind or stepped holes hide their structure (#94).
|
|
2316
2351
|
|
|
@@ -2380,10 +2415,15 @@ def _add_section_view(dwg, a, axis_letter, holes=None):
|
|
|
2380
2415
|
return
|
|
2381
2416
|
body = solids[0] if len(solids) == 1 else Compound(children=list(solids))
|
|
2382
2417
|
try:
|
|
2383
|
-
|
|
2418
|
+
# Fuzzy boolean: the exact `body - Box(...)` aborts uncatchably
|
|
2419
|
+
# (Standard_DomainError) on some cast geometry — see _fuzzy_cut / #20.
|
|
2420
|
+
keep_behind = _fuzzy_cut(body, Pos(a.cx, y_star - big / 2, a.cz) * Box(big, big, big))
|
|
2384
2421
|
except Exception as exc: # noqa: BLE001 — OCC booleans raise broadly
|
|
2385
2422
|
_log.warning("Section A–A skipped (cut failed: %s)", exc)
|
|
2386
2423
|
return
|
|
2424
|
+
if keep_behind is None:
|
|
2425
|
+
_log.warning("Section A–A skipped (boolean cut produced no solid)")
|
|
2426
|
+
return
|
|
2387
2427
|
camera = (dwg.look_at[0], dwg.look_at[1] - dwg.dist, dwg.look_at[2])
|
|
2388
2428
|
dwg.add_view("section_aa", keep_behind, camera, (0, 0, 1), (pos_x, a.FV_Y))
|
|
2389
2429
|
dwg.add(
|
|
@@ -91,14 +91,15 @@ def test_e2e_from_step_meets_standards(tmp_path):
|
|
|
91
91
|
|
|
92
92
|
# ---------------------------------------------------------------------------
|
|
93
93
|
# NIST MBE PMI Combined Test Cases (CTC), public-domain models.
|
|
94
|
-
# All 10 variants ship as fixtures
|
|
95
|
-
#
|
|
96
|
-
#
|
|
94
|
+
# All 10 variants ship as fixtures. CTC-04 used to abort in the section-view
|
|
95
|
+
# boolean cut; the fuzzy cut (_fuzzy_cut, #20) fixed that, so it now builds.
|
|
96
|
+
# CTC-02 AP242 still segfaults inside OCCT's AP242/PMI STEP read (#20) — a
|
|
97
|
+
# segfault would kill the whole test run, so it stays excluded.
|
|
97
98
|
# ---------------------------------------------------------------------------
|
|
98
99
|
|
|
99
100
|
FIXTURES = Path(__file__).parent / "fixtures"
|
|
100
|
-
_CTC_AP203_OK = ["01", "02", "03", "05"] #
|
|
101
|
-
_CTC_AP242_OK = ["01", "03", "05"] # 02
|
|
101
|
+
_CTC_AP203_OK = ["01", "02", "03", "04", "05"] # all build (#20 section-cut fix)
|
|
102
|
+
_CTC_AP242_OK = ["01", "03", "04", "05"] # 02 segfaults in OCCT STEP+PMI read (#20)
|
|
102
103
|
|
|
103
104
|
|
|
104
105
|
@pytest.mark.slow
|
|
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
|