Repository navigation
Building Code for all standards - #486
Conversation
…thod, as data The demand of a building of dwellings, which sizes its entrance, by one shape the methods share: D = factor * F(n) * d + common + special + commercial + premises. data/building-demand.json holds Celesc N-321.0003, Cemig ND-5.2, Fecoergs REGD 035.01.06, Hidropan's RIC BT and Spain's ITC-BT-10; a utility or a country is a new entry, never code. Tables are kept as printed, with errata where the same table prints otherwise in the other standards (as_printed takes the printed value). Tests hold the standards' own examples and the data: sources, order, F(n) <= n, entrance rows without gaps, curves that meet their tables, and the four Brazilian diversity tables as one table.
The branch's 25 commits as one on main (a0c57b7), its history in backup/advanced-stair-tool-premerge: - Stairs: research on Revit's, Archicad's and Vectorworks' stair tools, and a plan for ours - Stairs: the plan takes building codes apart from technical standards, and what was decided of them - Stairs: building codes as data, winders, a location line and landings of their own length - Building codes: a project's own, saved under a name and handed on as XML; a stair's findings in a window - Stairs: landings and turns edited in Properties, and Flip - Stairs: grips on the plan - Stairs: winders balanced into the flights - Stairs: the walk line round a winding turn, and the tool's landings by the code - Stairs: turns by any angle, and the tool drawing run after run - Stairs: spirals - Stairs: stair types - Stairs: the solver - Stairs: multistorey, over storeys of different heights - Stairs: the plan symbol - Stairs: headroom, and the opening in the floor above - Stairs: custom sketched stairs - Stairs: the break mark through winders, the solver balancing them, IFC risers by storey - Stairs: runs of their own widths - Building codes: lengths in the project's units - Stairs: the code check while drawing, and a spiral's centre grip - Stairs: Properties say the location line a stair has, and plainer words in the check window - Stairs: drawn along a line, flights and landings as they are drawn - Stair plan: a handoff and the full to-do, with what the reference screenshots showed - Stairs: types by construction, finishes and plan symbols, subcategories and headroom, IFC both ways, codes with sources - Stairs: snapping to stairs and wall faces, winders unbroken, open stairs round turns, fast code checks On main: the stair's IFC roles take 90 to 98, after main's; a 3D triangle has both main's form visibility (vis) and the stair part (part), and every filter asks both; main's new prisms are whole elements (part 0); a stair edge is a reference face main's dimension messages name; the catalogs are regenerated.
CPFL: the factors are unchanged; the tables are renumbered (Tabela 15 for other buildings, 13 and 14 for motors, item 6.22.1). Tabela 1C's C9 goes to 52 kVA, B1 and B3 take a 32 mm conduit, C7 earths by 6 mm², the aluminium entry cable is given beside the copper one, and three-phase motors go to 300 cv. Enel: GRI-0017 version 02 (the former ET 1569) prints no power made available and stretches each range up to it, so Anexo A's ranges overlap; new 175 A rows in Anexos A (C8) and D (C5); Anexo A's earthing and C4's entry, Anexo B's B4/C4 connection and B9/C9 earthing, Anexo C's limits as printed. available_kw leaves the reply.
data/entrance-categories.json, read by entrance.rs, holds each utility's tables of categories as printed (phases, installed load and demand ranges, breaker, measurement and the other columns, each explained), and demand picks a unit's category from it. Groups list their members, found by their own names, and a member's own document on a category is cited. First utilities: Fecoergs (RIC BT REGD 035.01.06, Anexo J; Coprel's OTD 006.01 and Cerfox's OT_NIC_019 on C18), Hidropan (RIC 2014, Tabela 11), Energisa (NDU 001 v7.0, Tabelas 16 and 18), Equatorial (NT.00001 rev 09, Tabelas 1 and 2) and Copel (NTC 901100, Tabela 2).
…ce and the NEC Some methods print, by bands of the number of dwellings, a coefficient that weighs the sum of their powers rather than an equivalent number of dwellings. `diversity.kind: per_dwelling` takes such a table as data: F(n) = n * C(n), the last row holding past it, and the reply gives the `coefficient`. Such a total falls where a band begins (four dwellings at 1.00 ask more than five at 0.75), as the method does, so the data test checks that C never grows and stays at most 1 instead of F growing. Entries: Portugal's RTIEBT (801.5.2.2 and Quadro 803A), France's NF C 14-100 as SeQuelec's GP 16 works it (without electric heating) and the US NEC's Table 220.84. The default stays the equivalent count, so the existing entries read as before.
What is there now, what contributors proposed, the design (disciplines, sections, layers, tables, sources), the dialog, a catalogue of every parameter by tab, and the work in order. Nothing is built yet.
# Conflicts: # translations/ui/bimcraft-ui.pot # translations/ui/cs.po # translations/ui/de.po # translations/ui/es.po # translations/ui/fr.po # translations/ui/it.po # translations/ui/nl.po # translations/ui/pl.po # translations/ui/pt.po # translations/ui/vi.po # translations/ui/zh.po # translations/ui/zh_TW.po
# Conflicts: # translations/project/bimcraft-project.pot # translations/project/cs.po # translations/project/de.po # translations/project/es.po # translations/project/fr.po # translations/project/it.po # translations/project/nl.po # translations/project/pl.po # translations/project/pt.po # translations/project/sv.po # translations/project/vi.po # translations/ui/bimcraft-ui.pot # translations/ui/cs.po # translations/ui/de.po # translations/ui/es.po # translations/ui/fr.po # translations/ui/it.po # translations/ui/nl.po # translations/ui/pl.po # translations/ui/pt.po # translations/ui/vi.po # translations/ui/zh.po # translations/ui/zh_TW.po
# Conflicts: # CLAUDE.md # docs/areas/structure-and-mep.md # translations/project/bimcraft-project.pot # translations/project/cs.po # translations/project/de.po # translations/project/es.po # translations/project/fr.po # translations/project/it.po # translations/project/nl.po # translations/project/pl.po # translations/project/pt.po # translations/project/sv.po # translations/project/vi.po # translations/ui/bimcraft-ui.pot # translations/ui/cs.po # translations/ui/de.po # translations/ui/es.po # translations/ui/fr.po # translations/ui/it.po # translations/ui/nl.po # translations/ui/pl.po # translations/ui/pt.po # translations/ui/vi.po # translations/ui/zh.po # translations/ui/zh_TW.po
# Conflicts: # CLAUDE.md # crates/core/src/commands.rs # docs/areas/structure-and-mep.md # translations/project/bimcraft-project.pot # translations/project/cs.po # translations/project/de.po # translations/project/es.po # translations/project/fr.po # translations/project/it.po # translations/project/nl.po # translations/project/pl.po # translations/project/pt.po # translations/project/sv.po # translations/project/vi.po # translations/ui/bimcraft-ui.pot # translations/ui/cs.po # translations/ui/de.po # translations/ui/es.po # translations/ui/fr.po # translations/ui/it.po # translations/ui/nl.po # translations/ui/pl.po # translations/ui/pt.po # translations/ui/vi.po # translations/ui/zh.po # translations/ui/zh_TW.po
…ned, plumbing and concrete rules as data The engine of the plan in docs/building-code-plan.md, steps 1 and 3: - codes.rs: a code is an entry of one discipline (architectural, structural, electrical, mechanical, plumbing) with sections of rules as data, each rule with its source and kind. A project picks a base for each discipline, amendments over it (an amendment may amend another: base, issuer, member), and changes any rule; the rules in force are resolved layer by layer, kept per revision of the codes, and a section none of the layers has comes from BIMCraft's library and says so. - From discussion #487: a project pins the editions it chose, and a newer one in the library changes nothing until the code is chosen again (editions_gone says so); sources cite a document of the code's own list by id, with item and page. - Data: data/codes/<discipline>/<code>.json, one file a code, listed in codes/data.rs; #386's building-codes.json split into the architectural codes. Region presets in data/codes/presets.json. - Model::codes replaces #386's building_code, stair_rules and building_codes, which a file is still read with (migrate). - Commands: building_code takes a discipline, amendments and rules by section (#386's params still work); building_code_export and _import write and read XML format 2, one discipline or all five, and still read format 1; new code_rules, site_climate and code_check. - Plumbing rewired, numbers unchanged: the fixtures library, cold water, reservation, sanitary drainage and vents, storm drainage (the abacuses as data, the rain from the project's Site and Climate) and hydrants (CBPMESP IT 22 as an amendment). Structural: NBR 6118's bar limits as the Concrete section, which reinforce {check} reads. - The electrical modules are left for their authors to move (E1 to E9, discussion #487).
…s, the rule enforced - codes/checks.rs: the Ramps, Doors and Rooms sections and their checks (slope by a run's rise, run rise, widths, landings; clear width and height, widest leaf, exempt types; area, narrower side and height by the kind a room's name says), in code_check and the element's JSON, timed on the highrise. A new ramp starts with the code's slope and width. - Data: NBR 9050's ramps and doors, the IBC's ramps, doors, rooms, egress and accessibility, the Eurocodes' loads and ASHRAE 62.1's ventilation, all unchecked and saying so; region presets. - Manage > Building Codes: an Overview (region presets, a card for each discipline, Site and Climate) and a tab for each discipline: its code, amendment chips, Import, Export, Save As, Delete, Reset Tab, the sections with search, the rules grid with From and Source, a table editor with copy and paste, and the rule card. The code check window covers ramps, doors and rooms. - The rule: "No code values in code" in CLAUDE.md, enforced by code_values_live_in_codes; the electrical modules are named as moving (E1 to E9, discussion #487). - Docs: docs/areas/building-codes.md rewritten, the plan's status, README.
|
Two
Happy to send either as a small commit if that helps. |
…al codes, rooms' natural light
- Amendments go in the order chosen (dragged in the dialog), the last winning; each stands over the base or any other
amendment chosen. `building_code {amend}` puts rule changes and resets into that amendment instead of the project's
changes; one of BIMCraft's becomes the project's copy under its name. `create` (and `over`) makes an empty one.
- A section only amendments hold, and that is not whole alone, is the library's under what they change.
- Electrical: NBR 5410 holds `rcd`, `bath_volumes` and `load_points`; each utility's building demand and service
categories are its amendment over it (Celesc, Cemig, Fecoergs, Hidropan, Energisa, Equatorial, Copel), and Spain's,
Portugal's, France's and the NEC's methods are codes of their own. The commands read the project's, as changed.
The old data files are gone; the Brasil and USA presets pick NBR 5410 and the NEC.
- Rooms: a kind's natural light (`light_min`, window area over floor area; the IBC's 8 %), checked from the windows in
the walls round the room.
- Dialog: the kinds of room as rows (kind, room names, least area, width, height, natural light); amendments as a list
ticked, dragged, made new, with the one changes go into; the region preset says the region picked; the Electrical
tab holds the Electrical Settings, which the ribbon button opens; plain English throughout.
|
@ffishman I would like you to clone this branch and commit any changes you wish to have. I put down the foundation and the basic idea on how i think it should work and look like but you know the structure of standards better than me. Let me know if you need anything |
…de; rules shown as forms and tables - NBR 5410's circuit sizing, conduit fill and surge protection are its `circuits`, `conduit_fill` and `surge` sections; CPFL's, Enel's and Celesc's unit demand and supply are `unit_demand`, each an amendment over NBR 5410. The numbers were copied from the Rust tables by script; the modules keep the methods, and the commands read the project's code. - Voltages, distribution systems and wire types are sections of the electrical code: a code chosen brings its own, and what the project changes goes into the code, or into the amendment the dialog saves to. - Manage > Building Codes shows a rule that is more than a number as a form, a table with named columns, or cards; a section's own words (standard, source, notes) are no longer rules, and long text wraps.
|
Thanks, @dansity, that works well for me. I'll check the copied electrical tables against the old Rust ones by running both side by side (every lookup, not by reading), then XML round trips and edits through an amendment, and send what I find as one small PR into Could you leave the electrical files ( |
|
A quick heads-up, @dansity: while checking 3d4e4ca I came across a few things in how amendments and the new Electrical Settings behave across save/import, removing an amendment and deleting entries. I'm reproducing them now, by running them rather than reading, and will post a short list with an example for each within the hour. The copied table values look right so far. Would you mind holding off on the amendment and Electrical Settings code too ( |
|
Hi @ffishman
This was done by the agent before your comment. My suggestion is just fix up this PR as good as possible and push it in one go. The numbers were copied from the Rust tables by script and your tests still pin them. It would help a lot if you could review the data files in crates/core/data/codes/electrical/, since you know these documents better than anyone. From your list, edition pins, amendment-on-amendment and sources cited by id with item and page are already in. adopts, change kind, region, copy_of and the municipality → utility picker aren't yet. They feel like the next PR on top of #486 rather than more scope in it. Would you be up for proposing the schema for those, starting with the RS and SC cooperatives, as a PR into feat/building-code or after it lands? |
|
Thanks, @dansity, no worries, and thanks for the kind words. To be honest, it's been a long night: I redid this slice three times as the base moved under it, so one small ask going forward: a short note on #487 before an agent takes on a slice someone has claimed, and I'll do the same. That alone would have saved most of it. Plan: one PR into |
|
As promised, @dansity, here is what I found on 3d4e4ca, everything reproduced by running it. The copied numbers are exact. I built 6809093 and 3d4e4ca side by side and compared 757k command calls ( What goes wrong is in using the data across operations. A property test (5,000 random sequences of
My PR into |
|
@ffishman i prefer if you fix everything up to your standard. later i will do my best to use the same values for other building codes (din, iso etc) |
|
@dansity, the first PR is up: #502, into On "the same values for other codes": the same method, I'd say: each code's numbers from its own text, with table and page, pinned by a digest and checked against that standard's own examples, rather than carried over from another code. A property test over any code comes with the next PR. |
…tables changed in its amendment Fixes 1 to 3 of the list in #486. - A rule that is text but reads like a number (circuits.default_method, "7") is written as JSON, so NBR 5410 and anything on it imports again. known() takes the rules of every library code holding a section, and the electrical settings are named by the user, so any name comes back. A utility's or a country's method is imported as the file has it, never completed from another utility's. - unit_demand, building_demand and entrance are a utility's method whole (codes::WHOLE): an amendment holding one replaces the one under it instead of being merged rule by rule. demand, building_demand and entrance read each chosen amendment's own section (Model::held_wholes), so a change in CPFL's amendment counts wherever it stands and CPFL never answers by Celesc's table. - A project-level change to one of those sections is refused, pointing at `amend`: it would belong to no utility once another is chosen. - A collapsible `if` in the circuit's breaker, for clippy. Tests: six new, each seen failing on 3d4e4ca and passing here.
…lectrical settings in step with the codes Fixes 4 to 6 of the list in #486, and the two ui-egui tests failing on 3d4e4ca. - A code of the project's own holding a utility's or a country's method can't be deleted while the project is held to it; other codes keep their rules as before. - `set` naming the base in force (the default included) keeps the amendments and their changes. - from_codes follows the codes: null takes an entry away, one no longer named goes back to the starter's or away, unless an element names it. A starter entry taken away is written as null; renaming a voltage renames it in the code's systems; a system naming a voltage the project wouldn't have, or a null over a setting an element names, is refused. `amend` takes a setting away whoever had it. - An amendment's few settings are laid over the library's others. - The codes dialog flattens objects inside rows to any depth; a new voltage's band follows its nominal while still the default. - The property test of #486 goes in as crates/core/tests/property.rs (200 sequences under cargo test).
…its as its Tabela 4 prints it (ffishman) The head of #511 carries the whole chain under it: dansity's five-discipline Building Codes engine (#486) and ffishman's #502, #506 and #509 on top of it, then the Hidropan rows. Joined onto main, the sections engine replaces main's building-codes.json and its electrical part, since a utility is now an amendment and a country a base code of the electrical discipline: main's `electrical`, `country` and `Model::electrical_methods` are gone, `building_code {electrical}` is refused with a message saying where the methods went, and `demand` takes the project's utility when none is named, as `building_demand` already did. Main's stair fixes (solve capped at 200 risers, the IBC numbers marked unchecked, the test module the hostile sweep reads) and #484's per-member tables (`members`, Energisa's Tabela 16, its test) are carried onto the new files. EN 1992-1-1 stays a second standard of `reinforce {check}` beside the structural code's Concrete section. FORMAT 21's note and the 20 to 21 comment in `migrate` describe `codes`. The catalogs are the union of both sides, for the round's one regeneration.
…dards, Hidropan's diversity (dansity, ffishman) Joins the codes-chain branch. #511's head holds #486's engine (five disciplines, layered codes and amendments, 29 code files under data/codes/, the dialog's five tabs) and ffishman's fixes on top (XML round trips, a held code's method on the base in force, the electrical numbers checked against their standards, Hidropan's diversity factor for 2 to 9 units). The engine replaces the electrical part of yesterday's codes (electrical_methods, the Electrical Demand tab): the same methods now come through an amendment or a base code, and `demand` and `building_demand` default to the code the project is held to. No conflict with the other joins of the round in code; the root CLAUDE.md is trimmed under its 3,000 words, and the catalogs are regenerated on CI after this merge.
cargo i18n update on CI over the whole third round, with #486's codes dialog and the engine's messages: the .pot files are what the extractor makes, each .po keeps its translations, line references renewed.
The file-marking test reads a command's documented keys, and IPedrax#486's building_code lists save?: name (the name its rules in force are kept under, as an own code of the project's). Like a stair's path, it is not a file.
Draft, stacked on #386. The branch starts from #386's head, because the Building Code engine and the dialog started there. Merge #386 first; this PR then shows only its own work.
The new rule: no code values in code
A number that a standard, a utility, a fire brigade or a common practice gives is a rule of a building code. It lives in
crates/core/data/codes/with its source, and the project can change it. Rust holds the method, never the number. Physical constants and safety caps stay in Rust.The rule is in
CLAUDE.md.code_values_live_in_codes(codes/rule_tests.rs) fails on a numeric constant in a module that reads a code.What is in
Merged into the branch:
main;Only the module map, the electrical area paragraphs and the translation catalogues conflicted, and both sides were kept. If any of them lands on
mainfirst, its merge here is a no-op.The engine (
codes.rs,codes/):building_code {amend}saves rule changes and resets into that amendment, not into the project's own changes. Editing one of BIMCraft's amendments makes a project copy under the same name; resetting the whole copy brings back the library's. A rule set to null is removed from the amendment.create(withover) makes a new, empty amendment for the project.editions_gonesays so;Model::codesreplaces Stairs: an advanced stair tool #386's three fields, and a Stairs: an advanced stair tool #386 file is still read into it. NoFORMATbump: an older build leaves the field out and lists it.building_codeworks by discipline, and Stairs: an advanced stair tool #386's parameters still work.building_code_exportand_importuse XML format 2, for one discipline or all five, and still read format 1.code_rules(every rule in force, with layer, source and kind),site_climate(the project's map values) andcode_check.Rewired, numbers unchanged (the modules' existing tests pin them):
reinforce {check};demand) are each an amendment over NBR 5410;circuit,conduit_fill,dps_check,load_points,dr_check,bath_volumes,building_demandanddemandread the project's code, including what the project or an amendment changed. Astandardorutilitythat is named still reads BIMCraft's.New checks, fast and local, and timed on the 20-storey sample tower:
They show in
code_check, in Properties, and in the Building Code Check window.Manage > Building Codes:
BIMCRAFT_CODES_DUMPrenders it.Data:
Every new number is marked unchecked, with the item it is from.
Translations: Portuguese and Spanish for the dialog's new words.
Not in this PR
Checks
At
3d4e4ca7:cargo fmt --checkandcargo i18n checkpass on the author's machine, and the app builds. Clippy and the test suite were not run locally (the machine ran short of memory); CI runs them. The previous commit,68090934, passed all four locally.