我正在将步骤文件上传到 OSS 并使用以下代码将其转换为 svf
async function TranslateToSVF(objectEncodedUrn) {
console.log("Translating Object")
const getAccessToken = await getAccessTokenFromLambda();
let result = await axios.post('https://developer.api.autodesk.com/modelderivative/v2/designdata/job', {
"input": {
"urn": objectEncodedUrn
},
"output": {
"destination": {
"region": "us"
},
"formats": [
{
"type": "svf",
"views": ["2d", "3d"]
}
]
}
}, {
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${getAccessToken} `
}
})
do{
result = await axios.get(`https://developer.api.autodesk.com/modelderivative/v2/designdata/${objectEncodedUrn}/manifest`,{
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${getAccessToken} `
}
})
setTimeout(() => {}, 20000);
console.log("inprogress!!!")
}while(result.data.status === "inprogress" || result.data.status === "pending")
console.log(result.data.status)
}
问题是已经测试过的同一个文件,并且工作正常,但现在翻译失败。得到的响应为:
{'type': 'manifest', 'hasThumbnail': 'true', 'status': 'failed', 'progress': 'complete', 'region': 'US', 'urn': 'dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6aW50ZWNoX2xhdHRpY2VfZGVtby9ncmlwcGVyX2FybV83Y2I1M2Y2Ny1hMDMxLTRhNDItOGQwNS05NjJhY2EzNWFjNDIuc3RlcA', 'version': '1.0', 'derivatives': [{'name': 'gripper_arm_7cb53f67-a031-4a42-8d05-962aca35ac42.step', 'hasThumbnail': 'true', 'status': 'failed', 'progress': 'complete', 'messages': [{'type': 'error', 'code': 'ATF-1036', 'message': ['Schema of the file format is not supported.', 'C:\\worker\\viewing-atf-lmv-cosv3\\tmp\\job-1\\104\\gripper_arm_7cb53f67-a031-4a42-8d05-962aca35ac42.step']}], 'outputType': 'svf', 'children': [{'guid': '5cc6d9c7-e4d4-465b-a46e-46800cf0837c', 'type': 'geometry', 'role': '3d', 'name': 'Scene', 'status': 'success', 'progress': 'complete', 'hasThumbnail': 'true', 'children': [{'guid': '39afe01b-4aff-4b26-b431-58f81e902831', 'type': 'resource', 'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6aW50ZWNoX2xhdHRpY2VfZGVtby9ncmlwcGVyX2FybV83Y2I1M2Y2Ny1hMDMxLTRhNDItOGQwNS05NjJhY2EzNWFjNDIuc3RlcA/output/1/gripper_arm_7cb53f67-a031-4a42-8d05-962aca35ac42.svf', 'role': 'graphics', 'mime': 'application/autodesk-svf'}, {'guid': '938aed2b-9c22-47ab-bcf4-b5a57029c625', 'type': 'resource', 'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6aW50ZWNoX2xhdHRpY2VfZGVtby9ncmlwcGVyX2FybV83Y2I1M2Y2Ny1hMDMxLTRhNDItOGQwNS05NjJhY2EzNWFjNDIuc3RlcA/output/1/gripper_arm_7cb53f67-a031-4a42-8d05-962aca35ac42.svf.png01_thumb_400x400.png', 'resolution': [400, 400], 'mime': 'image/png', 'role': 'thumbnail'}, {'guid': 'dfe96868-5b4e-4b91-8b73-38fa8555c66a', 'type': 'resource', 'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6aW50ZWNoX2xhdHRpY2VfZGVtby9ncmlwcGVyX2FybV83Y2I1M2Y2Ny1hMDMxLTRhNDItOGQwNS05NjJhY2EzNWFjNDIuc3RlcA/output/1/gripper_arm_7cb53f67-a031-4a42-8d05-962aca35ac42.svf.png01_thumb_200x200.png', 'resolution': [200, 200], 'mime': 'image/png', 'role': 'thumbnail'}, {'guid': '225bcaa8-6d4b-48b1-930c-50910d745570', 'type': 'resource', 'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6aW50ZWNoX2xhdHRpY2VfZGVtby9ncmlwcGVyX2FybV83Y2I1M2Y2Ny1hMDMxLTRhNDItOGQwNS05NjJhY2EzNWFjNDIuc3RlcA/output/1/gripper_arm_7cb53f67-a031-4a42-8d05-962aca35ac42.svf.png01_thumb_100x100.png', 'resolution': [100, 100], 'mime': 'image/png', 'role': 'thumbnail'}]}, {'guid': 'd48b29e0-6245-483d-9ff6-be2caf5de578', 'type': 'resource', 'urn': 'urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6aW50ZWNoX2xhdHRpY2VfZGVtby9ncmlwcGVyX2FybV83Y2I1M2Y2Ny1hMDMxLTRhNDItOGQwNS05NjJhY2EzNWFjNDIuc3RlcA/output/1/properties.db', 'role': 'Autodesk.CloudPlatform.PropertyDatabase', 'mime': 'application/autodesk-db', 'status': 'success'}]}]}
它应该给出成功状态。应该出现什么问题?
如果您将响应对象放入 https://jsoneditoronline.org/ 并选中
res.derivatives[0].childen[0]
,则进度已完成,状态为成功。仅缩略图失败,某些文件可能没有缩略图,但可以在 APS 查看器中查看的 SVF 翻译在您的情况下是成功的。