@thatopen/services 0.34.5 → 0.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -66
- package/dist/cli.js +54 -12
- package/dist/cli.js.map +1 -1
- package/dist/core/app-cache.d.ts +32 -0
- package/dist/core/app-cache.test.d.ts +1 -0
- package/dist/core/client.d.ts +9 -1
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +974 -917
- package/dist/index.es.js.map +1 -1
- package/dist/types/context.d.ts +6 -0
- package/dist/vite-env.d.ts +1 -1
- package/docs/ai-quickstart.md +548 -548
- package/docs/builtin/paths.json +130 -130
- package/docs/cli/create.md +29 -29
- package/docs/cli/local-server.md +38 -38
- package/docs/cli/login.md +32 -32
- package/docs/cli/mcp.md +46 -46
- package/docs/cli/publish.md +31 -31
- package/docs/cli/run.md +26 -26
- package/docs/cli/serve.md +43 -43
- package/docs/cli/swap.md +30 -30
- package/docs/cloud/GaussianSplatConverter.md +43 -43
- package/docs/cloud/PointCloudConverter.md +53 -53
- package/docs/flow-architecture.md +393 -393
- package/docs/flow-plugin-guide.md +354 -354
- package/docs/platform-token.md +81 -81
- package/docs/rate-limits.md +133 -133
- package/docs/recipes-guide.md +243 -243
- package/docs/revit-collab-quickstart.md +445 -445
- package/docs/rhino-interop-quickstart.md +387 -387
- package/docs/sheet-sets-guide.md +69 -69
- package/package.json +4 -4
- package/resources/AGENTS.md +57 -57
- package/src/built-in/CDEManager/example.ts +214 -214
- package/src/built-in/CDEManager/examples/FileEditing/example.ts +226 -226
- package/src/built-in/CDEManager/examples/FileMoves/example.ts +186 -186
- package/src/built-in/CDEManager/examples/FileOperations/example.ts +295 -295
- package/src/built-in/CDEManager/examples/FileTransfers/example.ts +210 -210
- package/src/built-in/CDEManager/examples/FolderManagement/example.ts +230 -230
- package/src/built-in/CDEManager/examples/MetadataSchema/example.ts +230 -230
- package/src/built-in/CDEManager/examples/MetadataViews/example.ts +166 -166
- package/src/built-in/CDEManager/examples/ProjectConfig/example.ts +177 -177
- package/src/built-in/ClashesManager/example.ts +283 -283
- package/src/built-in/GISManager/example.ts +355 -355
- package/src/built-in/ProjectManager/example.ts +124 -124
- package/src/built-in/UIManager/src/app/example.ts +97 -97
- package/src/built-in/UIManager/src/app/examples/AppState/example.ts +140 -140
- package/src/built-in/UIManager/src/app/examples/Banner/example.ts +159 -159
- package/src/built-in/UIManager/src/app/examples/Contexts/example.ts +123 -123
- package/src/built-in/UIManager/src/app/examples/FileDrop/example.ts +124 -124
- package/src/built-in/UIManager/src/app/examples/FloatingLayout/example.ts +90 -90
- package/src/built-in/UIManager/src/app/examples/Modal/example.ts +163 -163
- package/src/built-in/UIManager/src/app/examples/Notifications/example.ts +133 -133
- package/src/built-in/UIManager/src/app/examples/ProjectFileStorage/example.ts +150 -150
- package/src/built-in/UIManager/src/app/examples/Sidebar/example.ts +105 -105
- package/src/built-in/UIManager/src/clashes-panel/example.ts +183 -183
- package/src/built-in/UIManager/src/gis-panel/example.ts +163 -163
- package/src/built-in/UIManager/src/gis-properties-panel/example.ts +168 -168
- package/src/built-in/UIManager/src/git-history-panel/example.ts +70 -70
- package/src/built-in/UIManager/src/map-panel/example.ts +189 -189
- package/src/built-in/UIManager/src/models-list/example.ts +181 -181
- package/src/built-in/UIManager/src/settings-panel/example.ts +303 -303
- package/src/built-in/UIManager/src/topics-panel/example.ts +170 -170
- package/src/built-in/UIManager/src/viewer/example.ts +182 -182
- package/src/built-in/UIManager/src/viewer-toolbar/example.ts +376 -376
- package/src/built-in/index.ts +2995 -2995
- package/src/cli/templates/app/README.md +250 -250
- package/src/cli/templates/app/index.html +35 -35
- package/src/cli/templates/app/package.json +32 -32
- package/src/cli/templates/app/src/app.ts +37 -37
- package/src/cli/templates/app/src/assets/tool-placeholder.ts +50 -50
- package/src/cli/templates/app/src/bim-components/CloudRunner/index.ts +95 -95
- package/src/cli/templates/app/src/bim-components/CloudRunner/src/index.ts +1 -1
- package/src/cli/templates/app/src/bim-components/CloudRunner/src/types.ts +5 -5
- package/src/cli/templates/app/src/bim-components/index.ts +1 -1
- package/src/cli/templates/app/src/globals.ts +1 -1
- package/src/cli/templates/app/src/main.history.ts +191 -191
- package/src/cli/templates/app/src/main.ts +226 -226
- package/src/cli/templates/app/src/setups/channel.ts +76 -76
- package/src/cli/templates/app/src/setups/reality-capture/lib/hidden-tiles-plugin.ts +88 -88
- package/src/cli/templates/app/src/setups/reality-capture/lib/point-tile-plugin.ts +166 -166
- package/src/cli/templates/app/src/setups/reality-capture/lib/render-frame.ts +31 -31
- package/src/cli/templates/app/src/setups/reality-capture/lib/splat-tile-plugin.ts +51 -51
- package/src/cli/templates/app/src/setups/reality-capture-viewer.ts +1383 -1383
- package/src/cli/templates/app/src/ui-components/app-info-section/index.ts +26 -26
- package/src/cli/templates/app/src/ui-components/app-info-section/src/index.ts +1 -1
- package/src/cli/templates/app/src/ui-components/app-info-section/src/types.ts +15 -15
- package/src/cli/templates/app/src/ui-components/cloud-runner-section/index.ts +37 -37
- package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/index.ts +1 -1
- package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/types.ts +14 -14
- package/src/cli/templates/app/src/ui-components/index.ts +2 -2
- package/src/cli/templates/app/tsconfig.json +16 -16
- package/src/cli/templates/app/vite.config.js +57 -57
- package/src/cli/templates/cloud-component/README.md +205 -205
- package/src/cli/templates/cloud-component/_thatopen +5 -5
- package/src/cli/templates/cloud-component/declarations.json +4 -4
- package/src/cli/templates/cloud-component/package.json +21 -21
- package/src/cli/templates/cloud-component/src/main.ts +70 -70
- package/src/cli/templates/cloud-component/tsconfig.json +16 -16
- package/src/cli/templates/cloud-component/vite.config.js +46 -46
- package/src/cli/templates/shared/AGENTS.md +8 -8
- package/src/cli/templates/shared/CLAUDE.md +1 -1
- package/src/cli/templates/shared/_gitignore +5 -5
- package/src/core/examples/.env.example +7 -7
- package/src/core/examples/apps.ts +67 -67
- package/src/core/examples/batch-reads.ts +99 -99
- package/src/core/examples/channel.ts +65 -65
- package/src/core/examples/components.ts +91 -91
- package/src/core/examples/execution.ts +75 -75
- package/src/core/examples/file-metadata.ts +94 -94
- package/src/core/examples/files.ts +81 -81
- package/src/core/examples/folders.ts +82 -82
- package/src/core/examples/hidden-files.ts +88 -88
- package/src/core/examples/history.ts +103 -103
- package/src/core/examples/icons.ts +68 -68
- package/src/core/examples/permissions.ts +87 -87
|
@@ -1,393 +1,393 @@
|
|
|
1
|
-
# That Open Flow
|
|
2
|
-
|
|
3
|
-
A modular system for **collaboration, interoperability and automation** on top of That Open
|
|
4
|
-
Platform.
|
|
5
|
-
|
|
6
|
-
> Work the way you want, not the way a format tells you to.
|
|
7
|
-
|
|
8
|
-
Everything below follows from taking that literally. Most systems in this space achieve
|
|
9
|
-
interoperability by agreeing on one data model and asking everybody to move into it. This one does
|
|
10
|
-
the opposite: applications stay sovereign over their own data, and what is shared is a way of
|
|
11
|
-
recording change.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## 1. Any file, and each one collaborates its own way
|
|
16
|
-
|
|
17
|
-
The platform holds **native files** — `.rvt`, `.3dm`, whatever an application actually saves.
|
|
18
|
-
Nothing is converted on the way in.
|
|
19
|
-
|
|
20
|
-
Each **file** has its own collaboration system. Note: a file, not a format. Two Rhino models in two
|
|
21
|
-
projects can be collaborated on in two different ways, by the same person, on the same day, because
|
|
22
|
-
what suits a five-person structural team does not suit somebody sketching alone.
|
|
23
|
-
|
|
24
|
-
There is exactly one rule:
|
|
25
|
-
|
|
26
|
-
> **Collaboration is based on a history, and every history follows the same contract.**
|
|
27
|
-
|
|
28
|
-
That is the whole of the shared surface. Everything above it is free.
|
|
29
|
-
|
|
30
|
-
Two consequences, and they are the point of the design:
|
|
31
|
-
|
|
32
|
-
1. **Applications with incompatible needs coexist.** Revit needs a very specific collaboration
|
|
33
|
-
system, because Revit worksharing is a specific thing: a central file, element-level ownership,
|
|
34
|
-
a merge engine. Rhino needs none of that. Neither has to pretend to be the other.
|
|
35
|
-
2. **A project chooses.** Ownership claimed up front, or nothing locked at all, or something in
|
|
36
|
-
between. The history contract does not care which, and the platform reads all of them the same
|
|
37
|
-
way.
|
|
38
|
-
|
|
39
|
-
### The contract
|
|
40
|
-
|
|
41
|
-
A history is a list of commits. Each commit says:
|
|
42
|
-
|
|
43
|
-
| Field | Meaning |
|
|
44
|
-
|---|---|
|
|
45
|
-
| `guid` | What the commit IS. Identity. Never reused. |
|
|
46
|
-
| `parents` | The commits it was built on. Absent on a root. First is the line it continues. |
|
|
47
|
-
| `author`, `timestamp` | Who and when. |
|
|
48
|
-
| `changes` | Which items changed, and how: `create`, `update`, `delete`. |
|
|
49
|
-
| `counts` | Derived totals, so a reader need not walk the changes to summarise. |
|
|
50
|
-
| `version` | Where it landed in the CDE, when there IS such a place. Data, never identity. |
|
|
51
|
-
|
|
52
|
-
Two rules about reading it, and they are what let an application unlike Revit take part at all:
|
|
53
|
-
|
|
54
|
-
- **Order comes from the graph, not from a number.** Follow `parents`; break ties by timestamp.
|
|
55
|
-
Asking "which came first" of an integer forces every application to invent a sequence, and only
|
|
56
|
-
something like Revit's central — which serialises everybody through one line — can honestly
|
|
57
|
-
produce one.
|
|
58
|
-
- **`version` is never a name.** It is where the commit was stored, not what it is. An application
|
|
59
|
-
with no version counter simply omits it.
|
|
60
|
-
|
|
61
|
-
`parents` is a **list** because a history that can only be a line is a different thing from a graph.
|
|
62
|
-
A fork is two commits naming the same parent; a merge is one commit naming two. Revit will never
|
|
63
|
-
write more than one — its central is a single line and it merges inside itself — and the list exists
|
|
64
|
-
precisely for the applications that are not Revit.
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## 2. What a history buys
|
|
69
|
-
|
|
70
|
-
**Traceability.** Who changed what, when. The history of a single element, across every commit that
|
|
71
|
-
touched it.
|
|
72
|
-
|
|
73
|
-
**Work is not lost.** The platform stores the native files as content-addressed blocks, and blocks
|
|
74
|
-
are only ever added. Every state the model has ever been in is still there, and a commit's map of
|
|
75
|
-
which blocks made up which file is stored with it, so a past state can be rebuilt.
|
|
76
|
-
|
|
77
|
-
**One timeline, or many.** Each file has its own history. The platform can show them together,
|
|
78
|
-
filtered and searched as one.
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
## 3. Native data, out in the open
|
|
83
|
-
|
|
84
|
-
Every application on the platform publishes its data openly: readable **without opening the
|
|
85
|
-
proprietary application**.
|
|
86
|
-
|
|
87
|
-
This is what makes everything in the next section possible. A translator, a script or a model runs
|
|
88
|
-
with Revit closed and Rhino closed; if the only way to know what is in a model were to open the
|
|
89
|
-
application that wrote it, none of it could exist.
|
|
90
|
-
|
|
91
|
-
The constraint that follows is worth stating, because it decides where fixes go: **anything reading
|
|
92
|
-
a model cannot ask its application a question.** Every fact it needs has to be in what that model
|
|
93
|
-
already published. When something turns out to be missing, the fix goes in the EXPORT, never in a
|
|
94
|
-
back channel to a running application.
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## 4. Recipes
|
|
99
|
-
|
|
100
|
-
The other half is bringing things INTO a native application — as a **recipe**.
|
|
101
|
-
|
|
102
|
-
A recipe reads something of the project (an IFC, a Rhino layer, a `.frag`, anything the platform
|
|
103
|
-
holds) and returns the changes that make the target model match it: adds, edits and removals, in
|
|
104
|
-
the target application's own vocabulary. Three things define it:
|
|
105
|
-
|
|
106
|
-
**It is chosen and applied from inside the application that receives it.** In Revit: **That Open >
|
|
107
|
-
Select recipe** (the recipe, its source document from a list, its settings) and **That Open > Apply
|
|
108
|
-
recipe**. The plugin runs the recipe and writes its changes at once, in **one** Revit transaction:
|
|
109
|
-
Ctrl+Z undoes it whole, and closing without saving or going back in the history reverts it like any
|
|
110
|
-
other edit. Nothing is queued, uploaded or waiting for anybody.
|
|
111
|
-
|
|
112
|
-
**It remembers what it made.** Applying again writes only what changed in the source since the last
|
|
113
|
-
apply; with no change it says "Nothing imported". What each recipe made is kept in the model's own
|
|
114
|
-
That Open data on the platform (`revitflow_recipes.json`, next to its history).
|
|
115
|
-
|
|
116
|
-
**It addresses published data.** Its changes are a patch over the fields an application already
|
|
117
|
-
publishes, in the terms that application already uses.
|
|
118
|
-
|
|
119
|
-
### Why the person in the application applies it
|
|
120
|
-
|
|
121
|
-
Nobody writes into somebody else's model, and that is settled by where the recipe runs rather than
|
|
122
|
-
by any request travelling between people. The person who applies a
|
|
123
|
-
recipe is the person working in that model, in that application, with its undo, its worksets and
|
|
124
|
-
its sync — so the change is theirs from the first moment, and an ordinary edit of their model.
|
|
125
|
-
|
|
126
|
-
When they sync, the commit says where the change came from: `kind: "recipe"` and an `origin` naming
|
|
127
|
-
the recipe, its version, a title, and the exact source document and version it read. The platform's
|
|
128
|
-
history panel shows such commits with a recipe mark and that title («IFC to Revit: 6 level(s), 47
|
|
129
|
-
wall(s)…», «from racbasicsampleproject.ifc v1»).
|
|
130
|
-
|
|
131
|
-
Built-in recipes ship in `@thatopen/services` (`ifc-to-revit`, `frag-to-revit`, `rhino-to-revit`)
|
|
132
|
-
and are always available; a project can add its own, usually written by a person with an AI
|
|
133
|
-
starting from a built-in:
|
|
134
|
-
[Writing a recipe](https://raw.githubusercontent.com/ThatOpen/platform_services/main/docs/recipes-guide.md).
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
## 5. Two layers, in this order
|
|
139
|
-
|
|
140
|
-
```
|
|
141
|
-
interoperability recipes, applied in the native tool by whoever works there
|
|
142
|
-
─────────────────────────
|
|
143
|
-
collaboration who owns what, and what counts as a commit
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
**Collaboration comes first.** It answers two questions for a file: who may change what, and what a
|
|
147
|
-
change becomes once made.
|
|
148
|
-
|
|
149
|
-
**Interoperability sits on top.** A recipe's changes are applied by somebody in the native tool,
|
|
150
|
-
and that is an ordinary change: it takes the same locks, respects the same ownership, and produces a
|
|
151
|
-
normal commit — one marked as a recipe's.
|
|
152
|
-
|
|
153
|
-
That ordering is why interoperability needed almost no new machinery. It borrows the layer below
|
|
154
|
-
rather than building a parallel one.
|
|
155
|
-
|
|
156
|
-
> **Writing a recipe requires nothing but the platform. Applying one requires being a participant
|
|
157
|
-
> in that file's collaboration layer.**
|
|
158
|
-
|
|
159
|
-
| Direction | What a tool must implement |
|
|
160
|
-
|---|---|
|
|
161
|
-
| Something → tool (bring it in) | Run a recipe and apply the changes it returns. Nothing else. |
|
|
162
|
-
| Tool → everyone (be a source) | Publish its own data. Nothing else. |
|
|
163
|
-
| Model → tool (see the result) | Read a `.frag`. Nothing else. |
|
|
164
|
-
| Tool → tool (edit what it receives) | A full collaboration layer for that tool. |
|
|
165
|
-
|
|
166
|
-
Most integrations are the first three rows, and none raises a single question about ownership or
|
|
167
|
-
merging.
|
|
168
|
-
|
|
169
|
-
What a recipe can actually ask for is a separate and longer question, and an open one: host
|
|
170
|
-
resolution, shared coordinates, type versus instance parameters, orientation, free NURBS and breps,
|
|
171
|
-
family authoring. The rule for all of it is the part that is settled: a change that cannot be
|
|
172
|
-
honoured is **refused with a reason, never approximated**. A plugin author meeting one of these will
|
|
173
|
-
get a refusal naming it rather than a silently wrong element.
|
|
174
|
-
|
|
175
|
-
---
|
|
176
|
-
|
|
177
|
-
## 6. A plugin knows only its own application
|
|
178
|
-
|
|
179
|
-
> **No plugin ever mentions another application. It publishes its own data raw, and reads a
|
|
180
|
-
> `.frag`. Everything that translates between two applications lives in the platform.**
|
|
181
|
-
|
|
182
|
-
The Revit plugin has no idea Rhino exists: it receives verbs over the Revit data it already
|
|
183
|
-
publishes. The Rhino plugin must have no idea Revit exists either — it exports what Rhino has, as
|
|
184
|
-
Rhino has it, and stops. The thing that reads a Rhino model and says what it means in a Revit one is
|
|
185
|
-
a third thing — a recipe — and it lives in the platform: built into `@thatopen/services`, or saved
|
|
186
|
-
in the project. The Revit plugin runs it and applies what it returns, without knowing what it read.
|
|
187
|
-
|
|
188
|
-
The reason is arithmetic. Put translation in the plugins and every new tool has to learn about every
|
|
189
|
-
existing one: N tools, N² translators, each needing an update when either end changes. Put it in the
|
|
190
|
-
platform and a new tool implements two things that mention nobody — "publish my data" and "read a
|
|
191
|
-
`.frag`" — while translators are written per pair, by whoever needs that pair, without touching
|
|
192
|
-
either plugin.
|
|
193
|
-
|
|
194
|
-
So the shape of the whole system is: **plugins export and import their own application's data,
|
|
195
|
-
deterministically, and nothing else. The platform is where the glue lives.**
|
|
196
|
-
|
|
197
|
-
### Which is why the change format knows nothing either
|
|
198
|
-
|
|
199
|
-
What a recipe returns is a set of changes over data an application already publishes, so it says
|
|
200
|
-
three things and no more: **what kind of change, which item, which fields.**
|
|
201
|
-
|
|
202
|
-
```
|
|
203
|
-
add no id yet, attributes describe it, transform says where it goes
|
|
204
|
-
set names an item by its published id, writes the attributes given
|
|
205
|
-
remove names an item by its published id
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
The field names are not ours. `Family`, `Type`, `CategoryId` are what Revit calls its own fields in
|
|
209
|
-
what Revit publishes, and a translator copies them without needing to know what any of them mean.
|
|
210
|
-
The plugin that receives them is the only thing that does.
|
|
211
|
-
|
|
212
|
-
This was got wrong once and is easy to get wrong again. The first version defined `flow:family`,
|
|
213
|
-
`flow:type`, `flow:categoryId` and friends in the shared protocol, as though a family and a type
|
|
214
|
-
were concepts of the interoperability layer. They are not, and putting them there taught the
|
|
215
|
-
protocol about one application, which is what this whole section exists to prevent.
|
|
216
|
-
|
|
217
|
-
What IS reserved is the `flow:` **namespace**, and an applier skips all of it rather than the names
|
|
218
|
-
it happens to know — so an author can record something for its own later use without the applier
|
|
219
|
-
being taught what it means, and without it being mistaken for a parameter of the thing being
|
|
220
|
-
changed. Today that namespace holds `flow:op` (the verb), `flow:source` (where the change came
|
|
221
|
-
from, in the recipe's own terms) and `flow:print` (a fingerprint of what was asked for, so the next
|
|
222
|
-
apply can tell an unchanged source from a changed one).
|
|
223
|
-
|
|
224
|
-
Identity is the item's guid and placement is the item's transform, both of which the `.frag` already
|
|
225
|
-
carries. Nothing addresses anything by position: an item is named by its id or not at all. That is
|
|
226
|
-
not a convention to be careful about, it is the only thing the format can express, which is why a
|
|
227
|
-
re-exported model can never make a change point somewhere else.
|
|
228
|
-
|
|
229
|
-
---
|
|
230
|
-
|
|
231
|
-
## 7. No element is ever tied to another element
|
|
232
|
-
|
|
233
|
-
The rule most likely to be undone by accident:
|
|
234
|
-
|
|
235
|
-
> **A recipe's changes are generic changes over a model. They never establish a shared identity
|
|
236
|
-
> between an element in one application and an element in another — not 1:1, not N:N, not at all.**
|
|
237
|
-
|
|
238
|
-
Each application owns its ids and nothing else knows what they mean. A Revit `UniqueId` identifies
|
|
239
|
-
something in that Revit model. A Rhino object GUID identifies something in that `.3dm`. Neither is
|
|
240
|
-
ever translated into the other, and nothing is ever written into the source.
|
|
241
|
-
|
|
242
|
-
What IS recorded is much weaker, deliberately: **a recipe's own memory of what it made in one
|
|
243
|
-
model.** Every `add` carries a `source` key in the recipe's own terms (the source file's id plus
|
|
244
|
-
the thing's own id there), and when the plugin applies the changes it keeps, for that recipe in
|
|
245
|
-
that model, which key became which native id, with the fingerprint (`flow:print`) of what was asked
|
|
246
|
-
for. It lives in the target model's own That Open data (`revitflow_recipes.json`, next to its
|
|
247
|
-
history), and the plugin hands it back to the recipe on the next run as `made`, filtered to what
|
|
248
|
-
still exists in the model.
|
|
249
|
-
|
|
250
|
-
That is the whole mechanism by which a recipe knows which of the things it created is which. It is
|
|
251
|
-
the recipe's bookkeeping in the model it writes, not a property of either element.
|
|
252
|
-
|
|
253
|
-
### Why this is enough
|
|
254
|
-
|
|
255
|
-
Because it answers one question only — "what did THIS recipe make HERE?" — and that is all a
|
|
256
|
-
re-apply needs: an unchanged print writes nothing, a changed one is made again, a source key that is
|
|
257
|
-
gone is removed. Only what the recipe made is ever removed, never anything a person drew.
|
|
258
|
-
|
|
259
|
-
So a round trip works — create an object in Rhino, apply the recipe in Revit, then modify the same
|
|
260
|
-
object in Rhino and apply again — without either model holding a link to the other. Another recipe
|
|
261
|
-
reading the same source keeps its own record, and knows nothing of this one's.
|
|
262
|
-
|
|
263
|
-
### Why it matters
|
|
264
|
-
|
|
265
|
-
This is where IFC, Speckle and every "BIM interoperability" format before them got into trouble.
|
|
266
|
-
They maintain a canonical cross-application object identity: an entity that claims to be the same
|
|
267
|
-
thing in two tools at once. Something then has to keep it alive forever — synchronise it, reconcile
|
|
268
|
-
it when it drifts, decide what it means when one tool splits that object in two or merges it with
|
|
269
|
-
another. The identity becomes a permanent maintenance surface, and it is the part that rots.
|
|
270
|
-
|
|
271
|
-
We do not have that entity, so there is nothing to keep alive.
|
|
272
|
-
|
|
273
|
-
**If a future change starts to look like a cross-application id, a `sourceId` field on an element,
|
|
274
|
-
a mapping shared between recipes or models, or a "link" between two models: that is this rule being
|
|
275
|
-
undone.** The question to ask is which application's problem it is really solving, and whether it
|
|
276
|
-
can live in that application instead — the way a recipe's memory lives in the one model it writes.
|
|
277
|
-
|
|
278
|
-
---
|
|
279
|
-
|
|
280
|
-
## 8. Revit: lean on the native system, do not rebuild it
|
|
281
|
-
|
|
282
|
-
Revit already has worksharing, and it is good. The temptation is to build a collaboration layer on
|
|
283
|
-
top of it, because our central is not a live shared file and the native mechanisms therefore do not
|
|
284
|
-
reach across machines. The decision is the opposite: **be an efficient copier of a few files, and
|
|
285
|
-
let Revit do the collaborating.** A very fast file transport can be made not to break. A layer of
|
|
286
|
-
our own logic on top of a partial API breaks in the cases nobody thought of.
|
|
287
|
-
|
|
288
|
-
What made that decision possible is a set of measurements rather than an opinion. Revit stores
|
|
289
|
-
worksharing ownership in small files NEXT TO the central, never inside the `.rvt`:
|
|
290
|
-
|
|
291
|
-
| what happens | what Revit writes to the central, immediately |
|
|
292
|
-
|---|---|
|
|
293
|
-
| somebody takes a workset | `worksetperms.dat` |
|
|
294
|
-
| somebody borrows elements by editing them | `editingperms.dat`, `editingdeltas.dat` |
|
|
295
|
-
| somebody edits what they already hold | nothing |
|
|
296
|
-
| somebody saves their local | nothing |
|
|
297
|
-
|
|
298
|
-
The `.rvt` is never touched by any of it. So **replicating ownership does not move the model**, which
|
|
299
|
-
was the objection that would otherwise have killed the idea: nobody's geometry changes under their
|
|
300
|
-
feet.
|
|
301
|
-
|
|
302
|
-
Three more facts decide the design:
|
|
303
|
-
|
|
304
|
-
- **Revit re-reads those files.** Overwrite them behind a running Revit and it reports the new
|
|
305
|
-
ownership within two to three seconds, with no reload and nothing asked of it. It polls the
|
|
306
|
-
central every five to eight seconds on its own; the read locks are visible in the worksharing log.
|
|
307
|
-
- **A borrow is a two-byte write.** `editingperms.dat` is a table of 32-byte records, one per
|
|
308
|
-
element, holding a two-byte owner field: `ffff` for free, otherwise an index into `users.dat`.
|
|
309
|
-
Borrowing 208 elements changed exactly 208 two-byte cells and nothing else — no header, no
|
|
310
|
-
counter, no checksum. Which is what makes a three-way merge of two clients' files correct rather
|
|
311
|
-
than reckless: different elements are different cells, and the only cells both sides can touch are
|
|
312
|
-
the ones where they genuinely both claimed the same element.
|
|
313
|
-
- **The whole ownership state is 35 KB compressed**, so it needs no clever transport. It also must
|
|
314
|
-
not go through the block store, which would mint a model version per borrow.
|
|
315
|
-
|
|
316
|
-
So the shape is: a file watcher publishes ownership when it changes, everyone else pulls and merges
|
|
317
|
-
it, and Revit believes what it reads. The platform's own registry stays as the ARBITER for the few
|
|
318
|
-
seconds before a replicated file arrives, because that race cannot be closed by transport alone.
|
|
319
|
-
|
|
320
|
-
**What still has to be our own, and why.** Revit publishes ownership; it does not publish INTENT.
|
|
321
|
-
There is no event for taking a workset, none for borrowing an element, and no API to relinquish on
|
|
322
|
-
somebody else's behalf (`RelinquishOwnership` takes a document and no user; `Application.Username`
|
|
323
|
-
is read-only). So a claim cannot be vetoed before it happens, only observed after — which is why the
|
|
324
|
-
platform registry exists, why arbitration is after the fact, and why a conflict is resolved by
|
|
325
|
-
telling somebody rather than by preventing them.
|
|
326
|
-
|
|
327
|
-
**What we must not let happen, and how it is now handled.** A native Sync With Central writes to
|
|
328
|
-
that machine's copy of the central and, left alone, tells the platform nothing. If somebody else
|
|
329
|
-
publishes first, the next pull overwrites that copy and the work is gone while their local still
|
|
330
|
-
believes it was published.
|
|
331
|
-
|
|
332
|
-
That is why the add-in sits on both of Revit's sync events rather than beside them with a button of
|
|
333
|
-
its own. `DocumentSynchronizingWithCentral` fires before Revit touches anything: it takes the turn
|
|
334
|
-
in the team queue and brings the central up to date in place, so Revit's own merge runs against the
|
|
335
|
-
team's current file. It is cancellable, and every refusal uses it — elements held by somebody else,
|
|
336
|
-
a pull the guardrail refused, a queue the person gave up on — so a sync that cannot be published
|
|
337
|
-
safely is stopped before Revit writes rather than left half done.
|
|
338
|
-
`DocumentSynchronizedWithCentral` then publishes what was written, and nothing else: no second
|
|
339
|
-
merge, no second SWC.
|
|
340
|
-
|
|
341
|
-
Measured while building it: Revit reports the sync finished while it still holds a file in the
|
|
342
|
-
central's worksharing folder, so the publish retries with a growing wait. And replacing the central
|
|
343
|
-
files from inside the pre-event works with the model open — verified with the central rolled back a
|
|
344
|
-
version underneath a live session: 30 files rebuilt in the event, Revit's merge on top of them.
|
|
345
|
-
|
|
346
|
-
The consequence is that the add-in has no sync button, no take button and no release button. Revit's
|
|
347
|
-
own worksharing UI is the interface, and ownership replication is what makes it true for everybody.
|
|
348
|
-
|
|
349
|
-
## 9. Rhino: deliberately unanswered
|
|
350
|
-
|
|
351
|
-
revit-flow works because Revit already had worksharing. flow arbitrates on top of it; it did not
|
|
352
|
-
have to invent it.
|
|
353
|
-
|
|
354
|
-
Rhino has none of that. A `.3dm` is one file, with no central, no per-object checkout, and no merge.
|
|
355
|
-
So "collaboration in Rhino" is not a thing that exists and gets wired up — it is a thing that would
|
|
356
|
-
have to be designed and written. Which is exactly what section 1 says is allowed: the contract is
|
|
357
|
-
the history, and how a file is collaborated on underneath is open.
|
|
358
|
-
|
|
359
|
-
**We are not answering it yet, on purpose.** Bringing a Rhino model into Revit needs no Rhino
|
|
360
|
-
collaboration layer at all — Rhino publishes, and the Revit user applies `rhino-to-revit` — and Rhino displaying a Revit model needs only a `.frag` reader. The
|
|
361
|
-
question appears when several people want to edit one Rhino model at once, and until somebody
|
|
362
|
-
actually wants that, designing it would be guessing.
|
|
363
|
-
|
|
364
|
-
Two notes from thinking it through, so the thinking is not repeated:
|
|
365
|
-
|
|
366
|
-
- **Ownership granularity is the easy half, and layers are the natural unit.** A Rhino layer is what
|
|
367
|
-
a workset is in Revit: it is how teams already divide work, every object carries one, and the
|
|
368
|
-
exporter already records it. The lock registry needs no change beyond a different key prefix.
|
|
369
|
-
- **Merging is the hard half, and it is the real cost.** Revit reconciles concurrent element edits
|
|
370
|
-
itself. Rhino will not. A central would have to be *reconstructed* by applying per-object deltas
|
|
371
|
-
rather than being a file somebody overwrites — buildable on what already exists (stable object
|
|
372
|
-
GUIDs, regenerable definitions, per-commit deltas), but that is rebuilding worksharing, not
|
|
373
|
-
configuring it.
|
|
374
|
-
|
|
375
|
-
Worth checking before any of it: whether teams actually put several people on one `.3dm` today, or
|
|
376
|
-
divide the work by file. If it is the latter, the merge may never be needed.
|
|
377
|
-
|
|
378
|
-
---
|
|
379
|
-
|
|
380
|
-
## 10. Formats
|
|
381
|
-
|
|
382
|
-
`.frag` is the transport for both layers: models, per-commit deltas, and the changes a recipe
|
|
383
|
-
returns (a geometry-less `.frag`, envelope `revitflow/op@2`). It
|
|
384
|
-
carries stable per-item global ids (Revit `UniqueId`, Rhino object GUID) in its `guids` vector,
|
|
385
|
-
which is what lets anything address an element it did not create.
|
|
386
|
-
|
|
387
|
-
`.3dm` is readable and writable without a Rhino licence, through McNeel's open-source **openNURBS**
|
|
388
|
-
and the **rhino3dm** bindings. That covers the document and its geometry definitions but not the
|
|
389
|
-
Rhino kernel, so a converter can run server-side while real modelling operations still need Rhino.
|
|
390
|
-
|
|
391
|
-
The concrete wire formats — where each file lives on the platform, what the change envelope
|
|
392
|
-
contains, how the sync queue and the ownership registry work — are in
|
|
393
|
-
[the plugin guide](https://raw.githubusercontent.com/ThatOpen/platform_services/main/docs/flow-plugin-guide.md), which is what to read if you are writing a plugin.
|
|
1
|
+
# That Open Flow
|
|
2
|
+
|
|
3
|
+
A modular system for **collaboration, interoperability and automation** on top of That Open
|
|
4
|
+
Platform.
|
|
5
|
+
|
|
6
|
+
> Work the way you want, not the way a format tells you to.
|
|
7
|
+
|
|
8
|
+
Everything below follows from taking that literally. Most systems in this space achieve
|
|
9
|
+
interoperability by agreeing on one data model and asking everybody to move into it. This one does
|
|
10
|
+
the opposite: applications stay sovereign over their own data, and what is shared is a way of
|
|
11
|
+
recording change.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 1. Any file, and each one collaborates its own way
|
|
16
|
+
|
|
17
|
+
The platform holds **native files** — `.rvt`, `.3dm`, whatever an application actually saves.
|
|
18
|
+
Nothing is converted on the way in.
|
|
19
|
+
|
|
20
|
+
Each **file** has its own collaboration system. Note: a file, not a format. Two Rhino models in two
|
|
21
|
+
projects can be collaborated on in two different ways, by the same person, on the same day, because
|
|
22
|
+
what suits a five-person structural team does not suit somebody sketching alone.
|
|
23
|
+
|
|
24
|
+
There is exactly one rule:
|
|
25
|
+
|
|
26
|
+
> **Collaboration is based on a history, and every history follows the same contract.**
|
|
27
|
+
|
|
28
|
+
That is the whole of the shared surface. Everything above it is free.
|
|
29
|
+
|
|
30
|
+
Two consequences, and they are the point of the design:
|
|
31
|
+
|
|
32
|
+
1. **Applications with incompatible needs coexist.** Revit needs a very specific collaboration
|
|
33
|
+
system, because Revit worksharing is a specific thing: a central file, element-level ownership,
|
|
34
|
+
a merge engine. Rhino needs none of that. Neither has to pretend to be the other.
|
|
35
|
+
2. **A project chooses.** Ownership claimed up front, or nothing locked at all, or something in
|
|
36
|
+
between. The history contract does not care which, and the platform reads all of them the same
|
|
37
|
+
way.
|
|
38
|
+
|
|
39
|
+
### The contract
|
|
40
|
+
|
|
41
|
+
A history is a list of commits. Each commit says:
|
|
42
|
+
|
|
43
|
+
| Field | Meaning |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `guid` | What the commit IS. Identity. Never reused. |
|
|
46
|
+
| `parents` | The commits it was built on. Absent on a root. First is the line it continues. |
|
|
47
|
+
| `author`, `timestamp` | Who and when. |
|
|
48
|
+
| `changes` | Which items changed, and how: `create`, `update`, `delete`. |
|
|
49
|
+
| `counts` | Derived totals, so a reader need not walk the changes to summarise. |
|
|
50
|
+
| `version` | Where it landed in the CDE, when there IS such a place. Data, never identity. |
|
|
51
|
+
|
|
52
|
+
Two rules about reading it, and they are what let an application unlike Revit take part at all:
|
|
53
|
+
|
|
54
|
+
- **Order comes from the graph, not from a number.** Follow `parents`; break ties by timestamp.
|
|
55
|
+
Asking "which came first" of an integer forces every application to invent a sequence, and only
|
|
56
|
+
something like Revit's central — which serialises everybody through one line — can honestly
|
|
57
|
+
produce one.
|
|
58
|
+
- **`version` is never a name.** It is where the commit was stored, not what it is. An application
|
|
59
|
+
with no version counter simply omits it.
|
|
60
|
+
|
|
61
|
+
`parents` is a **list** because a history that can only be a line is a different thing from a graph.
|
|
62
|
+
A fork is two commits naming the same parent; a merge is one commit naming two. Revit will never
|
|
63
|
+
write more than one — its central is a single line and it merges inside itself — and the list exists
|
|
64
|
+
precisely for the applications that are not Revit.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 2. What a history buys
|
|
69
|
+
|
|
70
|
+
**Traceability.** Who changed what, when. The history of a single element, across every commit that
|
|
71
|
+
touched it.
|
|
72
|
+
|
|
73
|
+
**Work is not lost.** The platform stores the native files as content-addressed blocks, and blocks
|
|
74
|
+
are only ever added. Every state the model has ever been in is still there, and a commit's map of
|
|
75
|
+
which blocks made up which file is stored with it, so a past state can be rebuilt.
|
|
76
|
+
|
|
77
|
+
**One timeline, or many.** Each file has its own history. The platform can show them together,
|
|
78
|
+
filtered and searched as one.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 3. Native data, out in the open
|
|
83
|
+
|
|
84
|
+
Every application on the platform publishes its data openly: readable **without opening the
|
|
85
|
+
proprietary application**.
|
|
86
|
+
|
|
87
|
+
This is what makes everything in the next section possible. A translator, a script or a model runs
|
|
88
|
+
with Revit closed and Rhino closed; if the only way to know what is in a model were to open the
|
|
89
|
+
application that wrote it, none of it could exist.
|
|
90
|
+
|
|
91
|
+
The constraint that follows is worth stating, because it decides where fixes go: **anything reading
|
|
92
|
+
a model cannot ask its application a question.** Every fact it needs has to be in what that model
|
|
93
|
+
already published. When something turns out to be missing, the fix goes in the EXPORT, never in a
|
|
94
|
+
back channel to a running application.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 4. Recipes
|
|
99
|
+
|
|
100
|
+
The other half is bringing things INTO a native application — as a **recipe**.
|
|
101
|
+
|
|
102
|
+
A recipe reads something of the project (an IFC, a Rhino layer, a `.frag`, anything the platform
|
|
103
|
+
holds) and returns the changes that make the target model match it: adds, edits and removals, in
|
|
104
|
+
the target application's own vocabulary. Three things define it:
|
|
105
|
+
|
|
106
|
+
**It is chosen and applied from inside the application that receives it.** In Revit: **That Open >
|
|
107
|
+
Select recipe** (the recipe, its source document from a list, its settings) and **That Open > Apply
|
|
108
|
+
recipe**. The plugin runs the recipe and writes its changes at once, in **one** Revit transaction:
|
|
109
|
+
Ctrl+Z undoes it whole, and closing without saving or going back in the history reverts it like any
|
|
110
|
+
other edit. Nothing is queued, uploaded or waiting for anybody.
|
|
111
|
+
|
|
112
|
+
**It remembers what it made.** Applying again writes only what changed in the source since the last
|
|
113
|
+
apply; with no change it says "Nothing imported". What each recipe made is kept in the model's own
|
|
114
|
+
That Open data on the platform (`revitflow_recipes.json`, next to its history).
|
|
115
|
+
|
|
116
|
+
**It addresses published data.** Its changes are a patch over the fields an application already
|
|
117
|
+
publishes, in the terms that application already uses.
|
|
118
|
+
|
|
119
|
+
### Why the person in the application applies it
|
|
120
|
+
|
|
121
|
+
Nobody writes into somebody else's model, and that is settled by where the recipe runs rather than
|
|
122
|
+
by any request travelling between people. The person who applies a
|
|
123
|
+
recipe is the person working in that model, in that application, with its undo, its worksets and
|
|
124
|
+
its sync — so the change is theirs from the first moment, and an ordinary edit of their model.
|
|
125
|
+
|
|
126
|
+
When they sync, the commit says where the change came from: `kind: "recipe"` and an `origin` naming
|
|
127
|
+
the recipe, its version, a title, and the exact source document and version it read. The platform's
|
|
128
|
+
history panel shows such commits with a recipe mark and that title («IFC to Revit: 6 level(s), 47
|
|
129
|
+
wall(s)…», «from racbasicsampleproject.ifc v1»).
|
|
130
|
+
|
|
131
|
+
Built-in recipes ship in `@thatopen/services` (`ifc-to-revit`, `frag-to-revit`, `rhino-to-revit`)
|
|
132
|
+
and are always available; a project can add its own, usually written by a person with an AI
|
|
133
|
+
starting from a built-in:
|
|
134
|
+
[Writing a recipe](https://raw.githubusercontent.com/ThatOpen/platform_services/main/docs/recipes-guide.md).
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## 5. Two layers, in this order
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
interoperability recipes, applied in the native tool by whoever works there
|
|
142
|
+
─────────────────────────
|
|
143
|
+
collaboration who owns what, and what counts as a commit
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Collaboration comes first.** It answers two questions for a file: who may change what, and what a
|
|
147
|
+
change becomes once made.
|
|
148
|
+
|
|
149
|
+
**Interoperability sits on top.** A recipe's changes are applied by somebody in the native tool,
|
|
150
|
+
and that is an ordinary change: it takes the same locks, respects the same ownership, and produces a
|
|
151
|
+
normal commit — one marked as a recipe's.
|
|
152
|
+
|
|
153
|
+
That ordering is why interoperability needed almost no new machinery. It borrows the layer below
|
|
154
|
+
rather than building a parallel one.
|
|
155
|
+
|
|
156
|
+
> **Writing a recipe requires nothing but the platform. Applying one requires being a participant
|
|
157
|
+
> in that file's collaboration layer.**
|
|
158
|
+
|
|
159
|
+
| Direction | What a tool must implement |
|
|
160
|
+
|---|---|
|
|
161
|
+
| Something → tool (bring it in) | Run a recipe and apply the changes it returns. Nothing else. |
|
|
162
|
+
| Tool → everyone (be a source) | Publish its own data. Nothing else. |
|
|
163
|
+
| Model → tool (see the result) | Read a `.frag`. Nothing else. |
|
|
164
|
+
| Tool → tool (edit what it receives) | A full collaboration layer for that tool. |
|
|
165
|
+
|
|
166
|
+
Most integrations are the first three rows, and none raises a single question about ownership or
|
|
167
|
+
merging.
|
|
168
|
+
|
|
169
|
+
What a recipe can actually ask for is a separate and longer question, and an open one: host
|
|
170
|
+
resolution, shared coordinates, type versus instance parameters, orientation, free NURBS and breps,
|
|
171
|
+
family authoring. The rule for all of it is the part that is settled: a change that cannot be
|
|
172
|
+
honoured is **refused with a reason, never approximated**. A plugin author meeting one of these will
|
|
173
|
+
get a refusal naming it rather than a silently wrong element.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## 6. A plugin knows only its own application
|
|
178
|
+
|
|
179
|
+
> **No plugin ever mentions another application. It publishes its own data raw, and reads a
|
|
180
|
+
> `.frag`. Everything that translates between two applications lives in the platform.**
|
|
181
|
+
|
|
182
|
+
The Revit plugin has no idea Rhino exists: it receives verbs over the Revit data it already
|
|
183
|
+
publishes. The Rhino plugin must have no idea Revit exists either — it exports what Rhino has, as
|
|
184
|
+
Rhino has it, and stops. The thing that reads a Rhino model and says what it means in a Revit one is
|
|
185
|
+
a third thing — a recipe — and it lives in the platform: built into `@thatopen/services`, or saved
|
|
186
|
+
in the project. The Revit plugin runs it and applies what it returns, without knowing what it read.
|
|
187
|
+
|
|
188
|
+
The reason is arithmetic. Put translation in the plugins and every new tool has to learn about every
|
|
189
|
+
existing one: N tools, N² translators, each needing an update when either end changes. Put it in the
|
|
190
|
+
platform and a new tool implements two things that mention nobody — "publish my data" and "read a
|
|
191
|
+
`.frag`" — while translators are written per pair, by whoever needs that pair, without touching
|
|
192
|
+
either plugin.
|
|
193
|
+
|
|
194
|
+
So the shape of the whole system is: **plugins export and import their own application's data,
|
|
195
|
+
deterministically, and nothing else. The platform is where the glue lives.**
|
|
196
|
+
|
|
197
|
+
### Which is why the change format knows nothing either
|
|
198
|
+
|
|
199
|
+
What a recipe returns is a set of changes over data an application already publishes, so it says
|
|
200
|
+
three things and no more: **what kind of change, which item, which fields.**
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
add no id yet, attributes describe it, transform says where it goes
|
|
204
|
+
set names an item by its published id, writes the attributes given
|
|
205
|
+
remove names an item by its published id
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
The field names are not ours. `Family`, `Type`, `CategoryId` are what Revit calls its own fields in
|
|
209
|
+
what Revit publishes, and a translator copies them without needing to know what any of them mean.
|
|
210
|
+
The plugin that receives them is the only thing that does.
|
|
211
|
+
|
|
212
|
+
This was got wrong once and is easy to get wrong again. The first version defined `flow:family`,
|
|
213
|
+
`flow:type`, `flow:categoryId` and friends in the shared protocol, as though a family and a type
|
|
214
|
+
were concepts of the interoperability layer. They are not, and putting them there taught the
|
|
215
|
+
protocol about one application, which is what this whole section exists to prevent.
|
|
216
|
+
|
|
217
|
+
What IS reserved is the `flow:` **namespace**, and an applier skips all of it rather than the names
|
|
218
|
+
it happens to know — so an author can record something for its own later use without the applier
|
|
219
|
+
being taught what it means, and without it being mistaken for a parameter of the thing being
|
|
220
|
+
changed. Today that namespace holds `flow:op` (the verb), `flow:source` (where the change came
|
|
221
|
+
from, in the recipe's own terms) and `flow:print` (a fingerprint of what was asked for, so the next
|
|
222
|
+
apply can tell an unchanged source from a changed one).
|
|
223
|
+
|
|
224
|
+
Identity is the item's guid and placement is the item's transform, both of which the `.frag` already
|
|
225
|
+
carries. Nothing addresses anything by position: an item is named by its id or not at all. That is
|
|
226
|
+
not a convention to be careful about, it is the only thing the format can express, which is why a
|
|
227
|
+
re-exported model can never make a change point somewhere else.
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## 7. No element is ever tied to another element
|
|
232
|
+
|
|
233
|
+
The rule most likely to be undone by accident:
|
|
234
|
+
|
|
235
|
+
> **A recipe's changes are generic changes over a model. They never establish a shared identity
|
|
236
|
+
> between an element in one application and an element in another — not 1:1, not N:N, not at all.**
|
|
237
|
+
|
|
238
|
+
Each application owns its ids and nothing else knows what they mean. A Revit `UniqueId` identifies
|
|
239
|
+
something in that Revit model. A Rhino object GUID identifies something in that `.3dm`. Neither is
|
|
240
|
+
ever translated into the other, and nothing is ever written into the source.
|
|
241
|
+
|
|
242
|
+
What IS recorded is much weaker, deliberately: **a recipe's own memory of what it made in one
|
|
243
|
+
model.** Every `add` carries a `source` key in the recipe's own terms (the source file's id plus
|
|
244
|
+
the thing's own id there), and when the plugin applies the changes it keeps, for that recipe in
|
|
245
|
+
that model, which key became which native id, with the fingerprint (`flow:print`) of what was asked
|
|
246
|
+
for. It lives in the target model's own That Open data (`revitflow_recipes.json`, next to its
|
|
247
|
+
history), and the plugin hands it back to the recipe on the next run as `made`, filtered to what
|
|
248
|
+
still exists in the model.
|
|
249
|
+
|
|
250
|
+
That is the whole mechanism by which a recipe knows which of the things it created is which. It is
|
|
251
|
+
the recipe's bookkeeping in the model it writes, not a property of either element.
|
|
252
|
+
|
|
253
|
+
### Why this is enough
|
|
254
|
+
|
|
255
|
+
Because it answers one question only — "what did THIS recipe make HERE?" — and that is all a
|
|
256
|
+
re-apply needs: an unchanged print writes nothing, a changed one is made again, a source key that is
|
|
257
|
+
gone is removed. Only what the recipe made is ever removed, never anything a person drew.
|
|
258
|
+
|
|
259
|
+
So a round trip works — create an object in Rhino, apply the recipe in Revit, then modify the same
|
|
260
|
+
object in Rhino and apply again — without either model holding a link to the other. Another recipe
|
|
261
|
+
reading the same source keeps its own record, and knows nothing of this one's.
|
|
262
|
+
|
|
263
|
+
### Why it matters
|
|
264
|
+
|
|
265
|
+
This is where IFC, Speckle and every "BIM interoperability" format before them got into trouble.
|
|
266
|
+
They maintain a canonical cross-application object identity: an entity that claims to be the same
|
|
267
|
+
thing in two tools at once. Something then has to keep it alive forever — synchronise it, reconcile
|
|
268
|
+
it when it drifts, decide what it means when one tool splits that object in two or merges it with
|
|
269
|
+
another. The identity becomes a permanent maintenance surface, and it is the part that rots.
|
|
270
|
+
|
|
271
|
+
We do not have that entity, so there is nothing to keep alive.
|
|
272
|
+
|
|
273
|
+
**If a future change starts to look like a cross-application id, a `sourceId` field on an element,
|
|
274
|
+
a mapping shared between recipes or models, or a "link" between two models: that is this rule being
|
|
275
|
+
undone.** The question to ask is which application's problem it is really solving, and whether it
|
|
276
|
+
can live in that application instead — the way a recipe's memory lives in the one model it writes.
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## 8. Revit: lean on the native system, do not rebuild it
|
|
281
|
+
|
|
282
|
+
Revit already has worksharing, and it is good. The temptation is to build a collaboration layer on
|
|
283
|
+
top of it, because our central is not a live shared file and the native mechanisms therefore do not
|
|
284
|
+
reach across machines. The decision is the opposite: **be an efficient copier of a few files, and
|
|
285
|
+
let Revit do the collaborating.** A very fast file transport can be made not to break. A layer of
|
|
286
|
+
our own logic on top of a partial API breaks in the cases nobody thought of.
|
|
287
|
+
|
|
288
|
+
What made that decision possible is a set of measurements rather than an opinion. Revit stores
|
|
289
|
+
worksharing ownership in small files NEXT TO the central, never inside the `.rvt`:
|
|
290
|
+
|
|
291
|
+
| what happens | what Revit writes to the central, immediately |
|
|
292
|
+
|---|---|
|
|
293
|
+
| somebody takes a workset | `worksetperms.dat` |
|
|
294
|
+
| somebody borrows elements by editing them | `editingperms.dat`, `editingdeltas.dat` |
|
|
295
|
+
| somebody edits what they already hold | nothing |
|
|
296
|
+
| somebody saves their local | nothing |
|
|
297
|
+
|
|
298
|
+
The `.rvt` is never touched by any of it. So **replicating ownership does not move the model**, which
|
|
299
|
+
was the objection that would otherwise have killed the idea: nobody's geometry changes under their
|
|
300
|
+
feet.
|
|
301
|
+
|
|
302
|
+
Three more facts decide the design:
|
|
303
|
+
|
|
304
|
+
- **Revit re-reads those files.** Overwrite them behind a running Revit and it reports the new
|
|
305
|
+
ownership within two to three seconds, with no reload and nothing asked of it. It polls the
|
|
306
|
+
central every five to eight seconds on its own; the read locks are visible in the worksharing log.
|
|
307
|
+
- **A borrow is a two-byte write.** `editingperms.dat` is a table of 32-byte records, one per
|
|
308
|
+
element, holding a two-byte owner field: `ffff` for free, otherwise an index into `users.dat`.
|
|
309
|
+
Borrowing 208 elements changed exactly 208 two-byte cells and nothing else — no header, no
|
|
310
|
+
counter, no checksum. Which is what makes a three-way merge of two clients' files correct rather
|
|
311
|
+
than reckless: different elements are different cells, and the only cells both sides can touch are
|
|
312
|
+
the ones where they genuinely both claimed the same element.
|
|
313
|
+
- **The whole ownership state is 35 KB compressed**, so it needs no clever transport. It also must
|
|
314
|
+
not go through the block store, which would mint a model version per borrow.
|
|
315
|
+
|
|
316
|
+
So the shape is: a file watcher publishes ownership when it changes, everyone else pulls and merges
|
|
317
|
+
it, and Revit believes what it reads. The platform's own registry stays as the ARBITER for the few
|
|
318
|
+
seconds before a replicated file arrives, because that race cannot be closed by transport alone.
|
|
319
|
+
|
|
320
|
+
**What still has to be our own, and why.** Revit publishes ownership; it does not publish INTENT.
|
|
321
|
+
There is no event for taking a workset, none for borrowing an element, and no API to relinquish on
|
|
322
|
+
somebody else's behalf (`RelinquishOwnership` takes a document and no user; `Application.Username`
|
|
323
|
+
is read-only). So a claim cannot be vetoed before it happens, only observed after — which is why the
|
|
324
|
+
platform registry exists, why arbitration is after the fact, and why a conflict is resolved by
|
|
325
|
+
telling somebody rather than by preventing them.
|
|
326
|
+
|
|
327
|
+
**What we must not let happen, and how it is now handled.** A native Sync With Central writes to
|
|
328
|
+
that machine's copy of the central and, left alone, tells the platform nothing. If somebody else
|
|
329
|
+
publishes first, the next pull overwrites that copy and the work is gone while their local still
|
|
330
|
+
believes it was published.
|
|
331
|
+
|
|
332
|
+
That is why the add-in sits on both of Revit's sync events rather than beside them with a button of
|
|
333
|
+
its own. `DocumentSynchronizingWithCentral` fires before Revit touches anything: it takes the turn
|
|
334
|
+
in the team queue and brings the central up to date in place, so Revit's own merge runs against the
|
|
335
|
+
team's current file. It is cancellable, and every refusal uses it — elements held by somebody else,
|
|
336
|
+
a pull the guardrail refused, a queue the person gave up on — so a sync that cannot be published
|
|
337
|
+
safely is stopped before Revit writes rather than left half done.
|
|
338
|
+
`DocumentSynchronizedWithCentral` then publishes what was written, and nothing else: no second
|
|
339
|
+
merge, no second SWC.
|
|
340
|
+
|
|
341
|
+
Measured while building it: Revit reports the sync finished while it still holds a file in the
|
|
342
|
+
central's worksharing folder, so the publish retries with a growing wait. And replacing the central
|
|
343
|
+
files from inside the pre-event works with the model open — verified with the central rolled back a
|
|
344
|
+
version underneath a live session: 30 files rebuilt in the event, Revit's merge on top of them.
|
|
345
|
+
|
|
346
|
+
The consequence is that the add-in has no sync button, no take button and no release button. Revit's
|
|
347
|
+
own worksharing UI is the interface, and ownership replication is what makes it true for everybody.
|
|
348
|
+
|
|
349
|
+
## 9. Rhino: deliberately unanswered
|
|
350
|
+
|
|
351
|
+
revit-flow works because Revit already had worksharing. flow arbitrates on top of it; it did not
|
|
352
|
+
have to invent it.
|
|
353
|
+
|
|
354
|
+
Rhino has none of that. A `.3dm` is one file, with no central, no per-object checkout, and no merge.
|
|
355
|
+
So "collaboration in Rhino" is not a thing that exists and gets wired up — it is a thing that would
|
|
356
|
+
have to be designed and written. Which is exactly what section 1 says is allowed: the contract is
|
|
357
|
+
the history, and how a file is collaborated on underneath is open.
|
|
358
|
+
|
|
359
|
+
**We are not answering it yet, on purpose.** Bringing a Rhino model into Revit needs no Rhino
|
|
360
|
+
collaboration layer at all — Rhino publishes, and the Revit user applies `rhino-to-revit` — and Rhino displaying a Revit model needs only a `.frag` reader. The
|
|
361
|
+
question appears when several people want to edit one Rhino model at once, and until somebody
|
|
362
|
+
actually wants that, designing it would be guessing.
|
|
363
|
+
|
|
364
|
+
Two notes from thinking it through, so the thinking is not repeated:
|
|
365
|
+
|
|
366
|
+
- **Ownership granularity is the easy half, and layers are the natural unit.** A Rhino layer is what
|
|
367
|
+
a workset is in Revit: it is how teams already divide work, every object carries one, and the
|
|
368
|
+
exporter already records it. The lock registry needs no change beyond a different key prefix.
|
|
369
|
+
- **Merging is the hard half, and it is the real cost.** Revit reconciles concurrent element edits
|
|
370
|
+
itself. Rhino will not. A central would have to be *reconstructed* by applying per-object deltas
|
|
371
|
+
rather than being a file somebody overwrites — buildable on what already exists (stable object
|
|
372
|
+
GUIDs, regenerable definitions, per-commit deltas), but that is rebuilding worksharing, not
|
|
373
|
+
configuring it.
|
|
374
|
+
|
|
375
|
+
Worth checking before any of it: whether teams actually put several people on one `.3dm` today, or
|
|
376
|
+
divide the work by file. If it is the latter, the merge may never be needed.
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
## 10. Formats
|
|
381
|
+
|
|
382
|
+
`.frag` is the transport for both layers: models, per-commit deltas, and the changes a recipe
|
|
383
|
+
returns (a geometry-less `.frag`, envelope `revitflow/op@2`). It
|
|
384
|
+
carries stable per-item global ids (Revit `UniqueId`, Rhino object GUID) in its `guids` vector,
|
|
385
|
+
which is what lets anything address an element it did not create.
|
|
386
|
+
|
|
387
|
+
`.3dm` is readable and writable without a Rhino licence, through McNeel's open-source **openNURBS**
|
|
388
|
+
and the **rhino3dm** bindings. That covers the document and its geometry definitions but not the
|
|
389
|
+
Rhino kernel, so a converter can run server-side while real modelling operations still need Rhino.
|
|
390
|
+
|
|
391
|
+
The concrete wire formats — where each file lives on the platform, what the change envelope
|
|
392
|
+
contains, how the sync queue and the ownership registry work — are in
|
|
393
|
+
[the plugin guide](https://raw.githubusercontent.com/ThatOpen/platform_services/main/docs/flow-plugin-guide.md), which is what to read if you are writing a plugin.
|