We are trying to seek forge-convert-utils in order to get a list of the gltf's from the urns sent. When we reach to construct a new ManifesterHelper(), this returns undefined, forcing the loop to advance for next urn (with the obvious same result).
urnsPerProject.forEach(async urn => {
try {
const auth = {
client_id: process.env.FORGE_CLIENT_ID,
client_secret: process.env.FORGE_SECRET
}
const parsedUrn = Buffer.from(urn).toString('base64')
const mdClient = new ModelDerivativeClient(
auth,
'https://developer.api.autodesk.com',
Region.EMEA
)
const helper = new ManifestHelper(await mdClient.getManifest(parsedUrn))
const derivatives = helper.search({ type: 'resource', role: 'graphics' })
const readerOptions = {
log: console.log
}
const writerOptions = {
deduplicate: true,
skipUnusedUvs: true,
center: false,
log: console.log
}
const writer = new GltfWriter(writerOptions)
const filteredDerivatives = derivatives.filter(derivative => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
return derivative.mime === 'application/autodesk-svf'
})
for (const derivative of filteredDerivatives) {
const reader = await SvfReader.FromDerivativeService(
urn,
derivative.guid,
auth
)
const scene = await reader.read(readerOptions)
console.log('scene', scene)
}
} catch (error) {
console.error('error', error)
}
})
Problem in here was solved!
1st - I missed to replace the '/' by '_' at the base64 parsedUrn
const parsedUrn = Buffer.from(urn).toString('base64').replace('/', '_')
2nd - I was choosing EMEA as Region, but I had to pass US
Great thx to #PetrBroz from #Autodesk