feat: report shape topology checks

This commit is contained in:
2026-08-02 20:46:02 -04:00
parent 61360473fe
commit 10c7f23b17
2 changed files with 9 additions and 3 deletions

View File

@@ -557,9 +557,14 @@ export function createMockFacade(): BitBybitWebCadFacade {
notify(message)
}
if (!shape) reportFailure('SHAPE_NOT_RECOMPUTED', `No valid Shape is cached for ${objectId}; recompute the document first.`)
else void geometryRuntime.mesh(shape, 0.05).then((mesh) => {
if (mesh.indices.length === 0 || mesh.positions.length === 0) throw new Error('Shape mesh is empty.')
notify(`Shape check passed: ${mesh.subshapes?.length || 0} subshapes`)
else void geometryRuntime.topology(shape, 0.05).then((topology) => {
const count = topology.faces.length + topology.edges.length + topology.vertices.length
if (count === 0) throw new Error('Shape topology is empty.')
const message = `Shape check passed: ${topology.faces.length} faces, ${topology.edges.length} edges, ${topology.vertices.length} vertices`
const diagnostic: Diagnostic = { id: `diag-${++requestSequence}`, severity: 'info', code: 'SHAPE_CHECK_PASSED', message, objectId, requestId }
state = { ...state, diagnostics: [...state.diagnostics, diagnostic] }
emit({ type: 'diagnostic.added', diagnostic, context })
notify(message)
}).catch((error: unknown) => reportFailure('SHAPE_CHECK_FAILED', error instanceof Error ? error.message : String(error)))
}
else if (commandId === 'solve-sketch') { solveSketchObject(state.selectedObjectId); notify('Sketch solver completed') }