Part V. Commands
A command is a typed, validated change to a model. Commands are how a host changes a model on behalf of a person or an agent: each is checked before anything changes, applied all or nothing, and answered with what it touched. Hand edits of files are also allowed (Part III, section 14); they are checked when the folder is read.
1. The command
- A command is a JSON object whose
kindnames it; its other members are fixed by its kind. - A command processor MUST refuse a command whose
kindit does not implement, and a command that does not match its kind's schema, naming the member that is wrong. - The records a command carries (an element in
create, a type intype.upsert, a view inview.upsert) and an element'spatchMUST match their schemas. A member the schemas do not know MUST be kept in the record it is written to (Part I, section 10); the processor SHOULD warn, naming it, since it is often a misspelling. An extension member (Part I, 11.2) is no misspelling, and needs no warning. But a processor MUST refuse a command that would write an extension member whose value isnullinto a record that did not hold it, naming the record and the member (Part I, 11.2, rule 3): in a record a command writes whole (createand the upserts) and in the value a patch gives a member,nullis a value, and only a member of the patch itself takes a member away withnull(4.2). One that the record held, and that the command carries back as it was read, is kept (Part I, 10, rule 1). - A member a command's kind does not define at the top level of the command (for example a misspelt
expectedRevison) MUST NOT be dropped silently: the processor SHOULD refuse the command or warn. - A processor MUST NOT create an element or a type of a category it does not know, and MUST keep those a model holds, through every command that does not delete them (Part I, 10, rule 5). A processor of 0.2 knows the categories 0.2 adds, in every model of 0.2: Part XIII's
electrical,cableCarrierandcable, Part II, 6.2.1'smember, and Part II, 6.10'sprovision. It makes and changes records of them by the rules of the part that adds them: it holds each to that part's schema, refuses what those rules refuse where it refuses the like of a category of 0.1 (a host of another category, a level that is not there, a size the type sets: section 6, stage 2), and checks the whole model by them (stage 3). In a model of 0.1, read by 0.1's rules (Part I, 9.6, rule 3), they are a later version's categories, which it does not know, unless it is asked for the proposal of 0.1 that adds them.
Reference: commandSchema in src/core/model/model.ts (a union of 91 kinds keyed by kind).
2. The command set
The reference vocabulary has 91 kinds. They fall into core record operations, which every command processor MUST implement for the core records, and domain operations, which a processor MAY implement as a vocabulary profile.
2.1 Core record operations
| Kind | Does | Precondition |
|---|---|---|
create | adds an element; its id MUST be new | expectedHostRevision (optional) |
update | patches an element (section 4) | expectedRevision |
delete | removes an element and what depends on it (section 5) | expectedRevision |
type.upsert | writes a type whole | expectedRevision (optional) |
type.delete | removes a type no element uses | expectedRevision |
type.duplicate | copies a type under a new id and name, optionally assigning it to one element | expectedSourceRevision |
level.upsert | adds or changes a level; a new level gets its own plan unless plan: false | expectedLevel (optional) |
level.delete | removes a level with its plans; refused while anything stands on it unless moveTo names a level | expectedLevel |
material.upsert | writes a material | expectedRevision (optional) |
grid.upsert | writes a grid line | expectedRevision (required when the grid exists) |
project.rename, project.elevationOffset, project.site, project.envelope, rooms.settings, project.information | change the project record | expectedName, expectedOffset, expectedSite, expectedEnvelope, expectedSettings, expectedInformation |
project.excavation, project.precast, project.standards | set or clear a project rule | none |
original.make, original.add, original.remove, original.rename, original.dissolve, original.frame, original.edit, copy.place, copy.move, copy.remove, copy.unique | groups placed many times | expectedRevision on most |
2.1.1 Commands that write an instance's elements out
Part of 0.5, with Part IV, 13. OpenEik 0.4 had it as the proposal copies (open questions, 136): a model of 0.4, read by 0.4's rules (Part I, 9.6, rule 3), is processed by it only where a caller asks for it (decision D12).
A command processor runs the commands of groups that write an instance's elements out, as the reference implementation runs them; one of a model of 0.4 that does not apply the proposal MAY refuse them (copies-not-derived, Part XVII, 10.4), since 0.4 does not say what an instance's elements are. Each writes an instance's elements as Part IV, 13 derives them, and no others.
- Which.
original.frameto an instance that is not the kept one,original.editat one,copy.moveof the kept instance,copy.removeof the kept instance while its group has another, andcopy.uniqueof an instance while its group has another. The other commands of groups write no instance's elements, and run as 2.1 has them. original.frameto the instancet: the group's kept elements go, andt's elements, as Part IV, 13 derives them, lesscopy, are the kept ones, each under its id intand at its revision. The group'sorigin,turnedandliftedbecomet'sat,turnandlift,turnedandliftedleft out at 0, and itsframet, left out wheretis the first instance. Where the first instance was the kept one, it gets a record of its own:{id, of, at, turn, lift, revision}, itsidandofthe group's, itsat,turnandliftthe group'sorigin,turnedandlifted, each 0 where absent, and itsrevision0.t's record goes wheretis the first instance, and else loses itslevelId; and wheretnamed a level other than the group's base level (Part IV, 13, rule 2), each other instance of the group that names no level is given the base level, so that it stays where it stood. Nothing moves, and no revision changes, the group's among them. Wheretderives fewer elements than the group keeps (Part II, 10.1, rules 2 and 4), the processor refuses the command (copies-not-derived).original.editat an instance that is not the kept one: firstoriginal.frameto it, as rule 2 says; then the edit's commands, which name the group's elements by their ids there.copy.moveof the kept instance. The kept elements move as Part IV, 13, rules 1 to 5 move an instance's, from where the group stands to where the command puts it, itsat,turnandliftwhere it gives them and else the group's, and on the level it names; each keeps its id and what it names, at its revision plus one. The group'sorigin,turnedandliftedbecome that place, at its revision plus one, and the kept instance's record, where it has one, gets thatat,turnandlift, at its revision plus one. Where the command names a level other than the group's base level, each other instance that names no level is given the base level. No other instance moves.copy.removeof the kept instance while its group has others: firstoriginal.frameto the first of the others, its first instance where that has a record, else its copy whose id comes first as people count marks (runs of digits compared as numbers,H2beforeH10); then the instance goes, as a copy does.copy.uniqueof an instance while its group has others: a kept instance first steps aside, as rule 5 says; then its elements, as Part IV, 13 derives them, are stored elements of no group, lesscopy,originalandborn, each under its id in the instance and at its revision plus one, so that what named them still names them; and its record goes. The last instance made unique ends its group, as without the proposal.
Reference: reframe and applyCopyCommand in src/core/model/copyCommands.ts; movedKept and editCommands in src/core/model/copies.ts; instancesOf and byMark in src/core/model/groups.ts. In @openeik/tools: applyCommands(model, commands) on a model of 0.5, and with {proposals: ["copies"]} on a model of 0.4.
2.2 Documentation profile
| Kind | Does | Precondition |
|---|---|---|
view.upsert | writes a view whole | expectedRevision (optional) |
view.update | changes a view's settings by name; display merges into the view's own | expectedRevision |
view.delete | removes a view; refused while a sheet, a dependent view, a callout or a report uses it | expectedRevision |
view.camera | sets a 3D view's camera for a sheet | expectedRevision |
detail.place, detail.update, detail.remove, detail.draw | place, change, remove or draw one 2D item of a view | expectedRevision (the view's) |
scopeBox.upsert, dimensionStyle.upsert, detailFamily.upsert | write those records | expectedRevision (required when the record exists) |
Part XIV, 17.1 moves sheet.upsert and sheet.delete into this profile, adds person.upsert, and has the detail commands carry provenance; their members, the detail commands' among them, are given from 0.5 by Part XIV, 17.1.1 and 17.1.2, by this part's rules. The members and the rules of the profile's other kinds, view.update, view.delete, view.camera and the three upserts, are given from 0.5 by section 2.3.1.
2.3 Domain operations (the reference vocabulary)
| Group | Kinds |
|---|---|
| Transforms | move, rotate, mirror, offset, array, radialArray, align, split, trim, sketch.edit |
| Walls, columns and outlines | wall.join, wall.attach, wall.detach, wall.flip, column.attach, column.detach, edge.attach |
| Timber framing and trusses | framing.rule.upsert, floor.framing.upsert, framing.materialise, framing.update, framing.detach, trusses.layout.upsert, trusses.plan, trusses.materialise, trusses.update, trusses.detach |
| Systems | mep.fall, mep.downpipe |
| Reinforcement | rebar.quick, mesh.lay |
| Fabrication | piece.upsert, piece.delete, joint.upsert, joint.delete |
| Application records | sheet.upsert, sheet.delete, titleBlock.upsert, titleBlock.delete, image.upsert, image.delete, render.upsert, render.delete, report.upsert, report.delete, deviation.upsert, deviation.delete, areaAdjustment.upsert, areaAdjustment.delete, reference.upsert, reference.delete |
Part XIX, from 0.5, adds seven kinds that change the ground, ground.levels and the upserts and deletes of a profile, a pit and a load on the ground (its section 8), by this part's rules.
Part XX, from 0.5, adds one kind, piece.adopt, which writes a piece of an element's layout as an element of its own (its section 9), by this part's rules.
A domain operation is defined by the records it produces: it MUST leave the model exactly as some sequence of core record operations would. Several are written that way in the reference: framing.rule.upsert and floor.framing.upsert become a type.upsert, trusses.layout.upsert and mep.fall an update, trusses.plan a view.upsert, mesh.lay a create, rebar.quick a batch of creates, view.update and detail.draw a view.upsert. Section 2.3.1, of 0.5, says for each kind it defines which core record operations it is.
Reference: run in src/core/model/store.ts.
2.3.1 Domain operations defined
Part of 0.5. OpenEik 0.4 had it as the proposal domainCommands (open questions, 139): a model of 0.4, read by 0.4's rules (Part I, 9.6, rule 3), is processed by it only where a caller asks for it (decision D12).
Section 2.3 names the domain operations and says what one is, and section 2.2 names the documentation profile's kinds; neither says which members a kind has, nor which records it writes. This section says both for the kinds below, each written from the reference implementation's command, so that two processors make the same records of the same command. A command processor runs them, as one of a model of 0.4 that applies the proposal does; one of 0.4 without it MAY refuse them (kind-not-implemented). Their schemas are in schemas/0.5/commands/, each closed (section 1, rule 4) and listed with its precondition in schemas/0.5/commands/index.json.
| Kind | Members | Precondition | Run as | Written from the reference's |
|---|---|---|---|---|
view.update | id, patch | expectedRevision | a view.upsert | patchedView |
view.delete | id | expectedRevision | the view removed | viewDeleteRefusal, viewUsers |
view.camera | id, corner or position and target, fit, margin | expectedRevision | a view.upsert | viewWithCamera, fitAxonometricCrop |
scopeBox.upsert, dimensionStyle.upsert, detailFamily.upsert | scopeBox, style, family | expectedRevision, strict | the record written | their branches of run |
move | id, delta | expectedRevision | updates | translateElement |
rotate, radialArray | id, centre, degrees, copyId or copyIds | expectedRevision | updates and creates | transformElements, turnElement |
mirror | id, axis, copyId | expectedRevision | updates and creates | transformElements |
offset | id, distance, copyId | expectedRevision | updates and creates | transformElements |
array | id, delta, copyIds | expectedRevision | creates | transformElements |
split | id, distance, gap, newId | expectedRevision | updates and a create | editLinearElements, splitEdges, splitInserts |
trim | id, boundaryId, end | expectedRevision, expectedBoundaryRevision | updates | editLinearElements, trimmedInserts |
sketch.edit | id, operation | expectedRevision | an update | applySketchTool |
wall.join | id, otherId, allow | expectedRevision, expectedOtherRevision | updates | its branch of run, wallEndPair, teeHost, joinPartner |
wall.flip | id | expectedRevision | updates and view.upserts | its branch of run, flippedEdges, flippedInsert, flippedBars |
wall.attach, wall.detach | id; hostId, face, offset, mode | expectedRevision; expectedHostRevision | an update | their branch of run |
column.attach, column.detach | id; hostId, face, offset | expectedRevision; expectedHostRevision | an update | their branch of run |
edge.attach | id, edgeId, hostId, face | expectedRevision; expectedHostRevision | an update | its branch of run |
framing.rule.upsert | typeId, layerId, rule, setStructure | expectedRevision | a type.upsert | framingRuleAsTypeUpsert |
floor.framing.upsert | typeId, layerId, rule | expectedRevision | a type.upsert | floorFramingAsTypeUpsert |
framing.detach, trusses.detach | wallId or roofId, deleteMembers | expectedRevision | updates or deletes | their branches of run |
mep.fall | id, fall, toward | expectedRevision | an update | its branch of run, heightsForFall |
piece.upsert, joint.upsert | piece, joint | expectedRevision (optional) | the record written | their branches of run |
piece.delete, joint.delete | id | expectedRevision (optional) | the record removed | their branches of run |
titleBlock.upsert, render.upsert, report.upsert, deviation.upsert, areaAdjustment.upsert | family, render, report, deviation, adjustment | expectedRevision (optional) | the record written | their branches of run |
titleBlock.delete, render.delete, report.delete, deviation.delete, areaAdjustment.delete | id | expectedRevision (required for a title block, else optional) | the record removed | their branches of run |
image.upsert, image.delete | image, or id | expectedHash (optional) | the record written or removed | their branches of run |
reference.upsert, reference.delete | reference, or id | expectedRevision (strict; required) | the record written or removed | their branches of run |
framing.materialise, framing.update | wallId | expectedRevision | type.upserts, deletes, updates and creates | materialisedElements, memberElement, memberType |
trusses.materialise, trusses.update | roofId | expectedRevision | type.upserts, deletes, updates and creates | trussElement, trussTypeOf |
trusses.layout.upsert | roofId, layout | expectedRevision | an update | its branch of run |
align | reference, moving | expectedRevision, expectedReferenceRevision | an update | facesFor, alignmentDelta |
trusses.plan | roofId, id | expectedRevision (optional) | a view.upsert | trussPlanView |
mesh.lay | hostId, designation, face, layer, cover, lap, grade, mark, id | expectedHostRevision (optional) | a create | meshOn |
mep.downpipe | gutterId, typeId, size, end, levelId, foot, kickOut, id | expectedHostRevision (optional) | a create | downpipeFor, facadeUnder |
Run as core record operations. A kind run as core record operations runs them in order, each as a command of its own kind inside it: each sees the model as the ones before it left it and is checked by its own kind's rules (section 6, stage 2), and the records they write and touch are the operation's, in its answer's
affectedtoo (section 9). An element the operation works out is written by anupdatewhose patch holds each member whose value changes andnullfor each it takes away, where its revision or one of its members differs from the stored element; by acreatewhere it is new; and not at all where it is as it was. A view it changes is written by aview.upsertat its revision. Its answer'sresultis{as: [{kind, result}, …]}: the core operations' kinds and results, in order. A core operation's refusal refuses the command with its code, its message naming the core operation (as its update of "wall-a": …). What follows an element that changes, a railing on an outline among it (Part II, 12.2, rule 4), follows it as it follows anupdate; and a bar set anchored to a wall the operation changes or makes (Part II, 6.1.1, rule 4), whose anchor is no longer the wall's frame or whose level is not the wall's, is carried to the frame by anupdateof its own, after the operation's elements: turned about the vertical from the anchor's direction to the wall's, then moved from the anchor's point to the wall's start at its base, its origin, itsxAxis, itsyAxisand itsalongeach to a millionth of a millimetre, itsanchorthe wall's frame, itslevelIdthe wall's and itsprofileits origin's point. An element of a group is changed in the group's edit alone (Part II, 10), as by anupdate.view.update. The viewidnames, atexpectedRevision, takes each member ofpatchin place of its own, andnulltakes one away;displaymerges into the view's own display member by member,nulltaking one away, and a view that has none starts from{style: "shaded", shadows: true, sunPath: false}where its kind is3dand from{style: "hiddenLine", shadows: true, sunPath: false}else. A patch that writesid,kind,revisionordetailsis refused (patch-fixed): a view's 2D items change by the detail commands (Part XIV, 17.1). A patch that says undefined for a member the view or its display has is refused (patch-undefined, section 4, rule 3). It is run as aview.upsertof the view so patched at its revision; a view the patch leaves invalid is refused there (command-schema), named in the patch.view.delete. The viewidnames, atexpectedRevision, is removed with its own 2D items. It is refused while something uses it (section 5, rule 4;in-use, the users named): a sheet that places it in a viewport, under its scale bar (scaleBar.viewId) or in a key plan (keyPlans[].viewId); a view that depends on it (dependentOn); a callout of it (parentViewId); an item of another view whoseviewReference.viewIdnames it; a report one of whose blocks of the kindfigurenames it (viewId). No core record operation removes a view: this one is the profile's own.view.camera. The viewidnames, atexpectedRevision, is a 3D view (elsecommand-schema). Its camera is given bycorner, or bypositionandtarget, one of the two (command-schema).cornerSW,SE,NEorNW:directionis (s_x·√½, s_y·√½), s_x −1 forSWandNWand +1 else, s_y −1 forSWandSEand +1 else, andaxonometricElevationthe true isometric's, atan(1/√2) in degrees;top:direction(0, −1) and the elevation 90.originstays.positionandtarget, [x, y, z] mm: with d = position − target and f = √(d_x² + d_y²), they lie 1 mm apart or more, and the position is not below the target, d_z ≥ −10⁻⁶ (elsecommand-schema). The elevation e is atan2(max(d_z, 0), f) in degrees;directionis (d_x, d_y)/f, or (0, −1) where f < 10⁻⁶; andoriginis the target's x and y lessdirectiontimes target_z · cos e / sin e where sin e > 0.05, the target's x and y else: where the line of sight through the target meets z 0.originis written to the millimetre,directionto six decimals andaxonometricElevationto three, each as a decimal number reads them, and never −0. It is run as aview.upsertof the view so changed, at its revision, itscropas it was.- With
fitother thanfalse, the left out among it, the crop is fitted round what the view shows. The view shows each element of the model but those itshiddenElementIdsname, those of a category itshiddenCategoriesnames, and those of a discipline its display'shiddenDisciplinesnames,architectural,structural,systemsandsitebeing the foldersarchitecture,structure,systemsandsiteof Part III, 4.1. Each such element's box is the least and greatest x, y and z of its bodies as Part IV derives them, within 0.1 mm (Part IV, 10); an element with no body has none. Each box's eight corners are seen by the view's camera: with e itsaxonometricElevation, (d_x, d_y) itsdirectionmade a unit vector and o itsoriginat z 0, a corner p lies u = (p − o)·(−d_y, d_x, 0) across and v = (p − o)·(−d_x sin e, −d_y sin e, cos e) up. The crop is [u_min − g, u_max + g, v_min − g, v_max + g], g themargin(500 mm where it is left out), each rounded out to 10 mm, the least down and the greatest up. A view that shows no element with a box keeps its crop.
The strict upserts.
scopeBox.upsert,dimensionStyle.upsertanddetailFamily.upsertwritescopeBox,styleorfamilywhole, held toproject/scope-box.schema.json,project/dimension-style.schema.jsonandproject/detail-family.schema.json, intoscopeBoxes,dimensionStylesordetailFamilies: one that is there in its place at its revision plus one, a new one at the end of the list at revision 0. Their precondition is strict (section 3, rule 2): a record that exists is refused withoutexpectedRevision(precondition-missing) and with another revision (revision-conflict), and a new one with one (precondition-target); in an envelope a new one saysnull(Part XVII, 9.1). What a record names is the whole model's to check (section 6, stage 3).move. The elementidnames, atexpectedRevision, moves bydelta, [d_x, d_y, d_z] mm, at its revision plus one:- One with no host: the points of its
profile, of a terrain'spoints(their heights stay), of each recess'sprofileor its frame'sorigin(its height stays), of itsvoids, of a slab'sjoints(aandb) and a roof's windows'centermove by (d_x, d_y); its declared geometry moves with it (Part II, 12.1, rule 6), but for one in thelineframe, which needs nothing; and itsoffsetrises by d_z. - A door or a window moves along its wall's line or up it. With its wall's u and n (Part IV, 3), the move's part across the wall, d_x·n_x + d_y·n_y, is within 0.01 mm of 0, else it is refused (
command-schema);alonggains d_x·u_x + d_y·u_y, from 0 where it gives none,offsetgains d_z, and its declared geometry moves by (d_x, d_y). - Another hosted element follows its host, and is refused (
command-schema).
It is run as an
updateof the element.- One with no host: the points of its
Transforms.
rotate,radialArray,mirror,offsetandarraychange the elementidnames, atexpectedRevision, or copy it.- Copies. With
copyId(rotate,mirror,offset) the element stays as it is, and one copy is made;radialArrayandarraymake one copy for each id ofcopyIds, the k-th, counted from 1, turned k times bydegreesor moved k times bydelta. An id given twice, or one the model holds, is refused (id-duplicate). A copy is the element as the rules below change it, under its id, named with " — Copy" after the element's name, at revision 0: its top lets go of its host (top.attachgoes; its constraint and its cut stay); an attached base goes,basewhole; and of its edge attachments it keeps, in their order, each that Part II, 6.7's rules 1 to 5 still hold for where it lands, with those kept before it, and has noedgeAttachmentswhere none holds. Each element it hosts (hostId) is copied with it, as the rules below leave it, under<copy id>:<its id>, hosted by the copy, at revision 0. rotateandradialArray. The turn is θ =degrees, anticlockwise aboutcentre: a point p goes to centre + R(θ)(p − centre). A hosted element is refused (turn its host), and so is one that hosts a mesh or a rebar element that does not go with it by itself (command-schema): one goes with it where it is a mesh laid over a floor's seams (sheet.faceseams), or where the element is a wall and it is a mesh in its layer (sheet) or a bar set anchored to it (bars.anchor). The element turns as an instance's element turns (Part IV, 13, rule 4): its outline, its declared geometry, a terrain's points, its voids, a slab's joints, a roof's windows' centres, a grading's fall's direction (a unit vector), its panels' direction (degrees from +x in [0, 360), to a millionth), a provision's axis and up; each recess's outline, or its frame, its origin a point and its u, v and w the images of origin plus each less the image of origin, their heights kept; a component's own axes x and y, each the image of the vector less the image of the origin, its z kept; and a column'sturnbecomes its turn plus θ, in (−180, 180] to a millionth, left out where 0. Its revision goes up by one; what it hosts stays as it is.mirror. The mirror is the line throughaxis's two points, 0.001 mm apart or more (command-schema); a point goes to its reflection in the line. A column is mirrored about a line along x or along y alone, |d_x·d_y| ≤ 0.001 for the axis's d (command-schema), and an element that hosts a slab edge element, a mesh or a rebar element that does not go with it by itself (rule 7.2) is refused (command-schema). A door or a window moves along its wall to where the mirror takes its middle, as rule 6.2 moves it, and itshandFlippedturns where the mirror takes a step along the wall's u to one against it; another hosted element is refused (command-schema). One with no host, at its revision plus one:- its outline, a terrain's points, its voids, a slab's joints, a roof's windows' centres, each recess, a component's axes, its panels' direction and a grading's fall's direction are mirrored, as rule 7.2 turns them;
- its declared geometry is mirrored and turned over: a prism's outline runs the other way, each face of a polyhedron and of a mesh runs the other way, and a load's moment is mirrored and its sign changed;
- a column's
turnbecomes 2α − turn, α the axis's angle from +x in degrees, written as rule 7.2 writes it; a beam'srollchanges its sign; a component'sflippedturns; - a stair's
turnbecomesleftwhere it wasrightandrightelse, itslocationLineswapsleftandright, and each railing it hosts swaps itsrailing.side; - a wall's baseline runs the other way: after the mirror its two points are swapped, its
wallOutline's x become L − x, L its length, itsjoinEndsswap, and its edge details are flipped as rule 11.1 flips them. Of what it hosts, a bar set anchored to it is reflected, its origin a point and its axes andalongdirections, x and y to a millionth, and anchored to the wall as the mirror leaves it; a cast-in item getsalong= L less the greatest along of its items, to a tenth of a millimetre, itsface, its path and itstiltas rule 11.2 turns them, at its revision plus one; a mesh in its layer stays; and every other element it hosts getsalong= L − along − width and itshandFlippedturned, at its revision plus one.
offset. A wall or a beam (elsecommand-schema) moves bydistancealong its left normal n (Part IV, 3), as rule 6 moves it.array. The stepdeltais 0.001 mm long or more (command-schema); the k-th copy is the element moved by k·delta, as rule 6 moves it.- It is run as an
updateof each element it changes and acreateof each copy, the element first and then what it hosts, copy by copy.
- Copies. With
splitandtrim. The elementidnames, atexpectedRevision, is a wall or a beam of two profile points, with nowallOutlineand of a type withoutframing(elsecommand-schema). Let a and b be its points, L its length, u its direction, and r itsendRise, or 0.splitatdistance, withgap(0 where it is left out): the first part ends at l = distance − gap/2 and the second starts at r₂ = distance + gap/2, each 1 mm or more from its end (command-schema);newIdis new (id-duplicate); and an element it hosts that is no cast-in item and lies across them (along < r₂ and along + width > l) refuses it (command-schema). The element keeps [a, a + u·l] at its revision plus one, itsendRiser·l/L where it gives one; the second part is the element undernewId, its name with " - Split" after it, [a + u·r₂, b], itsoffsetraised by r·r₂/L, itsendRiser·(L − r₂)/L, at revision 0. Its edge details are shared out:start's stay on the first part,end's go to the second, atop's or abottom's span [from, to], 0 and L where left out, is cut to [from, min(to, l)] on the first where from < l and to [max(from, r₂) − r₂, to − r₂] on the second where to > r₂, and an opening's go with the opening; a part left with none has noedges. Each element it hosts at along ≥ r₂ moves to the second part, itsalongless r₂, at its revision plus one. A cast-in item goes with the part its whole reach lies on, within 0.5 mm (its row's items, or its conduit's way), on the second withalongand its path's alongs less r₂, to a tenth of a millimetre, and one across the split refuses it (command-schema).trimto the line ofboundaryId, another straight wall or beam, atexpectedBoundaryRevision(elsecommand-schema), not parallel to the element (|u × v| ≥ 10⁻⁷ for its direction v, elsecommand-schema): the lines meet at t along the element from a.end0 trims its start: the element becomes [a + u·t, b], itsoffsetraised by r·t/L, itsendRiser·(L − t)/L, and each element it hosts that is no cast-in item has itsalongless t, at its revision plus one;end1 trims its end: [a, a + u·t], itsendRiser·t/L. A t over L − 1 at the start, or under 1 at the end, refuses it (command-schema). A cast-in item stays where it is: each place of its reach, less how far the start moved, lies on the trimmed wall within 0.5 mm, else the trim is refused, but in a replay, which leaves the item as it was (section 8, rule 4); one with its ownalongor a path, where the start moved, has them less that, to a tenth of a millimetre, at its revision plus one.
It is run as an
updateof the element, acreateof the second part, and anupdateof each element it hosts that it changes.sketch.edit. The elementidnames, atexpectedRevision, is a wall, a slab, a roof, a ceiling, a foundation or a room whoseprofilehas three points or more (elsecommand-schema). Itsoperationis a sketch operation of Part XIV, 17.1.2, its tool's picks counted (command-schema), which edits the wall'swallOutline, or [[0, 0], [L, 0], [L, height], [0, height]] where it has none, or the element'sprofile:lineappends its two picks, the first left out where it lies within 1 mm of the last point, and the last point dropped where the path then closes on its first within 1 mm;arc3,centerArc,tangentArc,partialEllipseandsplinego on from it,filletrounds one of its corners, andrectangle,polygon,circumscribed,circle,circle3andellipsedraw a new outline in its place, each by 17.1.2's arithmetic. An operation that draws no shape is refused (command-schema). It is run as anupdateofwallOutlineor ofprofile.wall.join.idandotherIdname two walls, atexpectedRevisionandexpectedOtherRevision(elsetarget-missing). The ends that pair are the last pair [i, j] of (0, 0), (0, 1), (1, 0), (1, 1) whose ends meet as Part IV, 7.4.2 pairs two ends (wallEndPair); where none pairs, the first of the first wall's ends 0 and 1, then the other's, that meets the other wall's side as a T, read with its ownjoinEndsleft out (Part IV, 7.4.2,teeHost); where neither, the command is refused (command-schema). The pair's two ends, or the T's end, takeallowin their walls'joinEnds, which are [true, true] where a wall gives none, each wall at its revision plus one. Withallowtrue, a corner whose join is not then found (joinPartner: a third wall meets it, or the walls stand on different storeys), or a T whose end then meets another side, refuses it (command-schema). It is run as anupdateof each wall it changes.wall.flip. The wallidnames, atexpectedRevision, of length L, keeps its place and turns its baseline round, so that its exterior and its interior swap (Part II, 6.8, rule 1):- its
profileis [b, a]; itswallOutline's points [x, z] become [min(L, max(0, L − x)), z], in the reverse order; itsjoinEndsswap; and its edge details turn:startandendswap, atop's or abottom's span [from, to], where it gives either, becomes [L − to, L − from], to and from L and 0 where left out, and an opening's sidesleftandrightswap; at its revision plus one; - a cast-in item it hosts stays where it is along it and in its layer: its
facestartandendswap, itsalongbecomes L less its last item's along, to a tenth of a millimetre, its path's alongs become L less each, and itstiltchanges its sign where its length runs along the wall (on a face other thanstartandend, with noturn90); - a bar set anchored to it is mirrored about the vertical plane through the baseline, its origin about the anchor's point and its axes and
alongas directions, x and y to a millionth, itsanchorthe wall's other end, at the anchor's height, with the anchor's direction reversed, and itsprofileits origin's point; - a door or a window it hosts gets
along= max(0, L − along − width), and itsflippedandhandFlippedturn, each written where true and left out where false, so that it faces and swings as before (Part II, 6.8, rule 2); - an element whose edge attachments name the wall swaps the
faceof each such entry,interiorforexteriorand back (Part II, 6.7); - each view of whose items an object anywhere names the wall by
elementIdand one of its faces byface,exterior,interior,startorend, names the other.
Each element it changes is at its revision plus one. It is run as an
updateof each element and aview.upsertof each view, at its revision.- its
wall.attachandwall.detach. The wallidnames is atexpectedRevision; its top is itstop, or what its legacy members say where it has none (Part II, 6.4).wall.attachwithhostIdattaches it to a roof, a slab, a foundation or a ceiling (top-host; one not in the model,ref-missing) atexpectedHostRevision, which is then given (precondition-missing):top.attachbecomes{hostId, face, offset, mode},faceundersidewhere it is left out,offsetwhere it is given and not 0,modewhere it is given. WithouthostId, or withnull, the top lets go of its host:top.attachgoes.wall.detachlets it go too, and takestop.cutRoofFacewith it where the top gives nocutRoofId. It is run as anupdateof the wall'stop; that the face meets the wall is the whole model's to check (Part IV, 5.3).column.attachandcolumn.detach. The columnidnames is atexpectedRevision.column.attachwrites itsbasewhole,{attach: {hostId, face, offset}}: the host a foundation or a slab (base-host; one not in the model,ref-missing) atexpectedHostRevision,facetopwhere it is left out,offsetwhere it is given and not 0.column.detachtakesbaseaway. It is run as anupdateof the column'sbase.edge.attach. The elementidnames is a roof, a slab, a foundation or a ceiling atexpectedRevision, andedgeIdnames an edge of its outline (Part I, 6.6; elsetrim-edge). Its entry ofedgeAttachmentsfor that edge goes; withhostIda wall (trim-host; one not in the model,ref-missing) atexpectedHostRevision, which is then given (precondition-missing),{edgeId, hostId, face}is added at the end,faceinteriorwhere it is left out; withhostIdnullnone is. An element left with none has noedgeAttachments. It is run as anupdateofedgeAttachments; Part II, 6.7's rules 3 to 5 are the whole model's to check.framing.rule.upsertandfloor.framing.upsert. The typetypeIdnames, atexpectedRevision, is a wall type or a slab type, andlayerIdnames one of its layers (elsetarget-missing).framing.rule.upsertsets the layer'sframingtorule, or takes it away whereruleisnull; where the type has anassembly, the assembly's layer whose type layer is<type id>-<its id>gets or loses it too (target-missingwhere none is), and withsetStructureand a rule it takes theroleframe; and withsetStructureand a rule the type's layer takes thefunctionstructureandcoretrue.floor.framing.upsertsets the layer'sjoiststorule, or takes them away, and refuses a joist deeper than its layer (the rule'smember.depth, the layer's thickness where it gives none, more than 10⁻⁶ mm over the layer'sthickness;command-schema). Each is run as atype.upsertof the type so changed, at its revision.framing.detachandtrusses.detach. The wallwallIdnames, or the roofroofIdnames, atexpectedRevision, has members materialised from it, elements that name it inframeHost.wallIdorframeHost.roofId(Part IV, 7.4.12, rule 2), else it is refused (target-missing). Each lets go of it: it is run as anupdateof each that takesframeHostaway, in the model's order, or withdeleteMemberstrue adeleteof each, which takes what depends on it with it (section 5), one that an earlier delete took being gone already.mep.fall. The pipe or ductidnames, atexpectedRevision, gets the heights of its fallfall, in ‰, from the end it flows to,toward(endwhere it is left out), which keeps its height. Its heights aremep.z, or itsoffsetat each point where it gives none; walking from that end, each point is the one before it plus its segment's run in plan timesfall/1000, but where a segment stands, its run in plan under 1 mm or under a fifth of its rise as it was, which keeps that rise; each height is written to a tenth of a millimetre. It is run as anupdateof itsmep, its other members as they were andzthe heights.Pieces and joints.
piece.upsertandjoint.upsertwritepieceorjointwhole, held tofabrication/piece.schema.jsonandfabrication/joint.schema.json, intopiecesorjoints: one that is there in its place at its revision plus one, a new one at the end of the list at revision 0. A givenexpectedRevisionis the record's (revision-conflict), and for a new record it is refused (precondition-target; section 3, rule 2).piece.deleteandjoint.deleteremove the recordidnames (target-missing), at a givenexpectedRevision. In an envelope a new record's upsert saysnull(Part XVII, 9.1).The application records. A title block, an image, a render, a report, a deviation, an area adjustment and a linked reference are application records (Part I, 11;
application-record.schema.json), intitleBlocks,images,renders,reports,deviations,areaAdjustmentsandreferences; their upserts write the record whole, one that is there in its place, a new one at the end of its list.titleBlock.upsert,report.upsert,deviation.upsertandareaAdjustment.upsert: at its revision plus one, a new one at revision 0; a givenexpectedRevisionis the record's, and for a new record it is refused (precondition-target). An area adjustment'slevelIdnames a level of the model (ref-missing). A title block that gives itswidthandheightas numbers resizes each sheet whosetitleBlockIdnames it and whose size is another: the sheet takes them, at its revision plus one.render.upsert: at its revision plus one, a new one at revision 0, which counts as revision 0 for a givenexpectedRevision(section 3, rule 2).reference.upsert: at its revision plus one, a new one at revision 0; its precondition is strict, as rule 5 says.image.upsert: as it is given; an image has no revision. A givenexpectedHashis the hash (Part III, 6) of the image's record as read,nullfor a new one (Part XVII, 9.2); another refuses it (revision-conflict; for a new image,precondition-target).- Their deletes remove the record
idnames (target-missing), at a givenexpectedRevision, or for an image a givenexpectedHash;titleBlock.deleteandreference.deletegive theirexpectedRevision. A title block is refused while a sheet names it intitleBlockId, and an image while a sheet shows it (images[].imageId) or a title block does (an item of itsitemsof the kindimagewhoseimageIdnames it) (in-use, section 5, rule 4).
No core record operation writes these lists: these are their own. What a record holds besides its id and revision is its application's (Part I, 11).
framing.materialiseandframing.update. The wallwallIdnames, atexpectedRevision, is a wall (elsetarget-missing). Its members are those Part IV, 7.4 lays out of its framed layers, with the elements materialised from it (those that name it inframeHost.wallId) left out of the model: layer by layer in its type's order, and each layer's in its order (Part IV, 7.4.1, rule 6). A wall of which no member is laid out refuses it (target-missing), naming why. A member of outline P in its wall's elevation, from x0 to x1 along and z0 to z1 up, from y0 to y1 across (Part IV, 7.4.1, rule 4), and of line from s to e (Part IV, 7.4.9, rule 1), becomes an element:- Its category and its place, each on the wall's level, each plan point in the model as Part IV, 7.4.1, rule 4 places a point of the elevation at the middle of y0 and y1, and each point,
offsetandheightto a millionth of a millimetre. Where its line is plumb (s and e within 10⁻⁶ mm in x), acolumnat the middle of x0 and x1, itsoffsetthe wall's plus z0, itsheightz1 − z0, and itsturnthe wall's direction from +x in degrees, in (−180, 180] to a millionth, left out where 0. Where its line is level (within 10⁻⁶ mm in z), abeamfrom the point at x0 to the one at x1, set out on its underside: itsoffsetthe wall's plus z0. Else amember(Part II, 6.2.1) along the middle of P's box in the frame of its line: from the least to the greatest of P's reach along the line, at the middle of its reach square to it; itsoffsetthe wall's plus its start's z, and itsendthe wall's level and the wall'soffsetplus its end's z. - Its type is
framing-<category>-<w>x<d>-<grade>, of a section w by d, each to a tenth of a millimetre and written as decimal numbers read them: a column's w is x1 − x0, its section's width along its x before its turn, and its d is y1 − y0; a beam's w is y1 − y0, across, and its d is z1 − z0; a member's w is y1 − y0 and its d P's reach square to its line;<grade>is its rule'smaterial(Part IV, 7.4.9, rule 1), each character but an ASCII letter, a digit,_,:and-a-. Where the model holds a type of that id it is the element's; where it does not, the type{id, category, name: "Framing <w> × <d> <grade>", material: "Timber", color: "#d8b57a", width: w, height: d, revision: 0, section: {shape: "rectangle", width: w, depth: d, web: 1, flange: 1, designation: "<w> × <d>", grade}}is written. A beam's and a member'sheightis its type's section's depth (Part II, 5.3 and 6.2.1, rule 5) and itswidththe section's width; a column'swidthis its section's width. - Its id, its name and its host. Its id is
frame-and its member's id, each character but an ASCII letter, a digit,_,:and-a-; itsnameits member's (stud 3);structuraltrue;frameHost{wallId, layerId, memberId, role}: the wall, its layer, its member's id and its role; at revision 0.
framing.materialiseis refused for a wall that has elements materialised from it (command-schema), andframing.updatefor one that has none (target-missing). Each is run as atype.upsertof each type it writes, in the order of their first use; then, for an update, adeleteof each element materialised from the wall that is no member's now, in the model's order; then, member by member, acreateof each element that is new and anupdateof each that differs, its patch what changed (rule 1). An element materialised from the wall whoseframeHost.editedis true is a person's own: it is kept as it is, neither deleted nor updated.- Its category and its place, each on the wall's level, each plan point in the model as Part IV, 7.4.1, rule 4 places a point of the elevation at the middle of y0 and y1, and each point,
trusses.materialiseandtrusses.update. The roofroofIdnames, atexpectedRevision, is a roof (elsetarget-missing) whosetrussLayoutPart IV, 7.4.13 lays out with the elements materialised from it (those that name it inframeHost.roofId) left out of the model; one that it does not lay out refuses it (target-missing), naming its finding. A layout that frames a roof opening refuses it (command-schema): a trimmer of one side, a truss whose top chords lose a band to an opening, a header and a dormer rafter (Part IV, 7.4.13, rule 10) are the layout's own, and a truss of a family carries no band. Its trusses, its ridge beam and its posts become elements, eachstructural, at revision 0, withframeHost{roofId, memberId, role}, its id as rule 20 makes it of its truss's or its member's id:- A truss, in the layout's order, its hip sets' among them (Part IV, 7.4.16): a
beamfrom its a to its b, each to a millionth, on the highest level at or under its bearing plane E (within 10⁻⁶ mm; of two at one elevation the first by id; else the roof's level), itsoffsetE less that level's elevation, to a thousandth; of the layout'sfamilyTypeId, but a hip truss's and a jack's<familyTypeId>-jackand a girder's along the ridge<familyTypeId>-flat(7.4.16, rule 2), which, where the model holds no type of the id, is written:{id, name: its family's name, category: "beam", material, color, width, height, revision: 0, framing}, its family as 7.4.16, rule 2 makes it and the rest the layout's type's; itsframingParametersits parameters (7.4.13, rule 7); itswidthits family'sWidth(45 where it has none) and itsheightits type's; named as 7.4.13, rule 13 and 7.4.16, rule 10 name it (Truss T3); its roletruss. - A ridge beam (7.4.13, rule 11): a
beamfrom the middle of its four corners at its start to the middle of those at its end, each to a millionth, set out on its underside, its corners' least height, on the level rule 1 gives that height, itsoffsetto a thousandth; of the typeframing-beam-<width>x<depth>-<grade>of rule 20, its grade its layout'sridgeBeam.material, else its layout's type'smaterial; namedridge beamand its key; its roleridgeBeam. A ridge beam whose underside or top lies at its two ends more than 10⁻⁶ mm apart is no beam's body, and refuses the command (command-schema). Each of its posts: acolumnat the middle of its corners, from their least height up to their greatest, itsoffsetand itsheightto a thousandth, turned as the ridge runs (rule 20.1), of the typeframing-column-<width>x<width>-<grade>; namedridge postand its key; its rolepost.
trusses.materialiseandtrusses.updateare refused, and run, as rule 20 says of a wall's.- A truss, in the layout's order, its hip sets' among them (Part IV, 7.4.16): a
trusses.layout.upsert. The roofroofIdnames, atexpectedRevision, is a roof (elsetarget-missing). ItstrussLayoutbecomeslayout, written whole, or goes wherelayoutisnull: the command is run as anupdateof the roof'strussLayout, and refused only where that update is: by its schema (command-schema, named inlayout), or by the whole model's check (section 6, stage 3). A layout that Part IV, 7.4.13 cannot lay out is stored, as any record whose derived results a rule cannot give is (Part IV, 7.4.12). The processor then lays the layout out, and says each finding as a warning of its answer: that it has no layout and why (framing-layout-roof, 7.4.13, rule 1), or each note of one that it has (framing-layout-note, 7.4.12).align.moving.elementIdnames the element that moves, atexpectedRevision, andreference.elementIdanother (one element named twice,command-schema), atexpectedReferenceRevision. Eachfacenames a face that its element offers, a plane worked out from its record by a point and a normal (elsetarget-missing, the element's faces named):- A wall of two profile points a and b, its direction u, its left normal n (Part IV, 3), its thickness T (its type's layers' together, else its
width; Part IV, 7.4.2, rule 1) and its base z_b (its level's elevation plus itsoffset):exteriorthrough a + n·T/2, its normal n;interiorthrough a − n·T/2, −n;centrelinethrough a, n;startthrough a, −u;endthrough b, u;bottomat z_b, down; andtop, up, at its top by Part IV, 5.1, where it is not attached (top.attach) nor cut (top.cutRoofId), carries no legacy member of either (Part II, 6.4) and nowallOutline. - A slab, a foundation or a ceiling of three outline points or more: each edge,
edge:<edge id>by its id (itsedgeIds, else<id>:edge:<i>; Part I, 6, rule 6), through its first point, its normal square to it in plan and out of the outline; and, where it carries noplane(Part II, 6.3.1),topat its level's elevation plus itsoffset, up, andbottomits thickness under that (its type's layers' together, else itsheight), down. - A column of centre c, base z_b and turn t, with x′ = (cos t, sin t), y′ = (−sin t, cos t), and w and d its section's
widthanddepth(each itswidthwhere its type has no section):side:0through c − y′·d/2, its normal −y′;side:1through c + x′·w/2, x′;side:2through c + y′·d/2, y′;side:3through c − x′·w/2, −x′; and, where its base is not attached (base),bottomat z_b andtopat z_b plus itsheight. - A beam of two profile points a and b, its direction u and its left normal n, w and d its section's
widthanddepth(its ownwidthandheightwhere its type has no section), set out on its underside z_b (Part IV, 6.2):leftthrough a + n·w/2, n;rightthrough a − n·w/2, −n;startthrough a, −u;endthrough b, u; and, where itsendRiseand itsrollare 0 or left out,bottomat z_b andtopat z_b + d.
No other element offers a face. The two faces are parallel, their normals' product 0.999999 or more in size (else
command-schema). With n_r and p_r the reference face's normal and point and p_m the moving face's point, the element moves by n_r·((p_r − p_m)·n_r), each part to a millionth of a millimetre, as rule 6 moves it: the command is run as anupdateof the element.- A wall of two profile points a and b, its direction u, its left normal n (Part IV, 3), its thickness T (its type's layers' together, else its
trusses.plan. Its roofs are the roofroofIdnames (a roof, elsetarget-missing), or, withoutroofId, every roof of the model, by id, whose truss layout Part IV, 7.4.13 lays out with a truss or more, as the model stands; where there is none, it is refused (target-missing). Its plan is the viewidnames, elsetruss-plan-<roofId>, elsetruss-plan; a view of that id that is not a plan refuses it (command-schema). The plan is that view as it was, where there is one, with these members:levelId: the level of the first wall or beam its layouts bear on, each layout's left side's bearings and then its right side's, each side's in order (7.4.13, rule 3); else its first roof's level;cutHeightc = h − E_l + 300, rounded to the millimetre, h the highest of its roofs' boxes (rule 4.4) and of its trusses' bearing planes, and E_l its level's elevation; andviewRange{direction: "down", top: {offset: c}, cut: {offset: c}, bottom: {offset: 0}, depth: {offset: 0}};crop: the least and greatest x and y of its trusses' points a and b, grown by 1500 mm, each to a millionth;kindplan; anddisplayits own, else{style: "hiddenLine", shadows: false, sunPath: false}, withhiddenDisciplines["architectural", "systems"]andtrussMarkstrue;- and, where it had none of them,
nameTruss plan · <the roof's name>where the command names a roof andTruss planelse,origin[0, 0],direction[0, 1],far10000,scale100 andhiddenCategories["rebar", "mesh"].
Its precondition,
expectedRevision, is optional outside an envelope. Given, it is the plan's revision as read (revision-conflict), andnullfor a plan of that id that is not there yet:nullfor one that is there is refused (revision-conflict), and a number for one that is not (precondition-target). It is run as aview.upsertof the plan, at its revision.mesh.lay. The elementhostIdnames is a slab, a foundation or a wall, as a mesh element's host is (Part II, 6.1; elsetarget-missing). Over a slab or a foundation of three outline points or more itsfaceisbottom,toporseams,bottomwhere it is left out, and it names nolayer; in a straight wall itsfaceisexterior,interior,bothormiddle,bothwhere it is left out (elsecommand-schema). The mesh element is{id, category: "mesh", name, typeId, levelId, offset, height: 8, width: 8, profile, revision: 0, hostId, sheet}:- its
idthe command's, else the first of<hostId>:mesh,<hostId>:mesh-2,<hostId>:mesh-3… that the model does not hold; itstypeIdthe model's mesh type whose id comes first (none,ref-missing); itslevelIdits host's; itsoffseta wall'soffset, else 0; itsprofileits host's first point; - its
sheet:designationthe command's, a national value (open questions, 4), which the command gives;length5000 andwidth2300, over seams 2300 and 600;face;coverthe command's, else 25 in a wall and 35 else;lap,layerandgradewhere the command gives them; andmarkthe command's, elseNand n + 1, n the number of the model's elements that carrysheet; - its
nameMesh <designation>, <face>, its face saidbottom,top,exterior face,interior face,both facesormiddle; over seamsSeam mesh <designation>.
It is run as a
createof the element, naming its host's revision where the command givesexpectedHostRevision(in an envelope it does, Part XVII, 9.1).- its
mep.downpipe. The elementgutterIdnames is a gutter (elsetarget-missing) with a body (Part IV, 4.7; elsecommand-schema),typeIdnames a pipe type (ref-missing,type-category), andsizeis the pipe's diameter: the command gives both, since OpenEik names no downpipe product. With a and b the ends of the gutter's eave line, the edge of its roof's domain that itshostEdgeIdnames (Part IV, 4.4, rule 3), L its length, t its direction and o its normal out of the roof; z_g the least height of the gutter's body; and r =size/2:- The facade under it: of each straight piece of a wall whose base lies at z_g or under it, within 10° of t, whose outer face lies f in from the eave line along −o, more than 0 and at most 2500 mm (the piece's distance in less half the wall's thickness, its type's layers' together, else its
width), and whose reach along t from a, u_0 to u_1 (its ends', grown by half its thickness), meets 0 to L: the one of the least f, the first by id of equals. - Its place: at the gutter's
end(endwhere it is left out) u = L − i, at itsstartu = i, with i = min(150, L/2); with a facade, at the end min(L − i, u_1 − 100 − r), at the start max(i, u_0 + 100 + r); held within 0 and L. Its top q is the point u along the eave from a, moved along o to the middle m of the gutter's body's reach along o from there, at z_g. - Its path runs down from q. Where a facade stands off by s = max(0, f + m − r − 30) more than 20 mm, it drops 80 mm, then runs s back along −o while it falls s / tan β, β 70° where s is more than 250 mm and 45° else. Then it runs down to its foot: φ is the elevation of the level
levelIdnames (else the level nearest elevation 0, the first by id of equals;ref-missing) plusfoot(−150 where it is left out); withkickOut(true where it is left out) down to φ + 200 and then 200 mm out along o down to φ, else down to φ. A lowest point less than 100 mm under the point before it refuses it (command-schema). - The pipe is
{id, category: "pipe", name: "Downpipe Ø<size>", typeId, levelId, offset: 0, height: size, width: size, profile, revision: 0, hostId: gutterId, mep: {z, size, downpipe: {end, foot, kickOut, from}}}: itsidthe command's, else the first of<gutterId>:downpipe,<gutterId>:downpipe-2… that the model does not hold; itslevelIdthat level's; itsprofileits path's points in plan andmep.ztheir heights over the level, each to a tenth of a millimetre;from, what its path was worked out from, a's and b's x and y, z_g, f, u_0 and u_1, each to a tenth, written as decimal numbers read them and joined by spaces, the last three empty where there is no facade.
It is run as a
createof the pipe, naming its gutter's revision where the command givesexpectedHostRevision.- The facade under it: of each straight piece of a wall whose base lies at z_g or under it, within 10° of t, whose outer face lies f in from the eave line along −o, more than 0 and at most 2500 mm (the piece's distance in less half the wall's thickness, its type's layers' together, else its
The kind left.
rebar.quickis not defined here, and a processor that applies the proposal refuses it as one that does not (kind-not-implemented). The sets it lays out, a slab's or a foundation's bars both ways, U-bars along its edges, a beam's or a column's cage and a wall's two faces, are bar sets whose record holds a bending sheet's shape code and its dimensions (bars.shapeandbars.dims, Part II, 6.3), national values of which OpenEik carries no list (open questions, 4), and the reference laps its long bars by a design code's anchorage lengths in the concrete's class. A writer that knows a code lays the sets out and sends them ascreates, with their legs and mandrel where it has them (Part II, 6.3.2).
Reference: the functions the table names, in src/core/geometry/transforms.ts, src/core/geometry/modifications.ts, src/core/elements/lineEdits.ts, edgeDetails.ts, inserts.ts, bars.ts, mep.ts, wallJoins.ts and wallTop.ts, src/core/sketch/sketchTools.ts, src/core/views/viewPatch.ts, viewUsers.ts and axonometric.ts, src/core/model/typeRuleCommands.ts, and the branches of run in src/core/model/store.ts; materialisedElements, memberElement, memberType and memberElementId in src/core/elements/framingMaterialise.ts; trussElement, trussTypeOf, trussElementId and deriveTrussLayout in src/core/elements/trussLayout.ts; jackType and flatTopType in src/core/elements/trussFamilies.ts; trussPlanView in src/core/views/trussPlan.ts; meshOn in src/core/elements/meshSheets.ts; downpipeFor and facadeUnder in src/core/elements/downpipes.ts; and, for the kind left, quickSet and lapLongBars in src/core/elements/bars.ts and barLaps.ts. In @openeik/tools: applyCommands(model, commands) on a model of 0.5, and with {proposals: ["domainCommands"]} on a model of 0.4 (DOMAIN_COMMAND_KINDS; src/domain.js, and src/domain-derived.js for rules 4.4 and 20 to 26).
3. Preconditions
A precondition names the state a command was based on; a mismatch is refused, so two writers cannot overwrite each other unseen.
- When a command gives
expectedRevision, the target's current revision MUST equal it, or the command MUST be refused (the reference message: "Revision conflict: expected 3, current 4. Read and retry."). - Upserts. For
grid.upsert,scopeBox.upsert,reference.upsert,detailFamily.upsertanddimensionStyle.upsertthe precondition is strict: when the record exists,expectedRevisionMUST be given and MUST equal its revision; when it does not,expectedRevisionMUST be absent. For the other upserts a givenexpectedRevisionMUST equal the record's revision;material.upsert,report.upsert,deviation.upsertandareaAdjustment.upsertrefuse one for a new record, andtype.upsert,view.upsert,sheet.upsertandrender.upsertcount a new record as revision 0. - Other preconditions compare the named state:
expectedLevelthe whole level (every member of it, those the processor does not know and extension members included: Part I, 10 and 11.2, rule 5),expectedNamethe project's name,expectedSitethe site (ornullfor none),expectedHostRevisionthe host's revision. A state is compared as a JSON value: the order of its members and the way a number is written do not count (Part III, 6), and a member that one side has and the other lacks is a difference. - Where a precondition is optional and left out, the command is applied to whatever is there. Writers SHOULD always give one.
Reference: the revision checks in run.
4. Patches
An update carries patch: the element members to write.
- Each member of the patch replaces the element's member of that name, whole: nested objects are not merged.
nullremoves a member the element may lack (top,joins,taper,hostId…). The members every element has (name,typeId,levelId,offset,height,width,profile) can only be replaced, andid,categoryandrevisioncannot be patched.- A patch MUST NOT say
undefined(or leave out a member it means to remove): JSON drops an undefined member, so a logged command would not remove it. A processor MUST refuse a patch that holds an undefined value for a member the record has, and tell the caller to sendnull. - A patch that changes
typeIdMUST name a type of the element's category. - A patch that sets a
widthorheightthe element's type sets (Part II, 5.3) MUST be refused. - A patch MUST NOT write the legacy members
topRoofId,topCeilingIdandroofCutId. - After the patch, the element's revision is the old one plus one.
view.update patches a view the same way, except that display is merged into the view's own. detail.update merges its patch into one detail item, null removing a member, and the item is checked whole again.
Reference: elementPatchSchema and patchedElement in src/core/model/model.ts; refuseLostClears and the update branch of run in src/core/model/store.ts; refuseTypeSetSizes in src/core/model/typeSets.ts.
5. Deletes and what depends on them
- Deleting an element MUST also delete the elements that depend on it: those hosted by it (
hostId) and the framing members or trusses materialised from it (frameHost). The answer names them (removedDependents). - A shaft hosted by a deleted stair survives as a plain shaft: its
hostIdgoes and its revision goes up by one. - 2D items of views that name the deleted element are removed with it, and views stop hiding it.
type.deleteMUST be refused while a record names the type, an element or a view's assembly (a folder holds every type its records name, Part III, 12);view.deletewhile a sheet, a dependent view, a callout, a view reference or a report uses the view;level.deletewhile anything stands on the level or reaches up to it, unlessmoveTonames the level they move to.
Reference: dependsOn and the delete branch of run; viewDeleteRefusal in src/core/views/viewUsers.ts; deleteLevel in src/core/model/levels.ts.
6. Validation and refusal
A command is checked in three stages, and refused at the first that fails:
- Shape: the command matches its kind's schema (section 1).
- The command's own rules: its target exists, its preconditions hold, its references name records of the right kind, and the rules of its kind (a wall attaches only to a host that covers it; an opening fits its wall).
- The whole model: the model after the command MUST pass every rule of Parts I and II. A command that would leave the model invalid MUST be refused, even when the command itself is well formed.
A refusal MUST say, in the terms of the domain, what is wrong and SHOULD say how to fix it. In a batch, it MUST name the command by its index, kind and id.
From the reference processor, on examples/one-storey-house, after the south wall was attached (revision 1):
{
"ok": false,
"dryRun": true,
"failed": 3,
"results": [
{"index": 0, "ok": false, "kind": "update", "commandId": "wall-south",
"error": "Command 0 (update wall-south): Revision conflict: expected 0, current 1. Read and retry."},
{"index": 1, "ok": false, "kind": "update", "commandId": "wall-north",
"error": "Command 1 (update wall-north): A wall or beam requires two distinct endpoints."},
{"index": 2, "ok": false, "kind": "update", "commandId": "window-south",
"error": "Command 2 (update window-south): Opening must fit within its host wall: it reaches 10500 mm along a wall 10000 mm long."},
{"index": 3, "ok": true, "kind": "update"}
]
}
Reference: validateWhole and validateManifest; batchError and dryRunReport in src/core/model/store.ts.
7. Batches, atomicity and dry runs
- A batch is an ordered list of commands applied as one: each command sees the model as the commands before it left it, and the whole model is checked once after the last. If any command or the final check fails, the batch MUST change nothing.
- One command is a batch of one.
- A dry run (
dryRun: true) MUST run every check a real run does and MUST change nothing. A dry run of a batch that fails SHOULD answer for every command: each is tried in order on a copy, a failing one is reported and left out, and the rest go on, so that the caller learns everything it has to fix at once. - A batch that changes the model is one undo step.
- A generic element is moved to a category that fits by a batch of a
deleteand acreatewith the same id (Part II, 6.6, rule 7); no command kind does it alone.
Reference: dispatchBatch (a preview store, all or nothing) and dryRunReport in src/core/model/store.ts; execute_batch in src/automation.ts.
8. Determinism and replay
- Applying a command MUST be a function of the model and the command alone.
- A command MUST be applied as its JSON text would be stored: what JSON cannot hold (undefined members,
NaN, infinities, dates) is resolved before the command runs, so the processor that sends a command and one that replays it later get the same model. - A command MUST NOT mint a random id or read the clock. An id a command makes is named by the caller or derived from its input: the reference derives
<host>:bars, then<host>:bars-2,-3and so on. - A processor that replays commands it has already accepted (opening a project from a log) MUST NOT refuse them by a rule made after they were accepted. Admission rules apply to new commands; application is deterministic.
Reference: asLogged and madeId in src/core/model/store.ts; replay (the replaying flag lifts the newer refusals, such as type-set sizes and edits of placed copies, for accepted commands).
9. The answer
A command processor answers an accepted command or batch with at least:
| Member | Meaning |
|---|---|
ok | true |
dryRun | whether anything was committed |
affected | the ids of every record the command or batch changed, including those changed as a consequence (joined walls, dependents) |
verify | how to check the result: a filter that selects exactly the affected elements (Part VII), and the views and snapshots to look at |
sequence | the host's change sequence after the command |
warnings | what the caller should know but that did not refuse the command (optional) |
and, per command, its result: the record written, or for a delete {deleted, removedDependents?}.
From the reference processor, renaming the west wall:
{
"ok": true,
"dryRun": false,
"sequence": 1,
"affected": ["wall-west"],
"verify": {
"filter": {"elementIds": ["wall-west"]},
"snapshot3d": {"filter": {"elementIds": ["wall-west"]}, "corners": ["SW", "NE"], "hideOthers": false},
"snapshot2d": [{"viewId": "view-plan-0", "filter": {"elementIds": ["wall-west"]}}]
}
}
Reference: the execute and execute_batch actions and verifyHints in src/automation.ts.
9.1 The weight line
Part of 0.5, with Part III, 15.8. OpenEik 0.4 had it as part of the proposal weight (open questions, 138): a processor of a model of 0.4 gives it only where a caller asks for the proposal (decision D12).
A command processor MAY add to an accepted batch's answer its running weight line, the member weight, held to schemas/0.5/weight/answer.schema.json, which the answer's schema of 0.5 names as its weight:
| Member | Meaning | |
|---|---|---|
written | always | the records the batch wrote, by kind: a list's name (elements, types, views, sheets, …), and details for a view's detail items |
removed | where it removed any | the records the batch removed, by kind |
session | where the caller keeps a session | the records the session wrote so far, this batch's with them, by kind |
heavy | always | the heavy forms the checks of Part III, 15.7 find in what the batch wrote, judged by itself, each {code, ids, count, compact, saves} with its message, its counts and, for a view's items, the view; never weight-copies (Part III, 15.8, rule 3.4) |
advice | where it gave any | the advisories of Part III, 15.8, each {code, rule, command, target, message, compact?, saves, guide}: the data of the warnings it gave in warnings |
repeats | where any came again | {code, target, count}: an advisory not given again in the session, and how many times it came |
- The weight line is advice, as the advisories are: it refuses nothing, and an answer without it is as complete.
- What the batch wrote is judged by itself: the heavy forms of the whole model are a validator's (Part III, 15.7).
- A dry run's answer MAY carry it; a session takes only a batch applied.
From @openeik/tools, a wall written whole again by an update to change its height, in a model of 0.5 (the message shortened):
"warnings": ["Command 0 (update wall-a): the patch sends 7 members of the record, 6 of them as they were, to change 1 (height): … [weight-full-replace, III.15.8.2]"],
"weight": {
"advice": [{"code": "weight-full-replace", "command": 0, "compact": {"expectedRevision": 0, "id": "wall-a", "kind": "update", "patch": {"height": 2800}}, "guide": "guides/weight.md#commands", "message": "the patch sends 7 members of the record, …", "rule": "III.15.8.2", "saves": {"bytes": 111, "members": 6}, "target": "elements/wall-a"}],
"heavy": [],
"written": {"elements": 1}
}
10. The log (informative)
The reference implementation keeps a cloud project as a snapshot plus an append-only log of accepted batches, each stored as JSON and sequenced with a compare-and-swap; opening a project replays the log (section 8). 0.1 does not specify the log's format. A common command envelope is 0.2's (decided 11 October 2026). The plan proposed it around each batch: an operation id for idempotency, attribution per person and per agent, a target branch and base, a mode (apply, dryRun, propose) and an intent text. Part XVII, of 0.2, gives it in full, with what a processor that keeps a log records of each operation.
11. A supplier's parts
This section says what a supplier's parts (Part II, 12) ask of commands.
- No new command kind. A supplier writes a type with declared geometry, or with the railing members of Part II, 12.2, by
type.upsert; places or changes elements bycreateandupdate, where a patch ofdeclaredGeometryor ofrailingreplaces it whole (section 4); and materialises a railing's post positions by anupdatethat writesrailing.posts.at. - Transforms carry declared geometry.
move,rotate,mirror,array,radialArrayand the other transforms MUST move, turn, mirror or copy an element's declared geometry with the element (Part II, 12.1, rule 6). - A proposal's quote is not a command. It travels with the proposal on the host, and no command writes it into the model, nor into a proposal file (Part VI, 8.7).
Reference: mappedDeclaration in src/core/model/declaredGeometry.ts, called by the transforms in src/core/geometry/transforms.ts and src/core/geometry/modifications.ts.