ConstructCraft

Pipe and fitting catalog (issue #383)

The user asked for “um catálogo de tubos e conexões para MEP hidráulico”. Issue #383 asks for European pipe series (PVC-U pressure EN ISO 1452, LDPE irrigation, PVC-U drainage EN 1329 / EN 1401) and their inside diameters in sizing. Scope chosen by the user (2026-11-16):

Today

Goals

Series in the project

cc_core::pipe_series adds PipeSeries to Project::pipe_series (BTreeMap<PipeSeriesId, PipeSeries>). It is tracked as settings and uses EditCtx::pipe_series_mut.

A series holds:

Series are copied into the project when they are first used, the same way catalog profiles become ProfileDefs. A project therefore keeps working when the built-in catalog changes, and files carry the series they use. repair_pipe_series bounds sizes and counts (MAX_SIZES, MAX_FITTINGS, MAX_SERIES). It drops rows whose size or size2 does not exist and resets dangling type references.

Pipe types

TypeData::Pipe gains two fields, both with serde defaults:

A type of a series has its diameter (and the new derived inside_diameter()) from the series row. EditCtx::finish → sync_pipe_series keeps the cached diameter in step inside the same transaction, the way sync_profiles does. Editing a series’ row resizes its types in one undo step.

A type with no series keeps today’s behavior. It may get an inside: Option<f64> override.

ElementType::inside_diameter(project) returns:

  1. the series row’s di, else
  2. inside, else
  3. the existing table fallback.

Built-in catalog (cc_core::pipe_catalog)

Series:

region series
Brazil PVC soldável NBR 5648; PVC esgoto NBR 5688 normal and reforçada; CPVC NBR 15884; PPR NBR 15813; copper NBR 13206; PEAD where public data allows
Europe PVC-U EN ISO 1452 PN10 and PN16; LDPE PN4 and PN6; PVC-U EN 1329-1; PVC-U EN 1401-1 SN4 and SN8; optionally PE100 SDR11 EN 12201 and copper EN 1057
US PVC Sch 40 and Sch 80 ASTM D1785; PVC DWV ASTM D2665; copper ASTM B88 type L and M; PEX ASTM F876; CPVC CTS ASTM D2846

Rules for the data:

Template

Fittings matched to the catalog (cc_geom::mep_net)

Geometry

For a matched fitting, each branch is a cylinder from the center to z + socket, of radius od/2 (or rules). Missing and uncatalogued fittings keep today’s sockets.

Sizing

size_pipes uses inside_diameter of the run’s type.

The required size is the smallest row of the run’s series that keeps the speed ≤ MAX_SPEED:

Runs without a series keep the WATER_PIPES table. PipeSizing gains size: Option<String>.

mep_size_apply picks among the project’s types of the run’s series. It creates a missing type of that series’ row in the same undo step, reported as created. It no longer mixes series.

Engine commands (cc_engine::commands::pipes)

command does
pipe_catalog lists the built-in series (code, name, region, material, use, standard), or one series’ sizes and fittings with series
pipe_series_list / pipe_series_get the project’s series
pipe_series_import from the built-in catalog (code) or a file (path or text). on_clash: skip, replace or rename. sizes: also make pipe types of those sizes ("all"). One undo step, returns {series, types}
pipe_series_export writes a project series in the file format
pipe_series_delete refused while types use it unless detach is set, which keeps the types free
pipe_type_create series (code or name) plus size: makes the type (named name size) and imports the series when it is not in the project
type_set takes series and size for pipe types
mep_fittings each item gains name, series, size/size2, missing and a reason. Composites list their pieces
mep_sizing gains the size

Schedules

IFC

App

Out of scope (follow-ups)

Tests

Plan shape

Three PRs, each with its own plan section:

  1. Core and data.
    • pipe_series, the file format, the catalog with the researched JSON, the type fields, sync, repair, the template and format 29.
    • The pipe_catalog, pipe_series_* and pipe_type_create commands.
    • Sizing by the inside diameter.
  2. Fittings.
    • Wye detection, matching, geometry and cut lengths.
    • mep_fittings, mep_size_apply, schedules and IFC.
  3. App. Type Properties, the Pipe Catalog dialog, the tool’s grouping, the docs and i18n in every language.