Part 1 (model, geometry, views, commands, IFC) is on feat/wall-profiles.
These notes are for part 2 (the app’s profile sketch) and part 3 (per-layer
vertical extents).
cc_core::wall_profile::WallProfile { outline: Vec<DVec2>, sketch: Option<Sketch> }
on Wall::profile (format 31; 30 is taken by another open change).u = meters along the wall’s drawn location line from Wall::start
(for a straight wall this equals u along the body centerline, which is the
frame of doors, windows, niches and WallGeom), z = meters above
Project::wall_base_z(e, w) (level elevation + base_offset).WallProfile::fitted; check(length)
validates and returns Chains { bottom, top } (each by increasing u;
consecutive points at one u are a vertical step). Rules: one simple loop,
every vertical line crosses it at most twice, no holes, u within
[0, length] (±TOL), z within -MAX_BELOW..=MAX_ABOVE, area ≥ MIN_AREA,
span ≥ MIN_LENGTH, at most MAX_POINTS.WallProfile::from_sketch(sketch, wall.length()),
from_outline(points, length) or sloped(length, base, top). Errors are
ProfileError values with point() (where, in [u, z]) and key() (i18n:
wall-profile-*, or the sketch’s sketch-* keys; all 12 languages have them).WallProfile::curves() gives the sketch, or lines along the outline.holds(u0, u1, z0, z1) tells whether a door/window rectangle fits.EditCtx::finish → sync_wall_profiles):
refit(old, shift, new):
kept in place along the wall (a start moved along the wall’s own line gives
shift), cut at the ends, points of an end it reached follow that end when
the wall grows there; dropped when nothing is left.reversed(length) in Element::transform (walls swap ends).wall_ops::split gives the second wall refit(len, t, len - t).attach_top never coexist: commands refuse, repair drops
attach_top.Project::repair): invalid → dropped; past the wall’s end → cut;
stale sketch → dropped.wall_profile_set { wall, curves | points }, wall_profile_slope { wall,
top_start, top_end, base_start, base_end }, wall_profile_remove { wall }.sketch_get { id: wall } → {curves, drawn, frame: "wall_elevation", profile};
without a profile it returns the nominal rectangle 0..length × 0..height
with profile: false — the natural starting sketch for the app.sketch_set { id: wall, curves } sets the profile (same checks).wall_create { …, profile: [curves] }.element_get → params.profile and derived.profile {area, min_z, max_z, start, end}.attach_top, framed walls
(Project::wall_framing_of). check_takes_profile is pub(crate) there.build_walls lifts the chains to absolute z and:
join_start/join_end on the WallLine of an end the profile
stops short of (END_REACH = 1 mm), and sets start_ext/end_ext to the
profile’s ends there (square caps);z range for the “joins only walls that overlap in
height” filter;Chains::holds;WallGeom::set_elevation(chains) after set_openings and before
set_recesses.WallGeom: base_z stays the nominal base (sills and IFC placements are
relative to it); top_z is the profile’s highest point; profile:
Option<Chains> (absolute), bottom_profile/top_profile segments
(u0, u1, z0, z1), is_profiled().solid intervals are
the heights at its middle. For exact heights use
intervals_at(column, u) (public now), solid_at(u, z), or
cut_columns(z) (columns split where the chains cross a level plane; each
piece’s solid is exact for is_solid_at(z)).profile_outline() gives the outline in (u, z_abs) carried on to the
corners of mitered ends (what IFC sweeps).volume() evaluates heights at the centroid of each column’s footprint, so
it is exact for planar tops/bases, also at mitered ends (this also made
attached-top walls’ volume exact).left.0 and right.0)
does not split the column; the end column uses the first segment’s line.
Harmless in practice, but per-layer extents should not rely on it.Sketch::makes compares within JOIN_TOL; fitted snaps u within
TOL / 2 of the wall’s ends, so a sketch that ends a hair past the end
still “makes” the outline.Sketch::from_polygons (used by check’s crossing test) drops sides shorter
than JOIN_TOL: an outline with points closer than 0.1 mm can fail as an
open sketch.WallGeom::openings lacks them; opening_fills too). The app may want to
warn: compare Project::hosted_by(wall) with g.openings.set_openings still clamps openings to [base_z, top_z]: an opening below
the nominal base cannot be cut even where the profile goes lower.cut_columns; attached-top walls still use the
raw columns (unchanged behaviour).u = (P - w.start)·dir (dir = Wall::direction()) and
z = height - wall_base_z; a view looking at the wall’s back face sees u
growing to the left.sketch_get (the nominal rectangle when there is no profile),
finish with sketch_set (or wall_profile_set), cancel by not running it.
Show ProfileError::point() with key() like the plan sketch does for
SketchError.sketch_mode’s Target will need a wall-elevation target whose curves
live in (u, z); snapping to the wall’s ends (u = 0, u = length), its
base (z = 0) and its nominal top (z = height), and to levels, helps.wall_profile_remove.to_solid) and one set of chains; layers
exist only in plans (layers, layer_span, layer_pieces). Per-layer
extents mean, per layer band v0..v1, its own bottom/top: e.g. offsets of
the wall’s chains, or the wall’s base/top when there is no profile.to_solid would need a band per layer (or steps across v): the top/bottom
faces, side faces and caps already take per-corner heights, and
face_pieces takes a bottom and a top line; intervals_at would need a
v (or per-layer chains).cut_columns per layer band, so a layer cut off below the plane is
drawn as seen below; layer_span/core cleanup (core_ends, layer_gaps)
assume all layers share the column’s state.IfcBuildingElementParts.Part 3 is on feat/wall-profiles too (same PR, format 31).
Layer::base_offset (meters from the wall’s bottom at each point:
its nominal base, its profile’s bottom chain, or under an attached top the
flat base) and Layer::height: Option<f64> (from the layer’s own bottom,
clamped to the wall’s top; None to the top), both skipped in files when
default. cc_core::layer_extent: Extent { base_offset, height },
range(bottom, top), bounds MAX_OFFSET (±100 m), MIN_HEIGHT/MAX_HEIGHT,
check, repair (resets out-of-range values), clear (floors and roofs
take none). A layer above the wall’s top is simply absent there. Layers
never rise above the wall’s top (no strong reason found for parapet-like
layers; a profile does that job).cc_geom/src/wall_layers.rs, a child module of wall):
WallGeom::layer_extents is empty when every layer is default, and then
every path is the old one, bit for bit (tests compare faces point for
point). Otherwise consecutive layers with one extent form a Band; within
a column each height is a Lin (z0 + k u): the wall’s bottom and top
(column_lines), each band’s bottom and own top, the openings’ edges.
split_bands splits columns where any two of them cross (call it after
set_elevation or set_top_profile; build_walls and attach_wall_tops
do), so extent_lines(c, extent) — decided at the column’s middle — holds
across the column. Not in the mitered stretch of an end column
(split_column does not split there): a crossing inside it is drawn as if
at the stretch’s edge.intervals_at and Column::solid are the bands’ union
(joins, rooms, solid_at, rebar, plan column states); layer_intervals(c,
k, u) and intervals_at_v(c, u, v) are one layer’s. The joins’ height
filter reaches down to the lowest layer; base_z stays nominal.[base_z, top_z] as before: a core running below
the base continues under a door. Recesses are assumed to lie where the
layers they cut stand (their faces are built as in a plain wall; their
volume is taken from each layer they overlap, recess_layer_volume).layer_volumes = Σ columns (strip area × heights at the strip’s
centroid) − recess shares; a banded wall’s volume is their sum; for
plain walls they add up to volume. Join deductions
(ModelGeometry::join_deductions) are not spread over layers.
volumes_by_material, layer_range (absolute min/max), layer_outlines
(elevation polygons, openings left in) for IFC.plan::draw_banded_wall states each band per column piece
(cut_columns splits where a band’s line crosses the cut); the T-join
layer cleanup (layer_span, layer_pieces, core_ends, layer_gaps)
is reused as is, as if the layers stood at the cut. Sections keep one cut
material (the type’s cut_material) over the stepped outline, as they
did for whole walls.layer_bodies writes one item per layer (strips extruded at their
heights for level walls and arc walls; profile walls sweep each
layer_outlines polygon across the layer, and when one item is clipped
at a mitered end all are, so the Clipping representation holds only
clipping results). Attached tops are exported to top_z as plain walls
are. ConstructCAD_WallLayers: Extents (RON via curtain::to_text) in
the IfcWallType’s HasPropertySets (not IfcRelDefinesByProperties,
which IFC4 forbids for type objects), Height/Width on each wall;
import (Importer::layered_wall, layer_extents) rebuilds the wall from
its axis (line, or an arc through its points) and matches types by their
extents too.world(u, v), span_at and per-column Lins; a wall whose base or
top is curved along u must split columns finely enough that each piece
is linear (as arcs are chorded), or Lin must become a curve with its own
crossing search. strip_area has a straight and an arc branch only;
strip_centroid_u assumes heights level along arcs. layer_outlines and
IFC’s layer_bodies assume straight profiled walls.