www.skylinesoft.com Homepage
Forum Home Forum Home > SkylineGlobe General Support > TerraExplorer Support
  New Posts New Posts RSS Feed - CreateModel: Error calling method on NPObject
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CreateModel: Error calling method on NPObject

 Post Reply Post Reply
Author
Message
WilliamKappler View Drop Down
Visitor
Visitor


Joined: June 15 2016
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote WilliamKappler Quote  Post ReplyReply Direct Link To This Post Topic: CreateModel: Error calling method on NPObject
    Posted: June 15 2016 at 5:01pm
I am attempting to load a 3D model into TerraExplorer's browser plugin. I tried using the sort of operation done in the examples, but despite several attempts I am only given an "Error calling method on NPObject!" in the console with no model being loaded.


<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>TerraExplorer API in FF</title>
   
    <script src="abspath.js" type="text/javascript"></script>
    <script type="text/javascript">
    window.onload = function()
    {
        SGWorld.project.open('http://www.skylineglobe.com/SkylineGlobe/WebClient/PresentationLayer/webclient/SkyGlobeLB.fly');
       
       
        var pos = SGWorld.Creator.CreatePosition(-122.38050, // x
                                                      37.62331,  // y
                                                      40.0,      // height
                                                      3,         // absolute
                                                      297.0,     // yaw
                                                      15.0);     // pitch
                                                     

       
       
        try
        {
            var model = SGWorld.Creator.CreateModel(
                pos,
                toAbspath("car-shelby.xpc")/*,
                0.2,
                0,
                "",
                "");
        }
        catch( e )
        {
            alert(e.toString());
        }
       
        SGWorld.Navigate.FlyTo(model);
       
        alert( "done" );
    };
    </script>
</head>
<body>
    <object id="TerraExplorer3DWindow" type= "application/x-skyline" CLSID="{3a4f9192-65a8-11d5-85c1-0001023952c1}" width="500" height="400"></object>
    <object id="SGWorld" type= "application/x-skyline" CLSID="{3a4f9199-65a8-11d5-85c1-0001023952c1}" style="height: 0px; visibility: hidden;"></object>
</body>
</html>


I am not sure if this is possibly a Firefox issue. I found that setup for getting TerraExplorer to work in Firefox on this site and it generally works- but perhaps adding models is not supported in it.

I pulled car-shelby.xpc off the Skyline website, and it's in the same directory.

Some other operations work, but it's hit or miss. It seems things that add geometry aren't working as documented, as Creator.CreateCircle also gave me an error.

The only mention of this error I could find with relation to TerraExplorer was on a Chinese blog that I could not understand.


Edited by WilliamKappler - June 15 2016 at 5:10pm
Back to Top
Eylon View Drop Down
Skyline Admin Group
Skyline Admin Group
Avatar

Joined: May 05 2003
Location: Israel
Status: Offline
Points: 340
Post Options Post Options   Thanks (0) Thanks(0)   Quote Eylon Quote  Post ReplyReply Direct Link To This Post Posted: June 20 2016 at 8:07am
William,

The FF (and chrome) support for NPAPI was discontinued. Thus, TE ActiveX object can no longer be used and we have discontinued the support for the feature.
We have developed a powerful TerraExplorer for Web viewer, that is built using HTML5 technologies, and can run on modern browsers.
http://skylineglobe.com/sg7/TerraExplorerWeb/TerraExplorer.html

Your code can still work in IE with some changes I made below:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>TerraExplorer API in FF</title>
    
    <script src="abspath.js" type="text/javascript"></script>
    <script type="text/javascript">
    function Init()
    {
        SGWorld.project.open('http://www.skylineglobe.com/SkylineGlobe/WebClient/PresentationLayer/webclient/SkyGlobeLB.fly');
        SGWorld.AttachEvent("OnLoadFinished", OnProjectLoadFinished);
    };

    function OnProjectLoadFinished() {
        alert("Received project loaded event. Click OK to fly to model.");
        //Used to resolve synchronization issue - alternatively use short timeout before FlyTo, allowing SGWorld.Navigate.FlyTo to initialize.
        var pos = SGWorld.Creator.CreatePosition(-122.38050, // x
                                                      37.62331, // y
                                                      40.0,      // height
                                                      3,        // absolute
                                                      297.0,     // yaw
                                                      15.0);     // pitch




        try {
            var model = SGWorld.Creator.CreateModel(
               pos,/*toAbspath("car-shelby.xpc"),*/
          "C:\\Program Files (x86)\\Skyline\\TerraExplorer Pro\\Tools\\Data-Library\\3D-Objects\\Ground Vehicles\\car-shelby.xpc",
               0.2,
               0,
               "",
               "");
        }
        catch (e) {
            alert(e.toString());
        }
        SGWorld.Navigate.FlyTo(model);
    }
    </script>
</head>
<body onload="Init()">
    <!--    <object id="TerraExplorer3DWindow" type= "application/x-skyline" CLSID="{3a4f9192-65a8-11d5-85c1-0001023952c1}" width="500" height="400"></object>
        <object id="SGWorld" type= "application/x-skyline" CLSID="{3a4f9199-65a8-11d5-85c1-0001023952c1}" style="height: 0px; visibility: hidden;"></object>-->
    <object id="TerraExplorer3DWindow" classid="clsid:3a4f9192-65a8-11d5-85c1-0001023952c1" style="width: 600px;height: 600px"></object>
    <object id="SGWorld" classid="CLSID:3a4f9199-65a8-11d5-85c1-0001023952c1" style="visibility: hidden;height: 0"></object>
</body>
</html>
Eylon
Back to Top
WilliamKappler View Drop Down
Visitor
Visitor


Joined: June 15 2016
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote WilliamKappler Quote  Post ReplyReply Direct Link To This Post Posted: June 20 2016 at 8:58pm
Thanks for the response.

That did indeed fix the model loading. However, is there a way to do that with the HTML5 interface such that it will be compatible with Firefox (and possibly Chrome)?

I am not sure where to look for documentation on using the HTML5 interface in general. I had been trying to utilize the JavaScript sections from the API docs along with the examples, but I'm not sure either of those would be right for the new interface.
Back to Top
Eylon View Drop Down
Skyline Admin Group
Skyline Admin Group
Avatar

Joined: May 05 2003
Location: Israel
Status: Offline
Points: 340
Post Options Post Options   Thanks (0) Thanks(0)   Quote Eylon Quote  Post ReplyReply Direct Link To This Post Posted: June 21 2016 at 1:00pm
Glad it helped.
The TE4W (HTML5) will be released in the coming weeks, and we will share more information then ...
Eylon
Back to Top
weenshun View Drop Down
Visitor
Visitor


Joined: June 23 2016
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote weenshun Quote  Post ReplyReply Direct Link To This Post Posted: June 23 2016 at 6:04pm
my Google Chrome 47.0.2526.106, can't see the world.  But can see the vector data.
Back to Top
Marina Skyline View Drop Down
Skyline Support
Skyline Support


Joined: June 26 2016
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote Marina Skyline Quote  Post ReplyReply Direct Link To This Post Posted: June 26 2016 at 3:40pm
Hi Weenshun,

We've noticed you have an older version of Chrome. Currently the latest Chrome version is 51.0.2704.103 m (this unusual because Chrome keeps itself updated silently). Is there any reason why you use version 47.0.2526.106? 
Latest Chrome version works OK in our computers, if it possible try it also.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.078 seconds.