Technique Domains#

Split a mixed part into the regions each made by one modelling technique: extrusions, drafted extrusions, revolutions and sweeps, and read how each region stands on or is sunk into the one it hangs from.

Note

Prerequisites: Attributed Adjacency Graph (AAG)

Technique Domains#

What a technique domain is#

A mixed part is seldom one extrusion or one revolution. A profiled plate carries a turned hub, a turned shaft has a keyway milled into it, a moulded box carries a boss blended onto its top. Each region of such a part is made by one modelling technique, and that region is a technique domain.

technique_domains(reading) splits a part into its domains and reads how they hang together. It takes the part’s PartReading, the one reading of the part every technique shares (see Part Reading), and returns a DomainTree: the largest domain, the base, first, and every other domain after the domain it stands on or is sunk into. The techniques it tells apart are:

kind

Region

"extrusion"

A profile pushed straight along a direction, between flat caps

"drafted_extrusion"

The same with walls leaning by a draft angle, as on a moulded part

"revolution"

A profile turned about an axis

"sweep"

A profile carried round a path that lies in a plane

"free_form"

Faces no technique explains

A feature cut off from the rest of the part along one closed loop of edges, such as a boss, a pocket or a hole, is split off first and read on its own. A blend between two domains belongs to neither: it is a junction blend, applied once the domains are put back together.

Splitting a part#

A turned shaft with two steps and a keyway milled into the larger one is one revolution with one extrusion taken out of it. The shaft turns about Z: radius 10 from 0 to 40, then radius 7 up to 60. The keyway is 4 wide and 20 long, from 10 to 30, and 3 deep (download shaft_with_keyway.step, in millimetres):

from volmdlr.model import VolumeModel

from volmdlr_tools.features.part_reading import PartReading
from volmdlr_tools.reverse_engineering.techniques.domains import technique_domains

solid = VolumeModel.from_step("shaft_with_keyway.step", reading_unit="MM").primitives[0]
tree = technique_domains(PartReading(solid))
for domain in tree.domains:
    print(domain.index, domain.kind, domain.role, domain.parent, len(domain.face_ids))
# 0 revolution base None 5
# 1 extrusion remove 0 5
interface = tree.interface(1)
print(interface.kind, interface.sign, interface.closed)
# closed_loop remove True
print(tree.route())
# revolution

The two steps stay one revolution: the shoulder between them does not split a region one turn of the profile makes. The keyway hangs from the shaft along a closed loop, and removes material from it.

The turned shaft is one revolution domain (sand); the keyway milled into it is an extrusion domain (blue)

Face ids are those of the part’s adjacency graph, as the reading numbers them. technique_domains also takes:

  • features: the features cut off along closed loops, when you have them; pass an empty tuple to split by technique alone.

  • tol: the length below which two lengths are equal; by default a small share of the part’s bounding box diagonal.

It raises ValueError when every face of the part lies in its closed features, or when tol is not positive.

The domains#

Each TechniqueDomain holds:

  • index, its position in the tree, and parent, the index of the domain it hangs from (None for the base);

  • kind, the technique, and hypothesis, the direction it was built along (and, for a revolution, a point of its axis), None for a free-form domain;

  • role: "base" for the root, "add" for material standing on its parent, "remove" for material taken out of it, None when the interface does not tell;

  • wall_face_ids, the faces the technique shapes; cap_face_ids, the flat faces square to its direction that close it; absorbed_face_ids, the faces it holds that its technique does not explain, such as blends and chamfers lying inside it; and face_ids, all three;

  • piece, the closed feature it lies in, None for the body of the part;

  • area, bounding_box, and span, its extent along its direction;

  • draft_angle, in radians, for an extrusion: zero when straight, the angle its drafted walls lean by otherwise; None for the other kinds;

  • levels, for an extrusion, the positions of the caps along its direction; a domain stacking several slabs has more than two.

How domains meet#

Each domain but the base has one DomainInterface with its parent, given by tree.interface(index):

  • kind: "closed_loop" when the child is cut off along one closed loop of edges, "virtual_split" when the two meet along a face of the parent that the child’s technique would cap, as where a hub stands on the top of a plate beside it;

  • sign: "add", "remove", or None when no corner or blend along the interface is concave or convex, as at a tangent foot;

  • edge_ids, the edges along which they meet, closed, whether those edges close into loops, and length;

  • junction_blend_face_ids, the blends between the two;

  • carrier_face_ids, the faces of the parent the child meets, and carrier, their plane when they are flat, its w axis the parent’s outward normal;

  • extension and extension_direction: how far, and which way, to extend the child across the carrier so that it never meets its parent along a coincident face when the two are put back together: into the parent for an added child, out of it for a removed one.

A drafted box with a drafted boss blended onto its top is two drafted extrusions, each with its own draft, joined by one blend. Here the box is 60 by 40 at its foot and 20 high, its walls drafted by 3 degrees; the boss on its top is of radius 8 at its foot and 10 high, drafted by 2 degrees, and its foot is rounded R1.5 (download drafted_box_with_boss.step, in millimetres). Below, the box is sand, the boss blue and the junction blend between them magenta:

A drafted box (sand) and the drafted boss standing on it (blue), joined by a junction blend (magenta)

import math

from volmdlr.model import VolumeModel

from volmdlr_tools.features.part_reading import PartReading
from volmdlr_tools.reverse_engineering.techniques.domains import technique_domains

solid = VolumeModel.from_step("drafted_box_with_boss.step", reading_unit="MM").primitives[0]
tree = technique_domains(PartReading(solid))
for domain in tree.domains:
    print(domain.index, domain.kind, domain.role, round(math.degrees(domain.draft_angle), 1))
# 0 drafted_extrusion base 3.0
# 1 drafted_extrusion add 2.0
interface = tree.interface(1)
print(interface.kind, interface.sign, len(interface.junction_blend_face_ids))
# closed_loop add 1
print(tree.domain_of(next(iter(tree.junction_blend_face_ids))))
# None

Reading the tree#

DomainTree holds domains, interfaces, the closed features the part was split along first, the part’s face_count, and notes, what the split could not settle, in words. Every face of the part is owned by exactly one domain or is a junction blend. It answers:

  • root: the base domain;

  • children(index): the domains hanging from a domain;

  • interface(index): a domain’s interface with its parent, None for the base;

  • domain_of(face_id): the domain owning a face, None for a junction blend;

  • junction_blend_face_ids: every junction blend;

  • route(): the technique the whole body is built by when the body is one domain, None for a mixed part. Holes, pockets and bosses hanging from the body along closed loops do not make a part mixed, which is why the shaft above routes to "revolution" and the box to "drafted_extrusion".

Which techniques each face fits#

technique_fits(reading), in volmdlr_tools.reverse_engineering.techniques.technique_fits, gives the reading the split starts from: the hypotheses the part’s faces vote for, and how each face fits each of them. A TechniqueHypothesis is an extrusion along a direction, a revolution about the line through origin along direction, or a sweep round a path in a plane square to direction. The returned TechniqueFits holds the hypotheses, and answers fit(face_id, hypothesis), faces_fitting(hypothesis) and walls_of(face_id). Each FaceFit says whether the face is a "wall" or a "cap" of the hypothesis, its span along the direction and, for an extrusion wall, lean_sine, the sine of its draft angle.

See Also#