Expand description
Scripts in the CAD app: the CAD host for the PLM’s interpreter core (S11).
Scripts in the CAD app: the CAD-side host for the interpreter the PLM’s
administrator hooks run on (BREP_script_core, plm-cad-integration-todo
§3 S11).
The core evaluates one file and calls one global function with one JSON argument; this module decides what a script running inside the CAD app can reach. Today that is:
| Global | What it is |
|---|---|
console.log / info / warn / error | lines kept with the outcome (the core’s own binding) |
cad.version | this app’s version |
cad.store | "file" natively, "browser" in the wasm build |
cad.plm | false: no PLM is connected |
ui.notify(text) | a message for the user, kept with the outcome for the host to show |
There are NO plm.* bindings yet. They arrive with the PLM transport (S1),
and every one of them will need a signed-in session; PLM_BINDINGS names
them so a script can be told which of its calls need a server. Until then a
script that reaches for plm finds it undefined, which is also exactly
what it finds with no server connected — the file-only case is the only
case, and it runs the same natively and in the browser.
Structs§
- Failure
- A call that threw, failed to parse, or named a function the file does not
define.
messageis what a person reads: forthrow new Error("x")it isx, forthrow "x"it isx. - Outcome
- A finished call: the core’s result plus what the script asked the UI to show.
- Success
- A call that returned.
Constants§
- PLM_
BINDINGS - The
plm.*bindings a CAD script can call, each needing a connected PLM. Empty until S1 lands the transport.
Functions§
- call
- Evaluate
source(namedfilein messages) with the CAD host installed, then call its globalfunctionwithinput. - store_
kind - Where the app keeps its documents, as
cad.storereports it.