Vega3D

Technical Document

Vega3D Vibe Kit — Protocol Commands

vegaExecute(cmd, params) is the unified API for controlling the Vega3D 3D viewer from any AI (GPT, Claude, Qwen, DeepSeek, GLM, etc.) or external application. All commands return a structured { ok, data?, error? } response.

69 Commands Any AI · Any Origin postMessage Bridge

Usage API

Call vegaExecute() directly in the viewer page, or use the postMessage bridge from a parent frame.

// Direct call (inside viewer page or iframe)
const result = await vegaExecute('camera.set_preset', { preset: 'iso' });
// → { ok: true, data: { preset: 'iso' } }

// Error response
// → { ok: false, error: { code: 'INVALID_PARAM', message: '...' } }

Quick Reference 69 Commands

CommandGroupDescription
camera.set_presetcameraSet view to front/back/top/bottom/left/right/iso
camera.fit_viewcameraFit all loaded models to view
camera.getcameraGet current camera position, target, fov
camera.setcameraSet camera position / target / up vector
camera.orbitcameraOrbit by delta azimuth / elevation (degrees)
camera.zoomcameraZoom in/out by scale factor (>1 in, <1 out)
camera.save_bookmarkcameraSave current camera state as named bookmark
camera.load_bookmarkcameraRestore camera to a saved bookmark
camera.list_bookmarkscameraList all saved camera bookmarks
model.listmodelList all loaded models
model.get_treemodelGet scene tree structure
model.get_node_infomodelGet bounding box / center of a part
model.movemodelMove model by delta or to absolute position (mm)
model.rotatemodelRotate model by Euler angles (degrees)
model.reset_transformmodelReset model position/rotation to original loaded state
selection.by_idselectionSelect parts by name / ID
selection.clearselectionClear current selection
visibility.setvisibilityShow or hide parts
visibility.isolatevisibilityShow only specified parts
visibility.show_allvisibilityShow all hidden parts
material.applymaterialApply color / opacity / metalness / roughness
section.add_planesectionAdd a clipping plane
section.removesectionRemove all clipping planes
section.add_boxsectionApply box clipping — show only geometry inside box
section.get_planessectionGet all active clipping planes and box clip state
scene.set_render_modesceneSwitch render mode (shaded / wireframe / rendered …)
scene.explodesceneExplode view (factor 0–2)
scene.set_backgroundsceneSet background color
scene.get_statssceneGet render statistics
scene.get_tree_summarysceneSummarized tree for AI context
scene.fit_selectedsceneFit camera to selected or specified part
scene.get_visible_partssceneGet list of all currently visible part names
scene.snapshotsceneSave full scene state (camera, visibility, clipping) as named snapshot
scene.restore_snapshotsceneRestore a previously saved scene snapshot
scene.list_snapshotssceneList all saved scene snapshots
measure.distancemeasureMeasure distance between two 3D points
measure.anglemeasureMeasure angle at vertex
measure.clearmeasureClear all measurements
measure.listmeasureList all placed measurements with values
measure.deletemeasureDelete a specific measurement by ID
export.screenshotexportCapture viewport as PNG / JPG / WebP
export.gltfexportExport scene as GLB file
export.batch_screenshotexportScreenshots from multiple camera presets
part.movepart[Heavy] Move part(s) by delta or to absolute position (mm)
part.rotatepart[Heavy] Rotate part(s) by Euler angles (degrees)
part.reset_transformpart[Heavy] Reset part(s) position/rotation to original state
part.select_by_namepartSelect parts by glob pattern
part.get_infopartGet part center / bbox from FaceRange data
part.set_colorpart[Heavy] Override color of specific part(s)
part.reset_colorpart[Heavy] Restore original color of overridden part(s)
part.set_opacitypart[Heavy] Set opacity of specific part(s) (0–1)
part.find_by_bboxpart[Heavy] Find parts intersecting or inside a 3D box
part.get_neighborspart[Heavy] Find nearby parts within distance (mm)
annotation.addannotationAdd 3D note (anchor + label_pos + text)
annotation.listannotationList all annotations with positions
annotation.deleteannotationDelete annotation by ID
annotation.clearannotationDelete all annotations
markup.add_arrowmarkupAdd arrow annotation from point to point
markup.add_textmarkupAdd floating text label at a 3D position
markup.listmarkupList all markup annotations
markup.deletemarkupDelete markup by ID
markup.clearmarkupDelete all markup annotations
animation.listanimationList all animation clips in loaded model
animation.playanimationPlay animation clip by name or index
animation.stopanimationStop all playing animations
clash.checkclash[Heavy] BBox intersection check between parts
property.getproperty[Heavy] Get metadata attributes and geometry info for a part
property.searchproperty[Heavy] Search parts by attribute key-value
events.subscribeeventsCustomEvent subscription info

camera 9 commands

camera.set_preset Set camera to a named view direction
Parameters
NameTypeRequiredDescription
presetstringrequired'front' | 'back' | 'top' | 'bottom' | 'left' | 'right' | 'iso'
await vegaExecute('camera.set_preset', { preset: 'front' });
// → { ok: true, data: { preset: 'front' } }
camera.fit_view Fit all loaded models to the viewport (ISO view)

No parameters required.

await vegaExecute('camera.fit_view');
// → { ok: true }
camera.get Get current camera state
Returns
{
  position: [x, y, z],
  target:   [x, y, z],
  up:       [x, y, z],
  fov:      75
}
camera.set Set camera position, target, and/or up vector
Parameters
NameTypeRequiredDescription
positionnumber[3]optionalCamera position [x, y, z]
targetnumber[3]optionalLook-at target [x, y, z]
upnumber[3]optionalUp vector, default [0,0,1]
await vegaExecute('camera.set', {
  position: [1000, -2000, 800],
  target:   [0, 0, 0]
});
camera.zoom Zoom in or out by a scale factor (perspective + orthographic)
Parameters
NameTypeRequiredDescription
factornumberrequiredScale factor. >1 = zoom in, <1 = zoom out. e.g. 1.5 = +50%, 0.5 = -50%
await vegaExecute('camera.zoom', { factor: 1.5 }); // zoom in
await vegaExecute('camera.zoom', { factor: 0.5 }); // zoom out
// → { ok: true, data: { distance: 1200.5 } }
camera.save_bookmark Save current camera state as a named bookmark
Parameters
NameTypeRequiredDescription
namestringrequiredBookmark name (unique key)
await vegaExecute('camera.save_bookmark', { name: 'overview' });
// → { ok: true, data: { name: 'overview' } }
camera.load_bookmark Restore camera to a previously saved bookmark
Parameters
NameTypeRequiredDescription
namestringrequiredBookmark name to restore
await vegaExecute('camera.load_bookmark', { name: 'overview' });
// → { ok: true, data: { name: 'overview' } }
camera.list_bookmarks List all saved camera bookmarks
const r = await vegaExecute('camera.list_bookmarks');
// → { ok: true, data: { bookmarks: ['overview', 'engine_detail'] } }
camera.orbit Orbit camera by delta azimuth / elevation (degrees)
Parameters
NameTypeRequiredDescription
delta_azimuthnumberoptionalHorizontal rotation in degrees
delta_elevationnumberoptionalVertical rotation in degrees
await vegaExecute('camera.orbit', { delta_azimuth: 45, delta_elevation: -15 });

model 6 commands

model.list List all currently loaded models
const r = await vegaExecute('model.list');
// → { ok: true, data: { models: [{id, name, file_name, file_size_mb}], count: 2 } }
model.get_tree Get the scene component tree (depth-limited for AI context efficiency)
Parameters
NameTypeRequiredDescription
depthnumberoptionalMax tree depth (default 3)
max_nodesnumberoptionalMax nodes returned (default 500)
filterstringoptionalGlob-style name filter e.g. 'FR*'
await vegaExecute('model.get_tree', { depth: 2, max_nodes: 200 });
model.get_node_info Get bounding box and center of a specific part
Parameters
NameTypeRequiredDescription
namestringrequiredPart name (or use part_id)
await vegaExecute('model.get_node_info', { name: 'FR14' });
// → { ok: true, data: { name: 'FR14', center: [x,y,z], bbox: { min:[], max:[] } } }
model.move Move a loaded model by delta offset or to an absolute position (mm)
Parameters
NameTypeRequiredDescription
model_idstringoptionalModel ID from model.list. Omit to move all models.
deltanumber[3]optionalRelative offset [dx, dy, dz] in mm. Use this OR position.
positionnumber[3]optionalAbsolute target position [x, y, z] in mm. Use this OR delta.
// Move by relative offset
await vegaExecute('model.move', { delta: [100, 0, 0] });
// Move specific model to absolute position
await vegaExecute('model.move', { model_id: 'm0', position: [0, 500, 0] });
// → { ok: true, data: { position: [x, y, z] } }
model.rotate Rotate a loaded model by Euler angles (degrees) around a pivot point
Parameters
NameTypeRequiredDescription
model_idstringoptionalModel ID from model.list. Omit to rotate all models.
eulernumber[3]required[rx, ry, rz] rotation in degrees (XYZ order)
pivotnumber[3]optionalPivot point in mm. Defaults to model center if omitted.
// Rotate all models 45° around Z axis
await vegaExecute('model.rotate', { euler: [0, 0, 45] });
// Rotate around custom pivot
await vegaExecute('model.rotate', { model_id: 'm0', euler: [0, 90, 0], pivot: [0, 0, 0] });
// → { ok: true, data: { euler: [rx, ry, rz] } }
model.reset_transform Reset model position and rotation to original loaded state
Parameters
NameTypeRequiredDescription
model_idstringoptionalModel ID from model.list. Omit to reset all models.
await vegaExecute('model.reset_transform');
// → { ok: true, data: { reset: 1 } }

selection 2 commands

selection.by_id Select one or more parts by name / ID
Parameters
NameTypeRequiredDescription
part_idsstring[]requiredArray of part names (or single part_id)
await vegaExecute('selection.by_id', { part_ids: ['FR14', 'FR15'] });
selection.clear Clear all current selections / highlights
await vegaExecute('selection.clear');

visibility 3 commands

visibility.set Show or hide specified parts
Parameters
NameTypeRequiredDescription
part_idsstring[]requiredPart names array
visiblebooleanoptionaltrue = show, false = hide (default true)
await vegaExecute('visibility.set', { part_ids: ['Hull'], visible: false });
visibility.isolate Show only specified parts, hide everything else
NameTypeRequiredDescription
part_idsstring[]requiredParts to keep visible
await vegaExecute('visibility.isolate', { part_ids: ['Engine', 'Shaft'] });
visibility.show_all Restore visibility of all hidden parts
await vegaExecute('visibility.show_all');

material 1 command

material.apply Apply color, opacity, metalness, roughness to parts (or entire scene)
Parameters
NameTypeRequiredDescription
part_idsstring[]optionalIf omitted, applies to entire scene
material.colorstringoptionalCSS color e.g. '#ff0000', 'red'
material.opacitynumberoptional0.0 (transparent) – 1.0 (opaque)
material.metalnessnumberoptional0.0 – 1.0
material.roughnessnumberoptional0.0 – 1.0
// Make Hull semi-transparent red
await vegaExecute('material.apply', {
  part_ids: ['Hull'],
  material: { color: '#ff4444', opacity: 0.4 }
});

// Apply metallic look to entire scene
await vegaExecute('material.apply', {
  material: { metalness: 0.8, roughness: 0.2 }
});

section 4 commands

section.add_plane Add a clipping plane to slice the model
Parameters
NameTypeRequiredDescription
originnumber[3]optionalPoint on the plane [x, y, z] (default [0,0,0])
normalnumber[3]optionalPlane normal vector (default [0,1,0])
// Horizontal slice at Z = 500mm
await vegaExecute('section.add_plane', {
  origin: [0, 0, 500],
  normal: [0, 0, 1]
});
section.remove Remove all clipping planes
await vegaExecute('section.remove');
section.add_box [Heavy] Apply a box clipping region (6-plane section box)
Parameters
NameTypeRequiredDescription
part_idstringoptionalFit box to this part's bounding box
minnumber[3]optionalBox min corner [x,y,z] in mm (overrides part fit)
maxnumber[3]optionalBox max corner [x,y,z] in mm (overrides part fit)
// Fit section box to a part
await vegaExecute('section.add_box', { part_id: 'FR14' });
// Custom box region
await vegaExecute('section.add_box', {
  min: [-5000, -2000, 0], max: [5000, 2000, 3000]
});
// → { ok: true, data: { min: [...], max: [...] } }
section.get_planes Get all currently active clipping plane definitions
const r = await vegaExecute('section.get_planes');
// → { ok: true, data: {
//     planes: [{ origin: [x,y,z], normal: [nx,ny,nz] }, ...],
//     count: 2
//   } }

scene 10 commands

scene.set_render_mode Switch viewport render mode
Parameters
NameTypeRequiredDescription
modestringrequiredshaded / shaded_edges / rendered / flat / hidden / wireframe
await vegaExecute('scene.set_render_mode', { mode: 'shaded_edges' });
await vegaExecute('scene.set_render_mode', { mode: 'wireframe' });
// → { ok: true, data: { mode: 'shaded_edges' } }
scene.explode Explode view — spread components apart by factor
NameTypeRequiredDescription
factornumberrequired0 = no explode, 1 = normal, 2 = max. Range: 0–2
await vegaExecute('scene.explode', { factor: 1.2 });
// Reset:
await vegaExecute('scene.explode', { factor: 0 });
scene.set_background Set the viewport background color
NameTypeRequiredDescription
colorstringoptionalCSS hex color (default '#1a1a1a')
await vegaExecute('scene.set_background', { color: '#ffffff' });
scene.get_stats Get current render statistics
const r = await vegaExecute('scene.get_stats');
// → { triangles, draw_calls, geometries, textures, loaded_models }
scene.get_tree_summary Summarized tree optimized for AI context (token-efficient)
NameTypeRequiredDescription
depthnumberoptionalDefault 2
max_nodesnumberoptionalDefault 200
filterstringoptionalGlob pattern
await vegaExecute('scene.get_tree_summary', { depth: 2, filter: 'FR*' });
scene.fit_selected Fit camera to the currently selected/highlighted part
await vegaExecute('scene.fit_selected');
// → { ok: true } — fits to selectedName or current highlight
scene.get_visible_parts List all currently visible part names
const r = await vegaExecute('scene.get_visible_parts');
// → { ok: true, data: { parts: ['FR14', 'FR15', ...], count: 42 } }
scene.snapshot Save full scene state (visibility, camera, clipping, render mode) as a named snapshot
Parameters
NameTypeRequiredDescription
namestringrequiredSnapshot key
await vegaExecute('scene.snapshot', { name: 'review_A' });
// → { ok: true, data: { name: 'review_A', saved: true } }
scene.restore_snapshot Restore a previously saved scene snapshot
Parameters
NameTypeRequiredDescription
namestringrequiredSnapshot key to restore
await vegaExecute('scene.restore_snapshot', { name: 'review_A' });
// → { ok: true, data: { name: 'review_A', restored: true } }
scene.list_snapshots List all saved snapshot names
const r = await vegaExecute('scene.list_snapshots');
// → { ok: true, data: { snapshots: ['review_A', 'review_B'], count: 2 } }

measure 5 commands

measure.distance Measure straight-line distance between two 3D points
NameTypeRequiredDescription
point_anumber[3]required[x, y, z] in mm
point_bnumber[3]required[x, y, z] in mm
const r = await vegaExecute('measure.distance', {
  point_a: [0, 0, 0], point_b: [1000, 0, 0]
});
// → { value_mm: 1000.0, id: 'measure_...' }
measure.angle Measure angle at a vertex point (degrees)
NameTypeRequiredDescription
point_anumber[3]requiredFirst point
point_bnumber[3]requiredVertex (angle measured here)
point_cnumber[3]requiredThird point
const r = await vegaExecute('measure.angle', {
  point_a: [1,0,0], point_b: [0,0,0], point_c: [0,1,0]
});
// → { value_deg: 90.0, id: 'measure_...' }
measure.clear Clear all measurement annotations
await vegaExecute('measure.clear');
measure.list List all currently placed measurement annotations with IDs and values
const r = await vegaExecute('measure.list');
// → { ok: true, data: {
//     measures: [{ id: 0, span: 1234.5, label: '1234.5 mm' }, ...],
//     count: 3
//   } }
measure.delete Delete a specific measurement by ID
Parameters
NameTypeRequiredDescription
idnumberrequiredMeasurement ID from measure.list
await vegaExecute('measure.delete', { id: 0 });
// → { ok: true, data: { deleted: true } }

export 3 commands

export.screenshot Capture the current viewport as an image
NameTypeRequiredDescription
formatstringoptional'png' | 'jpg' | 'webp' (default 'png')
qualitynumberoptional0.0–1.0 (default 0.92)
downloadbooleanoptionalAuto-download file (default true)
const r = await vegaExecute('export.screenshot', {
  format: 'png', download: false
});
// → { data_url: 'data:image/png;base64,...', format: 'png' }
export.gltf Export current scene as GLB file
NameTypeRequiredDescription
file_namestringoptionalOutput filename (default auto-generated)
await vegaExecute('export.gltf', { file_name: 'my_model.glb' });
export.batch_screenshot Capture screenshots from multiple camera presets at once
NameTypeRequiredDescription
presetsstring[]optionalDefault: all 7 directions
downloadbooleanoptionalAuto-download each file (default true)
const r = await vegaExecute('export.batch_screenshot', {
  presets: ['front', 'top', 'iso'], download: false
});
// → { screenshots: [{preset, data_url}, ...], count: 3 }

part 11 commands

part.move [Heavy] Move specific part(s) by delta offset or to an absolute position (mm)
Parameters
NameTypeRequiredDescription
part_idsstring[]optionalPart names to move (array)
part_idstringoptionalSingle part name (alternative to part_ids)
deltanumber[3]optionalRelative offset [dx, dy, dz] in mm. Use this OR position.
positionnumber[3]optionalAbsolute target center position in mm. Use this OR delta.
// Move single part by delta
await vegaExecute('part.move', { part_id: 'FR14', delta: [0, 0, 50] });
// Move multiple parts to absolute position
await vegaExecute('part.move', { part_ids: ['FR14', 'FR15'], position: [100, 200, 0] });
// → { ok: true, data: { moved: 2 } }
part.rotate [Heavy] Rotate specific part(s) by Euler angles (degrees) around a pivot point
Parameters
NameTypeRequiredDescription
part_idsstring[]optionalPart names to rotate (array)
part_idstringoptionalSingle part name (alternative to part_ids)
eulernumber[3]required[rx, ry, rz] rotation in degrees (XYZ order)
pivotnumber[3]optionalPivot point in mm. Defaults to part center if omitted.
// Rotate single part 90° around Y axis
await vegaExecute('part.rotate', { part_id: 'FR14', euler: [0, 90, 0] });
// Rotate multiple parts around custom pivot
await vegaExecute('part.rotate', { part_ids: ['FR14', 'FR15'], euler: [0, 45, 0], pivot: [0, 0, 0] });
// → { ok: true, data: { rotated: 2 } }
part.reset_transform Reset part(s) position/rotation back to original loaded state
Parameters
NameTypeRequiredDescription
part_idsstring[]optionalPart names to reset (omit to reset all)
part_idstringoptionalSingle part name
await vegaExecute('part.reset_transform', { part_id: 'FR14' });
// → { ok: true, data: { reset: 1 } }
part.set_color Override the color of specific part(s)
Parameters
NameTypeRequiredDescription
part_idsstring[]optionalPart names (array)
part_idstringoptionalSingle part name
colorstringrequiredCSS hex color e.g. '#ff0000'
await vegaExecute('part.set_color', { part_id: 'FR14', color: '#ff4400' });
// → { ok: true, data: { colored: 1 } }
part.reset_color Restore original material color for specific part(s)
Parameters
NameTypeRequiredDescription
part_idsstring[]optionalPart names (omit to reset all)
part_idstringoptionalSingle part name
await vegaExecute('part.reset_color', { part_id: 'FR14' });
// → { ok: true, data: { reset: 1 } }
part.set_opacity Set transparency of specific part(s)
Parameters
NameTypeRequiredDescription
part_idsstring[]optionalPart names (array)
part_idstringoptionalSingle part name
opacitynumberrequired0.0 (transparent) – 1.0 (opaque)
// Make FR14 semi-transparent
await vegaExecute('part.set_opacity', { part_id: 'FR14', opacity: 0.3 });
// Restore full opacity
await vegaExecute('part.set_opacity', { part_id: 'FR14', opacity: 1.0 });
// → { ok: true, data: { applied: 1 } }
part.find_by_bbox Find parts whose bounding box overlaps or is contained within a given region
Parameters
NameTypeRequiredDescription
minnumber[3]requiredQuery box min corner [x,y,z] in mm
maxnumber[3]requiredQuery box max corner [x,y,z] in mm
modestringoptional'intersect' (default) or 'contain'
const r = await vegaExecute('part.find_by_bbox', {
  min: [-5000, -2000, 0], max: [5000, 2000, 3000], mode: 'intersect'
});
// → { ok: true, data: { parts: ['FR14', 'FR15', ...], count: 8 } }
part.get_neighbors Find parts within a given distance from a reference part
Parameters
NameTypeRequiredDescription
part_idstringrequiredReference part name
distancenumberoptionalSearch radius in mm (default 1000)
max_resultsnumberoptionalMax results to return (default 20)
const r = await vegaExecute('part.get_neighbors', {
  part_id: 'FR14', distance: 2000, max_results: 10
});
// → { ok: true, data: {
//     neighbors: [{ name: 'FR15', distance: 450.2 }, ...],
//     count: 5
//   } }
part.select_by_name Find and select parts using a glob-style pattern
NameTypeRequiredDescription
patternstringrequiredGlob pattern e.g. 'FR14*', '*배관*'
const r = await vegaExecute('part.select_by_name', { pattern: 'FR*' });
// → { matched_ids: ['FR14', 'FR15', ...], count: 8 }
part.get_info Get center and bounding box of a part from FaceRange data
NameTypeRequiredDescription
namestringrequiredPart name (or part_id)
await vegaExecute('part.get_info', { name: 'FR14' });
// → { name: 'FR14', center: [x,y,z], bbox: { min: [], max: [] } }

annotation 4 commands

annotation.add Add a 3D note annotation — anchor on model surface, label at offset position
Parameters
NameTypeRequiredDescription
anchornumber[3]required3D point on model surface (mm)
label_posnumber[3]required3D position of the label text (mm)
textstringrequiredAnnotation text content
const r = await vegaExecute('annotation.add', {
  anchor:    [100, 200, 50],
  label_pos: [150, 250, 100],
  text:      'Check weld here'
});
// → { ok: true, data: { id: 0 } }
annotation.list List all current 3D annotations with positions and text
const r = await vegaExecute('annotation.list');
// → { ok: true, data: {
//     annotations: [{ id, text, anchor: [x,y,z], label_pos: [x,y,z] }, ...],
//     count: 3
//   } }
annotation.delete Delete a specific annotation by ID
Parameters
NameTypeRequiredDescription
idnumberrequiredAnnotation ID from annotation.list
await vegaExecute('annotation.delete', { id: 0 });
// → { ok: true, data: { deleted: true } }
annotation.clear Delete all 3D annotations at once
const r = await vegaExecute('annotation.clear');
// → { ok: true, data: { deleted: 3 } }

markup 5 commands

markup.add_arrow Draw a 3D arrow line between two points, with optional text label
Parameters
NameTypeRequiredDescription
fromnumber[3]requiredStart point [x,y,z] in mm
tonumber[3]requiredEnd point [x,y,z] in mm
colorstringoptionalCSS hex color (default '#ffff00')
labelstringoptionalText label shown at midpoint
const r = await vegaExecute('markup.add_arrow', {
  from: [0, 0, 0], to: [1000, 0, 0],
  color: '#ff8800', label: 'Hull gap'
});
// → { ok: true, data: { id: 0 } }
markup.add_text Place a floating 3D text label at a world position
Parameters
NameTypeRequiredDescription
positionnumber[3]required[x,y,z] in mm
textstringrequiredLabel text content
colorstringoptionalCSS hex color (default '#ffffff')
const r = await vegaExecute('markup.add_text', {
  position: [500, 200, 0], text: 'Review point', color: '#00ffff'
});
// → { ok: true, data: { id: 1 } }
markup.list List all markup items (arrows and text labels) with IDs and positions
const r = await vegaExecute('markup.list');
// → { ok: true, data: {
//     items: [{ id, type: 'arrow'|'text', label, color }, ...],
//     count: 2
//   } }
markup.delete Delete a specific markup item by ID
Parameters
NameTypeRequiredDescription
idnumberrequiredMarkup ID from markup.list
await vegaExecute('markup.delete', { id: 0 });
// → { ok: true, data: { deleted: true } }
markup.clear Remove all markup items from the scene
const r = await vegaExecute('markup.clear');
// → { ok: true, data: { deleted: 2 } }

animation 3 commands

animation.list List all animation clips embedded in the loaded GLB model
const r = await vegaExecute('animation.list');
// → { ok: true, data: {
//     clips: [{ name: 'Open_Door', duration: 2.5 }, ...],
//     count: 3
//   } }
animation.play Play a named animation clip
Parameters
NameTypeRequiredDescription
namestringrequiredAnimation clip name from animation.list
loopbooleanoptionalLoop animation (default false)
speednumberoptionalPlayback speed multiplier (default 1.0)
await vegaExecute('animation.play', {
  name: 'Open_Door', loop: false, speed: 1.0
});
// → { ok: true, data: { clip: 'Open_Door', duration: 2.5 } }
animation.stop Stop all currently playing animations and reset to frame 0
await vegaExecute('animation.stop');
// → { ok: true }

clash 1 command

clash.check Detect bounding-box collisions between two lists of parts
Parameters
NameTypeRequiredDescription
group_astring[]requiredFirst group of part names
group_bstring[]requiredSecond group of part names
tolerancenumberoptionalExpand each box by this amount in mm (default 0)
const r = await vegaExecute('clash.check', {
  group_a: ['PIPE_001', 'PIPE_002'],
  group_b: ['STR_FR14', 'STR_FR15'],
  tolerance: 50
});
// → { ok: true, data: {
//     clashes: [{ a: 'PIPE_001', b: 'STR_FR14' }, ...],
//     count: 1
//   } }

property 2 commands

property.get Get all GLB attribute properties of a named part
Parameters
NameTypeRequiredDescription
namestringrequiredPart name
const r = await vegaExecute('property.get', { name: 'FR14' });
// → { ok: true, data: {
//     name: 'FR14',
//     properties: { Material: 'A36', Thickness: '12mm', ... }
//   } }
property.search Search parts by attribute key/value pair
Parameters
NameTypeRequiredDescription
keystringrequiredAttribute key to search
valuestringoptionalExact value to match (omit for any)
const r = await vegaExecute('property.search', {
  key: 'Material', value: 'A36'
});
// → { ok: true, data: { parts: ['FR14', 'FR15', ...], count: 12 } }

events Push Events

Vibe Kit dispatches CustomEvents on document for real-time AI integration. Use window.addEventListener() — no polling required.

Available Events
EventTriggered Whendetail
vega:selectionPart selected / highlighted{ selected: ['FR14'] }
vega:commandAny vegaExecute() call completes{ cmd, params, result }
// Subscribe to selection events
document.addEventListener('vega:selection', (e) => {
  console.log('Selected:', e.detail.selected);
});

// Subscribe to all commands
document.addEventListener('vega:command', (e) => {
  console.log(e.detail.cmd, e.detail.result);
});

postMessage Bridge iframe

Use the postMessage bridge to call vegaExecute() from a parent frame when the viewer is embedded as an <iframe>.

// Parent frame → send command to iframe
const viewer = document.getElementById('vega-iframe').contentWindow;
const reqId  = 'req_001';

viewer.postMessage(JSON.stringify({
  __vegaExecCall: true,
  reqId,
  cmd:    'camera.set_preset',
  params: { preset: 'front' }
}), '*');

// Listen for result
window.addEventListener('message', (e) => {
  const data = JSON.parse(e.data);
  if (data.__vegaExecResult && data.reqId === reqId) {
    console.log(data.result); // { ok: true, data: { preset: 'front' } }
  }
});

Response Format

All commands return a consistent object:

// Success
{ ok: true, data: { /* command-specific */ } }

// Success with no data
{ ok: true }

// Failure
{ ok: false, error: { code: 'INVALID_PARAM', message: '...' } }
Error Codes
CodeMeaning
NOT_READYScene or camera not yet initialized
INVALID_PARAMMissing or invalid parameter
NOT_FOUNDPart name not found in loaded model
NOT_SUPPORTEDFeature not available in current build
CAPTURE_FAILEDScreenshot capture failed (WebGPU limitation)
UNKNOWN_COMMANDCommand string not recognized
INTERNALUnexpected internal error