feat(task-5): sections, cut faces, material hatch and detail views
engineering/mech/views.py grows the two remaining view kinds. A section's cut
faces come out of the same radial profile the silhouette does, so the hatched
area and the drawn outline are one calculation and cannot disagree: a solid
shaft's half-section loop measures exactly the sum of its segment rectangles,
and a bore closes the loop on itself rather than being hatched over.
ISO 6410's section convention falls out of the model rather than being special-
cased: an internal thread's radial_edit already raises the bore to the major
diameter, so the hatch stops there. ISO 128-3's rib rule is a flag on the
feature - a pocket marked no_section_hatch is drawn and left unhatched, while
the rest of the cut face is hatched with the part's ISO 128-50 material.
Four styles, each either implemented or refused by name with the alternative
rather than approximated: full and half on a longitudinal plane through a
revolved axis; full and revolved on a transverse plane (the annulus, flattened
at 2 degrees - 0.015% of the radius, stated in CIRCLE_SEGMENTS rather than
hidden); full and offset on a prismatic part, where through features split the
cut face and pockets reduce it to the remaining thickness. A plane that misses
the part, or that grazes an outline vertex so its crossings cannot be paired, is
refused instead of producing a guessed cut face.
Details scale a circular region of a parent view, emit the ISO 128-34 circle and
letter for the parent and the "A (5:1)" label for the detail itself, and report
every feature that falls outside the circle in omitted - the honesty rule again.
Three test assertions were corrected to the measured truth rather than the
engine bent to them, each verified by running the code:
* the ISO 6410 test asked for the whole cut-face loop's minimum to be the M20
major (r=10). It is not, and must not be: over the 5 mm that is drilled but
not threaded the loop closes on the real 16 mm drill (r=8). The loop is
((0,10),(0,25),(25,25),(30,25),(30,8),(30,8),(25,8),(25,10),(0,10)). The test
now pins both spans, which is the convention it meant to assert.
* the transverse-annulus areas were pinned at rel=2e-4. An inscribed regular
180-gon is exactly 1 - (n/2pi) sin(2pi/n) = 2.0307e-4 under the circle, so
2e-4 rejects the very flattening CIRCLE_SEGMENTS declares. The tolerance is
now 2.1e-4 and the test computes the deficit and pins it, so the number is
derived rather than guessed. CIRCLE_SEGMENTS' docstring now states both
figures: 0.015% radial (the 2 degree chord's sagitta) and 0.0203% of area.
* tests/test_mech_views.py pinned VIEW_KINDS == ("front","side","top"), which
this task deliberately grows. It now pins the three orthographic kinds as the
first three and the full five-kind tuple.
_is_longitudinal takes only the plane; the plan's signature also took the part
and never read it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
This commit is contained in:
co-authored by
Claude Opus 5
parent
b2f858212f
commit
72bd17d024
@@ -68,14 +68,22 @@ from .primitives import (
|
||||
translate,
|
||||
)
|
||||
from .views import (
|
||||
CIRCLE_SEGMENTS,
|
||||
PROJECTIONS,
|
||||
SECTION_PLANE,
|
||||
SECTION_STYLES,
|
||||
VIEW_KINDS,
|
||||
Band,
|
||||
View,
|
||||
build_view,
|
||||
cut_loops,
|
||||
detail_marker_prims,
|
||||
detail_view,
|
||||
layout_origin,
|
||||
normalise_plane,
|
||||
outline_prims,
|
||||
radial_profile,
|
||||
section_view,
|
||||
silhouette_prims,
|
||||
)
|
||||
|
||||
@@ -84,6 +92,7 @@ __all__ = [
|
||||
"AxialBore",
|
||||
"Band",
|
||||
"BendLine",
|
||||
"CIRCLE_SEGMENTS",
|
||||
"CentreHole",
|
||||
"Chamfer",
|
||||
"Circle",
|
||||
@@ -114,6 +123,8 @@ __all__ = [
|
||||
"RetainingGroove",
|
||||
"RevolvedPart",
|
||||
"Role",
|
||||
"SECTION_PLANE",
|
||||
"SECTION_STYLES",
|
||||
"Segment",
|
||||
"Slot",
|
||||
"Text",
|
||||
@@ -124,11 +135,15 @@ __all__ = [
|
||||
"bbox",
|
||||
"build_part",
|
||||
"build_view",
|
||||
"cut_loops",
|
||||
"detail_marker_prims",
|
||||
"detail_view",
|
||||
"feature_from_dict",
|
||||
"inner_radius_at",
|
||||
"layer_for",
|
||||
"layout_origin",
|
||||
"mirror_about_x",
|
||||
"normalise_plane",
|
||||
"outer_radius_at",
|
||||
"outline_bbox",
|
||||
"outline_prims",
|
||||
@@ -140,6 +155,7 @@ __all__ = [
|
||||
"radial_profile",
|
||||
"rotate",
|
||||
"scale",
|
||||
"section_view",
|
||||
"segment_bounds",
|
||||
"silhouette_prims",
|
||||
"translate",
|
||||
|
||||
Reference in New Issue
Block a user