volmdlr_tools.features.rules package#
Design-guideline rules over recognized features. A rule compares a feature’s parameters and the part’s measurements against thresholds and answers a verdict with a reason; rules own their thresholds, features and measurements never do. Thresholds are constructor arguments, so a company’s own guideline is applied by configuring the rules with its numbers.
Submodules#
volmdlr_tools.features.rules.core module#
Guideline-agnostic rule layer: verdicts, results, and the validation report.
A rule is one design check, applied to one feature. It owns its
thresholds (ADR 0001: features never hold thresholds, and neither does the
recognition constants module), reads parameters off the feature and
measurements off the part, and answers a Verdict with a reason.
Nothing here knows any guideline. Rules take their thresholds as constructor
arguments, so a company’s own guideline is a set of configured rule instances,
not new code; volmdlr_tools.features.rules.stamping ships the
sheet-metal rules with conservative defaults, and a molding rule set would sit
beside it and reuse everything in this module.
Every length in this layer — thresholds, measured values, the sheet thickness — is in SI metres. The comparisons are only meaningful on a model whose own units are metres, which is what every model and fixture in this repo uses.
- class volmdlr_tools.features.rules.core.ManufacturingContext(material_grade: str | None = None, pierce_sequence: Literal['pierced_before_bend', 'slider_pierced'] | None = None, name: str = '')#
Bases:
DessiaObjectWhat a rulebook needs to know about a part that its geometry cannot say.
Material grade and pierce sequence are facts about how a part is made, not about its shape, so they are supplied by whoever is running the validation and are never inferred from the model (ADR 0001: non-geometric inputs enter at the rule layer, as a context object). A validation must not quietly assume a material the designer did not state.
Everything here is optional, and a rulebook run without a context is exactly a run with an empty one. What each rule does with a missing piece is the rule’s own business: a rule whose threshold is a single scalar with two branches falls back to the stricter branch and records the assumption in its reason, while a rule whose threshold comes from a grade-indexed table reports indeterminate, because guessing across the table’s range would be noise dressed as a verdict.
Both fields say “not stated” the same way, with None, so a caller never has to remember which one uses a sentinel.
- Parameters:
material_grade – The grade as the material standard designates it (e.g.
"S500 MC"), or None when it is not stated. Matched against a rule’s table case- and space-insensitively; an unrecognized grade is not a silent pass.pierce_sequence – When the part’s holes are pierced relative to bending —
"pierced_before_bend"or"slider_pierced"— or None when it is not stated.name – Optional name.
- class volmdlr_tools.features.rules.core.Rule(reference: str = '')#
Bases:
objectOne design check, applied to one feature at a time.
Subclasses declare their identity as class attributes, take their thresholds as constructor arguments, and implement
applies_to()andevaluate(). Callers useapply(), which turns “this rule does not concern that feature” into a"not_applicable"result rather than a silent skip.A rule’s attributes are write-once: set in the constructor, never rebound. The shipped rules are shared module-level instances, so retuning one in place would silently retune it for every other caller; another guideline’s numbers are a new instance instead.
- Variables:
rule_id – Stable identifier, used to select results out of a report.
title – One-line human title.
- Parameters:
reference – Where this instance’s thresholds come from — a clause of the caller’s own guideline — carried onto every result it produces.
- applies_to(feature: Feature) bool#
Whether this rule concerns feature at all.
- Parameters:
feature – The candidate feature.
- Returns:
True when the rule should be evaluated on it.
- apply(inputs: RuleInputs) RuleResult#
Evaluate the rule, or report that it does not concern the feature.
- Parameters:
inputs – The feature with its part-level values and measurements.
- Returns:
Always a result — a rule is never silently skipped.
- compared(inputs: RuleInputs, measured_value: float, threshold: float, subject: str, requirement: str) RuleResult#
Judge a measured value against a minimum and phrase the verdict.
Every clause in a rulebook reaches its pass and its failure the same way and should read the same way; only what was measured and which limit it was held to differ, and those are the two arguments.
- Parameters:
inputs – The inputs the verdict was reached from.
measured_value – The quantity measured.
threshold – The minimum it must reach.
subject – What was measured, as a noun phrase (“the inside radius”).
requirement – The limit it was held to, as a noun phrase (“the 2s minimum for this sheet”) — see
limit_phrase()when an absolute floor may be the binding one.
- Returns:
The passed or failed result.
- evaluate(inputs: RuleInputs) RuleResult#
Judge a feature the rule concerns.
Only called for features
applies_to()accepted.- Parameters:
inputs – The feature with its part-level values and measurements.
- Returns:
The verdict.
- static limit_phrase(sheet_thickness: float, factor: float, floor: float) str#
Name whichever of the scaled minimum and the absolute floor actually binds.
A clause with both states two limits and applies the larger. Saying “under the 2s minimum” when it was the 3 mm floor that the feature missed sends a reader to the wrong line of the guideline.
- Parameters:
sheet_thickness – The part’s nominal sheet thickness s, in metres.
factor – The multiplier on s.
floor – The absolute minimum, in metres.
- Returns:
The binding limit as a noun phrase.
- static meets(measured_value: float, threshold: float) bool#
Whether a measured value clears a minimum, reading equality with float slack.
- Parameters:
measured_value – The measured quantity.
threshold – The minimum it must reach.
- Returns:
True when the value is at or above the threshold.
- result(inputs: RuleInputs, verdict: Literal['passed', 'failed', 'not_applicable', 'indeterminate'], reason: str, measured_value: float | None = None, threshold: float | None = None) RuleResult#
Build a result for this rule on the checked feature.
- Parameters:
inputs – The inputs the verdict was reached from.
verdict – The outcome.
reason – Why, in one sentence.
measured_value – The quantity compared, if any.
threshold – What it was compared against, if any.
- Returns:
The populated result.
- rule_id: ClassVar[str] = ''#
- title: ClassVar[str] = ''#
- class volmdlr_tools.features.rules.core.RuleInputs(feature: Feature, sheet_thickness: float | None = None, aag: AttributedAdjacencyGraph | None = None, border_nodes: Sequence[int] = (), candidates: Sequence[Feature] = (), bends: Sequence[Feature] = (), context: ManufacturingContext | None = None, edge_distance: EdgeDistanceMeasurement | None = None, feature_distance: FeatureDistanceMeasurement | None = None, bend_distance: BendDistanceMeasurement | None = None, flange_length: FlangeLengthMeasurement | None = None, connectors: Sequence[Feature] = (), on_outer_contour: bool | None = None)#
Bases:
objectEverything a rule may read about one feature, measurements included.
Measurements are computed on first read and cached, so a rule that never looks at a distance never pays for one. Passing a measurement in pre-computed short-circuits that — which is what makes rules testable on synthetic values with no geometry at all.
Not a
DessiaObject: this is the argument bundle of a call, never part of a stored report. The laziness here is not the attribute-hiddenO(part)computation ADR 0001 rejects — that objection is about a feature pretending a relational quantity is one of its own parameters. A bundle built for one rulebook run, by a caller that already handed it the part, hides nothing from anybody.- Parameters:
feature – The feature being checked.
sheet_thickness – The part’s nominal sheet thickness s, or None when the part is not recognized as sheet metal.
aag – The model’s graph, needed to reach the border faces an edge distance is measured to.
border_nodes – The part’s outer contour faces, for edge distance and for telling a border feature from an opening.
candidates – The part’s internal cut features, for feature distance.
bends – The part’s bends, for bend distance. Kept public, unlike the other target lists: a clause about holes on bended surfaces has to be able to tell “this part has no bend” from “the distance could not be measured”, and a measurement that answered nothing cannot say which.
context – What the part’s geometry cannot say — material grade, pierce sequence — or None when the caller stated none.
edge_distance – A pre-computed edge distance, if any.
feature_distance – A pre-computed feature distance, if any.
bend_distance – A pre-computed bend distance, if any.
flange_length – A pre-computed flange length, if any.
connectors – Formed rims joining cut fragments into one opening, for feature distance (see
opening_connectors()).on_outer_contour – Whether the feature belongs to the border, as the caller measured it on the geometry (see
features_on_outer_contour()); None falls back to whether a face of it is a border face.
- property bend_distance: BendDistanceMeasurement | None#
The ligament to the nearest bend zone, measured on first read.
Needs no graph, for the same reason the feature distance does not: a bend is a shape, and so is the feature being measured.
- Returns:
The measurement, or None when no bends were supplied.
- property edge_distance: EdgeDistanceMeasurement | None#
The ligament to the part’s outer contour, measured on first read.
- Returns:
The measurement, or None when no graph was supplied.
- property feature_distance: FeatureDistanceMeasurement | None#
The ligament to the nearest other cut feature, measured on first read.
Needs no graph: both sides of this measurement are features, and a feature is a shape that can measure itself against another.
- Returns:
The measurement, or None when no candidates were supplied.
- property feature_type_name: str#
The checked feature’s type tag as plain text, for a reason a human reads.
- Returns:
The type’s value, e.g.
"notch"; empty when it has none.
- property flange_length: FlangeLengthMeasurement | None#
The shorter of the flanges running out of this bend, measured on first read.
Unlike the distances this is only defined on a bend, and it does need the graph: a bend owns its zone but not the flanges either side of it.
- Returns:
The measurement, or None when the feature is not a bend or no graph was supplied.
- property on_outer_contour: bool#
Whether the feature belongs to the part’s outer contour.
Such a feature — a notch, a corner, a corner relief, an opening that touches the edge — is the border itself, not an opening inside the sheet: its distance to the border is zero by construction, and an opening’s distance to it is an edge distance.
- Returns:
The caller’s geometric answer when one was given; otherwise whether a face of the feature is a border face, False when no border was supplied.
- class volmdlr_tools.features.rules.core.RuleResult(rule_id: str, verdict: Literal['passed', 'failed', 'not_applicable', 'indeterminate'], reason: str, feature_nodes: list[int], feature_type: str = '', measured_value: float | None = None, threshold: float | None = None, reference: str = '', name: str = '')#
Bases:
DessiaObjectOne rule’s verdict on one feature, with everything needed to argue it.
Carries the measured value and the threshold it was compared against, so a failure can be argued rather than taken on trust. The feature is identified by its AAG face indices — live feature objects belong to their
FeatureProcessor, not to a report.- Parameters:
rule_id – Stable identifier of the rule that produced this.
verdict – The outcome:
"passed","failed","not_applicable"(the rule does not concern the feature) or"indeterminate"(it does, but an input it needs is unavailable).reason – Why, in one sentence.
feature_nodes – AAG face indices of the checked feature.
feature_type – The checked feature’s type tag.
measured_value – The quantity compared, in metres; None when none could be measured.
threshold – What it was compared against; None when no threshold could be derived.
reference – Where the configured rule’s threshold comes from — a clause of the caller’s own guideline — or empty when none was given.
name – Optional name.
- class volmdlr_tools.features.rules.core.ValidationReport(rulebook: str, results: list[RuleResult], name: str = '')#
Bases:
DessiaObjectThe collected verdicts of one rulebook run over a part’s recognized features.
- Parameters:
rulebook – The name of the rule set that was run.
results – One result per (rule, feature) pair evaluated.
name – Optional name.
- property counts: dict[str, int]#
Number of results per verdict, keyed by the verdict’s value.
- Returns:
A count for every verdict, zeros included, so a summary never has to guess whether a missing key means zero or means unchecked.
- results_with(verdict: Literal['passed', 'failed', 'not_applicable', 'indeterminate']) list[RuleResult]#
Select the results carrying one verdict.
- Parameters:
verdict – The verdict to select.
- Returns:
The matching results, in report order.
- to_markdown() str#
Render the report as markdown: the tally, then what was not answered cleanly.
The table lists failures and indeterminates — the verdicts a reviewer opened the report to find. Passes and not-applicables are counted in the tally and go no further: on a production part the not-applicable rows outnumber the failures many to one, and listing them buries the handful that matter.
- Returns:
Markdown-formatted string.
- volmdlr_tools.features.rules.core.checked_pierce_sequence(pierce_sequence: str) Literal['pierced_before_bend', 'slider_pierced']#
Return
pierce_sequencewhen it names a pierce sequence.- Parameters:
pierce_sequence – The candidate pierce sequence.
- Returns:
The pierce sequence, unchanged.
- Raises:
ValueError – When it names none of
PIERCE_SEQUENCES.
- volmdlr_tools.features.rules.core.checked_verdict(verdict: str) Literal['passed', 'failed', 'not_applicable', 'indeterminate']#
Return
verdictwhen it names a verdict.- Parameters:
verdict – The candidate verdict.
- Returns:
The verdict, unchanged.
- Raises:
ValueError – When it names none of
VERDICTS.
- volmdlr_tools.features.rules.core.format_face_list(nodes: Sequence[int], width: int = 40) str#
Render a feature’s face indices short enough not to swallow the row it sits in.
A single formed feature can carry two dozen faces; spelled out, that one cell dwarfs every other column. Long lists collapse to the first index and a count of the rest — the full set is on the
RuleResultfor anyone who needs it.- Parameters:
nodes – The feature’s AAG face indices.
width – The character budget for the spelled-out form.
- Returns:
The display string.
- volmdlr_tools.features.rules.core.format_rule_label(result: RuleResult) str#
Name the rule behind a result, with its guideline reference when one was configured.
- Parameters:
result – The result to label.
- Returns:
The rule id, followed by the reference in parentheses if any.
- volmdlr_tools.features.rules.core.run_rulebook(rules: Iterable[Rule], inputs: Iterable[RuleInputs], rulebook: str, name: str = '') ValidationReport#
Apply every rule to every feature and collect the verdicts.
Guideline-agnostic: the caller supplies the rules and the rule set’s name, this walks the cross product.
validate_part()builds the inputs from a processor; call this directly to check synthetic inputs.- Parameters:
rules – The rules to apply.
inputs – One bundle per feature to check.
rulebook – The name of the rule set being run.
name – Optional name for the report.
- Returns:
The populated report.
- volmdlr_tools.features.rules.core.validate_part(processor: FeatureProcessor, rules: Iterable[Rule], rulebook: str, context: ManufacturingContext | None = None, name: str = '') ValidationReport#
Run a set of rules over a part’s recognized features.
The entry point of the rule layer: hand it a processor that has extracted its features and the rules to check, and it answers a report. Reads the part’s nominal sheet thickness and outer contour off the processor (ADR 0001: part-level values live there), measures each feature’s distances and flanges as the rules ask for them, and collects one verdict per rule per feature.
Every recognized feature is put to every rule, not just the ones a rule concerns: a rib gets a not applicable from a hole rule rather than being dropped before the report, so a feature missing from the tally means recognition never found it, never that a rule quietly passed over it. The one exception is a bend’s shadow — the boundary group the classifier also names a bend, carrying none of its radius faces — which is dropped when the bend it shadows is there with its zone (see
without_bend_shadows()): that fold is checked, once. The bends a jog or a lance owns are put to the rules beside it (seewith_held_folds()), as every other bend is. Likewise the holes a perforation owns are put to the rules beside it (seewith_perforation_holes()), each judged as the cavity it was read as; the perforation itself is no cut feature, so no web is measured to the field as a whole. And one addition: the walls of a flanged cutout’s cut — a louvre’s slit, an extrusion hole’s pierce — are put to the rules as a cut feature of their own (seeopening_cut_walls()). The opening owns them, so recognition reports no cavity over them, but it is no cut feature itself: without them, the web from a slit to the next opening, to the border or to a bend would never be judged. They stand for the opening’s cut, not for a second feature recognition found. Only the targets a measurement may reach for are narrowed. A spacing measurement reaches only for cut features inside the sheet, since one on or touching the outer contour is the border an edge distance measures to. A bend distance narrows inside the measurement: the rules are handed every bend the part is described as having, so a rule can tell an unbent part from one whose bends could not be measured, while the distance itself only reaches for bends that carry a readable zone.Features are read, never extracted: a processor with nothing extracted yields an empty report rather than silently re-running recognition.
- Parameters:
processor – The part’s feature processor, features already extracted.
rules – The rules to apply.
rulebook – The name of the rule set being run, shown on the report.
context – What the part’s geometry cannot say — material grade, pierce sequence. Optional, and omitting it is exactly passing an empty one: the rules that need it report indeterminate or fall back to their stricter branch, so a context-free caller keeps working and never gets an optimistic verdict.
name – Optional name for the report.
- Returns:
The validation report.
volmdlr_tools.features.rules.stamping module#
Sheet-metal stamping rules.
Generic design checks for pierced and bent sheet metal. Each rule takes its
thresholds as constructor arguments; the defaults are conservative values
common to stamping practice, and a company’s own guideline is applied by
constructing the rules with its numbers (and, optionally, a reference
naming the clause they come from). ADR 0001: rules own all thresholds, and
nothing else in the codebase carries these.
Thresholds are lengths in SI metres, like the rest of the rule layer
(core), with the millimetre value given
in the docstring.
Covered here: minimum hole diameter, minimum spacing between features, minimum distance from a feature to the border, minimum distance from a hole to a bend, minimum inside bend radius and minimum flange length.
Two of those need to know something the CAD model cannot say — which material
grade the part is, and whether its holes are pierced before or after bending.
That arrives as a ManufacturingContext
the caller supplies, and each rule decides for itself what a missing piece
means: the hole-to-bend rule falls back to its stricter branch and records the
assumption, while the bend-radius rule reports indeterminate, because its
threshold spans a twelvefold range across material grades and a guess would be
noise dressed as a verdict.
- class volmdlr_tools.features.rules.stamping.HoleToBendDistanceRule(thickness_factors: Mapping[Literal['pierced_before_bend', 'slider_pierced'], float] | None = None, absolute_minimums: Mapping[Literal['pierced_before_bend', 'slider_pierced'], float] | None = None, assumed_pierce_sequence: Literal['pierced_before_bend', 'slider_pierced'] = 'slider_pierced', reference: str = '')#
Bases:
RuleA pierced opening must sit clear of where the sheet starts to fold.
Two branches, and which one applies is a fact about the press line, not about the part: by default a hole pierced flat before bending only has to clear the fold by 2s, never under 3 mm, while one pierced after bending by a slider needs 4s and never under 6 mm, because the slider itself needs the room. Those limits are usually quoted for holes up to 10 mm across.
The pierce sequence comes from the caller’s
ManufacturingContext. When it is not stated the assumed branch — the stricter one by default — applies and the verdict’s reason says so, so an unstated process can never turn into an optimistic pass. The bend-radius rule, whose threshold is a table, refuses to guess instead.A ligament from an opening to a bend is dimensioned here and not by the general feature-spacing rule. Only openings inside the sheet are dimensioned: a cut on the outer contour — a bend relief, a notch — is not applicable, because a relief sits against the fold by design.
The measured value understates the true ligament across a fold (ADR 0002), so this rule errs toward reporting a violation rather than missing one.
- Variables:
APPLICABLE_CATEGORIES – The feature categories that are openings a distance to a bend can be measured from.
- Parameters:
thickness_factors – The multiplier on s for each pierce sequence.
absolute_minimums – The floor for each pierce sequence, in metres (default 3 mm pierced before bending, 6 mm slider-pierced).
assumed_pierce_sequence – The branch applied when the caller stated none.
reference – Where these thresholds come from, if any.
- Raises:
ValueError – When a pierce sequence has no factor or no floor — a part pierced that way would otherwise fail with a KeyError mid-report.
- APPLICABLE_CATEGORIES: ClassVar[frozenset] = frozenset({FeatureCategory.CAVITY, FeatureCategory.CUT})#
- applies_to(feature: Feature) bool#
Whether feature is an opening this rule places relative to a bend.
- Parameters:
feature – The candidate feature.
- Returns:
True for material-removal features.
- evaluate(inputs: RuleInputs) RuleResult#
Compare the opening’s ligament to the nearest bend against the minimum.
- Parameters:
inputs – The feature with its part-level values, measurements and context.
- Returns:
The verdict.
- rule_id: ClassVar[str] = 'minimum-hole-to-bend-distance'#
- threshold(sheet_thickness: float, pierce_sequence: Literal['pierced_before_bend', 'slider_pierced']) float#
Return the smallest hole-to-bend ligament allowed.
- Parameters:
sheet_thickness – The part’s nominal sheet thickness s, in metres.
pierce_sequence – Which branch applies.
- Returns:
The minimum distance, in metres.
- title: ClassVar[str] = 'Minimum distance from a hole to a bend'#
- class volmdlr_tools.features.rules.stamping.MinimumEdgeDistanceRule(thickness_bands: Sequence[tuple[float, float]] = ((0.0015, 2.0), (0.001, 3.0)), thin_sheet_factor: float = 4.0, absolute_minimum: float = 0.003, reference: str = '')#
Bases:
_LigamentRuleThe web of material between an opening and the border of the sheet.
Stamping guidelines dimension hole-to-border with the same banded web as hole-to-hole, so the thresholds and their defaults are those of
_LigamentRule; configure them separately when a guideline does not.- measured_web: ClassVar[str] = 'the web to the border'#
- static measurement(inputs: RuleInputs) EdgeDistanceMeasurement | None#
Return the web to the part’s outer contour.
- Parameters:
inputs – The feature with its part-level values and measurements.
- Returns:
The edge-distance measurement, if one could be taken.
- rule_id: ClassVar[str] = 'minimum-edge-distance'#
- title: ClassVar[str] = 'Minimum distance to the border'#
- class volmdlr_tools.features.rules.stamping.MinimumFeatureSpacingRule(thickness_bands: Sequence[tuple[float, float]] = ((0.0015, 2.0), (0.001, 3.0)), thin_sheet_factor: float = 4.0, absolute_minimum: float = 0.003, reference: str = '')#
Bases:
_LigamentRuleThe web of material between two openings, banded by sheet thickness.
Evaluated per feature on its nearest-neighbour distance, so a pair that is too close fails on both of its members — each one’s nearest neighbour is the other. Neighbours are other openings inside the sheet; fragments of the same cutout are not each other’s neighbours (see
group_openings()).Thresholds and their defaults are those of the banded web; see
_LigamentRule.- measured_web: ClassVar[str] = 'the web to the nearest feature'#
- static measurement(inputs: RuleInputs) FeatureDistanceMeasurement | None#
Return the web to the nearest other opening.
- Parameters:
inputs – The feature with its part-level values and measurements.
- Returns:
The feature-distance measurement, if one could be taken.
- rule_id: ClassVar[str] = 'minimum-feature-spacing'#
- title: ClassVar[str] = 'Minimum spacing between features'#
- class volmdlr_tools.features.rules.stamping.MinimumFlangeLengthRule(thickness_factor: float = 2.0, reference: str = '')#
Bases:
RuleA flange must be at least a multiple of the sheet thickness long.
A flange shorter than that cannot be held down over its whole length as it forms, so the material deforms under the surface pressure and the free edge comes out sharp. Measured from the bend’s tangent line to the flange’s free edge, on the shorter of the two flanges either side of the bend.
- Variables:
APPLICABLE_TYPES – The feature types this rule dimensions, the same set the bend measurements are defined on.
- Parameters:
thickness_factor – The multiplier on s (default 2).
reference – Where this threshold comes from, if any.
- APPLICABLE_TYPES: ClassVar[frozenset[FeatureType]] = frozenset({FeatureType.BEND})#
- applies_to(feature: Feature) bool#
Whether feature is a bend whose flanges this rule dimensions.
- Parameters:
feature – The candidate feature.
- Returns:
True for plain bends.
- evaluate(inputs: RuleInputs) RuleResult#
Compare the bend’s shorter flange against the minimum.
- Parameters:
inputs – The feature with its part-level values and measurements.
- Returns:
The verdict.
- rule_id: ClassVar[str] = 'minimum-flange-length'#
- threshold(sheet_thickness: float) float#
Return the shortest flange allowed at a given sheet thickness.
- Parameters:
sheet_thickness – The part’s nominal sheet thickness s, in metres.
- Returns:
The minimum flange length, in metres.
- title: ClassVar[str] = 'Minimum flange length'#
- class volmdlr_tools.features.rules.stamping.MinimumHoleDiameterRule(thickness_factor: float = 2.0, absolute_minimum: float = 0.0036, reference: str = '')#
Bases:
RuleA pierced hole must be at least a multiple of the sheet thickness across.
The punch has to survive the piercing force, which is why the limit scales with the sheet and why a floor applies to thin sheet where the scaled limit would leave a punch too slender to grind.
The default 2.0 multiplier is the conservative one; softer grades are often allowed 1.5s, but choosing that needs a material object, which does not exist yet.
- Variables:
APPLICABLE_TYPES – The feature types that are round openings with a diameter to check.
- Parameters:
thickness_factor – The multiplier on s.
absolute_minimum – The floor no thickness goes under, in metres (default 3.6 mm).
reference – Where these thresholds come from, if any.
- APPLICABLE_TYPES: ClassVar[frozenset[FeatureType]] = frozenset({FeatureType.BLIND_HOLE, FeatureType.COUNTERBORE, FeatureType.COUNTERDRILL, FeatureType.COUNTERSINK, FeatureType.HOLE, FeatureType.ROUND_CAVITY, FeatureType.STEPPED_HOLE, FeatureType.TAPER_HOLE, FeatureType.THROUGH_HOLE})#
- applies_to(feature: Feature) bool#
Whether feature is a round opening this rule dimensions.
Keyed on the feature type enum rather than on classes, so a hole recognized by any extractor is covered and a class-hierarchy refactor cannot silently drop one.
- Parameters:
feature – The candidate feature.
- Returns:
True for hole and round-cavity types.
- evaluate(inputs: RuleInputs) RuleResult#
Compare the hole’s diameter against the minimum.
- Parameters:
inputs – The feature with its part-level values.
- Returns:
The verdict.
- rule_id: ClassVar[str] = 'minimum-hole-diameter'#
- threshold(sheet_thickness: float) float#
Return the smallest diameter allowed at a given sheet thickness.
- Parameters:
sheet_thickness – The part’s nominal sheet thickness s, in metres.
- Returns:
The minimum diameter, in metres.
- title: ClassVar[str] = 'Minimum hole diameter'#
- class volmdlr_tools.features.rules.stamping.MinimumInsideBendRadiusRule(minimum_radius_factors: Mapping[str, tuple[float | None, float | None]] | None = None, thin_sheet_limit: float = 0.003, thick_sheet_limit: float = 0.006, reference: str = '')#
Bases:
RuleA bend must not be tighter than its material grade allows.
Bent too tight, the outside of the fold delaminates. How tight is too tight is a property of the steel, not of the shape: the default table runs from 0.25s for the softest hot-rolled grades to 3.0s for the hardest dual-phase ones, a twelvefold range, and steps up again for sheet over 3 mm.
Without a stated grade the verdict is indeterminate. Picking a conservative default across a twelvefold range would fail nearly every bend ever drawn, which is not a conservative answer but a useless one — unlike the hole-to-bend rule, where the two branches differ by a factor of two and the stricter one is a usable assumption.
The table is given for 90-degree bends and is applied as-is to any angle; a verdict on a bend that turns otherwise says so in its reason. A grade missing from the table and a grade the table leaves blank at this thickness are both indeterminate, with reasons that tell them apart.
- Variables:
APPLICABLE_TYPES – The feature types this rule dimensions, the same set the bend measurements are defined on — hems and curls are folds too, but they have their own limits.
- Parameters:
minimum_radius_factors – A grade-indexed table in the shape of
DEFAULT_MINIMUM_RADIUS_FACTORS, which is used when omitted. Grades are matched case- and space-insensitively.thin_sheet_limit – The top of the first thickness band, in metres (default 3 mm). Tables commonly print the bands as “s <= 3” and “3 <= s <= 6”, so this thickness falls in both; there the larger of the two minima is applied, because thicker sheet needs more radius.
thick_sheet_limit – The top of the second band, past which the table says nothing, in metres (default 6 mm).
reference – Where this table comes from, if any.
- APPLICABLE_TYPES: ClassVar[frozenset[FeatureType]] = frozenset({FeatureType.BEND})#
- applies_to(feature: Feature) bool#
Whether feature is a bend this rule dimensions.
- Parameters:
feature – The candidate feature.
- Returns:
True for plain bends.
- evaluate(inputs: RuleInputs) RuleResult#
Compare the bend’s inside radius against the table’s minimum for its grade.
- Parameters:
inputs – The feature with its part-level values and context.
- Returns:
The verdict.
- factor(grade: str, sheet_thickness: float) float | None#
Return the table’s multiplier on s for a grade and a thickness.
On the one thickness both bands claim, the larger of the two applies (see
thin_sheet_limit); a band the table leaves blank has no multiplier at all, and answering the other band’s would be inventing one.Both band limits are read with the same float slack as a verdict, like the ligament rules’ bands: s is measured off the geometry, and a sheet drawn at exactly 3 mm can come back a hair either side of it — which must neither drop it into the more lenient thin band nor push it past the table.
- Parameters:
grade – The material grade, matched case- and space-insensitively.
sheet_thickness – The part’s nominal sheet thickness s, in metres.
- Returns:
The multiplier, or None when the table has no row for that grade or no entry for that thickness band.
- rule_id: ClassVar[str] = 'minimum-inside-bend-radius'#
- title: ClassVar[str] = 'Minimum inside bend radius'#