3D Tools
Tool-by-tool examples for controlling 3D model behavior from the host application.
3D tools are sent as direct canvas messages. The command is the message `type`, and the payload contains the tool state.
Use `requestId` on every command. The canvas returns a result event with the same request id when the command completes.
- Send `type: "set3DTransparency"`, not `type: "toolControl"`.
- Use `enabled: true` to activate a toggle tool.
- Use `enabled: false` to deactivate a toggle tool.
- Listen for the matching `...Result` event before treating the host UI state as confirmed.
Use `reset3DModel` to restore the model to its default 3D state. This is a one-shot command, so it does not need `enabled`.
Send reset3DModel
Expected result
Use `set3DSelect` when the host needs the user to select model parts. Add `emitSelectionEvents: true` to receive part selection events.
Enable part selection
Listen for selected parts
Use walkthrough for model navigation mode. Use hide-parts mode when the user needs to select and hide parts from the model view.
Enable walkthrough
Enable hide-parts mode
Use `set3DExplode` to separate model parts visually. Send `distance` from 0 to 100. In the built-in UI, explode and transparency are treated as conflicting visual modes.
Set explode distance
Use `set3DTransparency` to make model parts transparent. Send `valuePercent` from 0 to 100.
- `0` means no transparency effect.
- `100` means maximum transparency effect.
Set model transparency
Use `set3DCrossSection` to clip the model along the X, Y, and Z axes. Send `x`, `y`, and `z` values from 0 to 100.
Set cross-section planes
Use one listener for all 3D result events. This keeps host UI state synchronized with what the canvas actually accepted.
