aframearchilogic3d.io

Getting the storageId from Url


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')

Solution

  • 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)