3

Does someone know from a 3d model how to get the storageID? There seems to be a method like this, but it keeps telling me invalid url. thanks !

io3d.storage.getIdFromUrl('https://spaces.archilogic.com/3d/Home_2766/grrodvuu?modelResourceId=cd36dc78-a124-4a4e-9990-35be32415f84')
Milo
  • 3,365
  • 9
  • 30
  • 44
  • 1
    You're getting the error because the `io3d.storage.getIdFromUrl` only works for storage URLs (such as this example: https://3d.io/docs/api/1/storage.html#url) , not for model URLs. – m-ke Feb 15 '18 at 17:01

1 Answers1

2

I assume you are looking for the storage ID of the entire baked model?

In that case, you can use the Scene API to find the child with the bakedModelUrl which is the storage ID of the model:

// this is the modelResourceId from the URL you gave in your question
io3d.scene.getStructure('cd36dc78-a124-4a4e-9990-35be32415f84')
  // we select the children
  .then(scene => scene.children)
  // find the child that has a bakedModelUrl
  .then(children => children.find(child => child.bakedModelUrl))
  // read the bakedModelUrl
  .then(level => level.bakedModelUrl)
  // and log it (or do whatever you need to do with it)
  .then(console.log)
geekonaut
  • 5,714
  • 2
  • 28
  • 30