2

I have use floorplan conversion api to convert my 2d floorplan to 3d and get the sceneId back 71c8eef9-b44e-447f-a0d2-fd299318da56.

I want to convert it to afame component inside my aframe application.So I use getAframeElements and get two entity back and following your official sample:

const sceneEl = document.querySelector('a-scene')
io3d.scene.getAframeElements(sceneId)
  .then(elements => {
    // this will give us two elements
    // The first is the actual scene according to the scene structure hierarchy
    // The second is the camera with potential waypoints that where defined in the scene structure
    // you can leverage the waypoints using our A-Frame tour component
    elements.forEach((el) => {
      // add elements to the scene
      sceneEl.appendChild(el)
    })
    sceneEl.appendChild(element)
  })

Then It added to aframe, but nothing happens! I got nothing. Do I miss something?

KevinHu
  • 991
  • 3
  • 10
  • 20

1 Answers1

1

Hard to tell what's going on there without the full HTML and JavaScript, but the full code to get that working is:

<!DOCTYPE html>
<html>
  <head>
    <script src="https://aframe.io/releases/0.7.0/aframe.min.js"></script>
    <script src="https://3d.io/releases/3dio-js/1.x.x/3dio.min.js"></script>
  </head>
  <body>
    <a-scene></a-scene>
    <script>
      io3d.scene.getAframeElements('71c8eef9-b44e-447f-a0d2-fd299318da56').then(elems => {
        document.querySelector('a-scene').appendChild(elems[0])
      })
    </script>
  </body>
</html>

And you can see it working at https://aspiring-snowman.glitch.me/

geekonaut
  • 5,714
  • 2
  • 28
  • 30
  • 2
    I find out the problem. I just put 3dio.js before aframe.js then nothing happens. Sorry, It's stupid mistake, but I think there should be some warning or error show. Thanks! – KevinHu Oct 26 '17 at 06:36
  • 1
    @KevinHu you are right: there should be some warning when 3dio.js is being initialized before aframe. will add that. thx for your feedback! – tomas polach Oct 26 '17 at 11:18