setSelectedLevel gives an Error

by PacWood » Wed Apr 11, 2018 7:42 am

Hello,

I am attempting to select a level in a building via the API.

Below is a snippet of code that successfully runs until
the last line is reached.

Code: Select all

         var HOME;
	 var HPC =  viewHome("viewerCanvas",   
           homeUrl,          
           onerror,           
           onprogression,    
          { roundsPerMinute: 0,                
            navigationPanel: "default",                                           
            levelsAndCamerasListId: "levelsAndCameras",         
            selectableLevels: ["Level 1", "Level 2"],     
            activateCameraSwitchKey: true                      
          });

       HOME = HPC.getHome();

       var theLevels = HOME.getLevels();
       var levelName = theLevels[0].getName();
       console.log('levelName: '+levelName);
       var objLevel = theLevels[0];
       console.log(objLevel);
       HOME.setSelectedLevel("Level 1", objLevel);


At the line:

Code: Select all

      HOME.setSelectedLevel("Level 1", objLevel);


A javascript error occurs, which is:

Code: Select all

      "Error: TypeError: m.getElevation is not a function"


However, the code prints the object 'objLevel'

Code: Select all

 
       console.log(objLevel);


I can see in the console log, the object 'objLevel' shows
there is a function named "getElevation".

Does anyone have an idea why there is an error of
"getElevation is not a function"
and yet there is a function named "getElevation" in the object
that is being passed to HOME.setSelectedLevel() ?

Below is a screen shot of the console output.


Image


thank you for your help.