feat: integrate revolution into facade recompute
This commit is contained in:
@@ -353,6 +353,7 @@ test('OCCT feature executor builds a Sketch to Pad to Pocket chain and retains t
|
||||
capabilities: () => ({ status: 'ready' }),
|
||||
pad: async (input) => { calls.push(`pad:${input.profile.outer.length}`); if (padShouldFail) throw new Error('OCCT pad failed'); return shape('pad-shape') },
|
||||
pocket: async (input) => { calls.push(`pocket:${input.base.id}:${String(input.throughAll)}`); return shape('pocket-shape') },
|
||||
revolution: async (input) => { calls.push(`revolution:${input.angle}:${input.axisDirection?.[1]}`); return shape('revolution-shape') },
|
||||
fillet: async () => shape('fillet-shape'),
|
||||
chamfer: async () => shape('chamfer-shape'),
|
||||
release: async (released) => { calls.push(`release:${released.id}`) },
|
||||
@@ -396,6 +397,16 @@ test('OCCT feature executor builds a Sketch to Pad to Pocket chain and retains t
|
||||
const unsupported = await executor(upToFace, document, context)
|
||||
assert.equal(unsupported.status, 'failed')
|
||||
assert.equal(unsupported.errors?.[0].code, 'UP_TO_FACE_UNSUPPORTED')
|
||||
|
||||
const revolution = { id: 'revolution', typeId: 'PartDesign::Revolution', properties: [
|
||||
{ name: 'Angle', label: 'Angle', group: 'Parameters', scope: 'data' as const, type: 'App::PropertyAngle' as const, value: 270, unit: 'deg' },
|
||||
{ name: 'Profile', label: 'Profile', group: 'Parameters', scope: 'data' as const, type: 'App::PropertyLink' as const, value: 'sketch' },
|
||||
{ name: 'Reversed', label: 'Reversed', group: 'Parameters', scope: 'data' as const, type: 'App::PropertyBool' as const, value: true },
|
||||
] }
|
||||
const revolutionResult = await executor(revolution, document, context)
|
||||
assert.equal(revolutionResult.status, 'success')
|
||||
assert.equal(shapes.get('revolution')?.id, 'revolution-shape')
|
||||
assert.ok(calls.includes('revolution:270:-1'))
|
||||
})
|
||||
|
||||
test('facade async recompute commits only an accepted generation', async () => {
|
||||
@@ -707,4 +718,13 @@ test('Part Design feature tasks commit a document object and remain undoable', (
|
||||
assert.equal(facade.app.document.getActive().tree.some((item) => item.id === 'pad001'), false)
|
||||
facade.history.redo()
|
||||
assert.equal(facade.app.document.getActive().tree.some((item) => item.id === 'pad001'), true)
|
||||
|
||||
facade.gui.command.execute({ commandId: 'revolution' })
|
||||
assert.equal(facade.task.getActive()?.commandId, 'revolution')
|
||||
facade.task.apply()
|
||||
const revolution = facade.app.document.getObject('revolution')
|
||||
assert.equal(revolution?.typeId, 'PartDesign::Revolution')
|
||||
assert.equal(revolution?.properties.find((property) => property.name === 'Angle')?.value, 360)
|
||||
facade.app.document.setProperty({ objectId: 'revolution', propertyName: 'Angle', value: 180 })
|
||||
assert.equal(facade.app.document.getObject('revolution')?.properties.find((property) => property.name === 'Angle')?.value, 180)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user