Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 3
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 399 times and has 2 replies Next Thread
PacWood
Newbie



USA
Joined: Mar 13, 2018
Post Count: 8
Status: Offline
Reply to this Post  Reply with Quote 
setSelectedLevel gives an Error

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.


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:

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


A javascript error occurs, which is:

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


However, the code prints the object 'objLevel'

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.





thank you for your help.
[Apr 11, 2018, 7:42:07 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
Re: setSelectedLevel gives an Error

Sorry, the JSDoc of setSelectedLevel isn't clear and will be fixed in the next version.
setSelectedLevel takes only one parameter:
HOME.setSelectedLevel(objLevel);

----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Apr 11, 2018, 11:07:21 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
PacWood
Newbie



USA
Joined: Mar 13, 2018
Post Count: 8
Status: Offline
Reply to this Post  Reply with Quote 
Re: setSelectedLevel gives an Error

Thank you very much for your help and example code.

The program works now.
[Apr 11, 2018, 4:38:54 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2024 eTeks - All rights reserved