Skip to main content
1-Visitor
May 26, 2018
Question

thingworx studio model reset ??

  • May 26, 2018
  • 1 reply
  • 3030 views

 angular.element(document.getElementById('3DModel-2')).scope().reset();

 

why error??? 

 

The API function does not work.

 

 

 

 

1 reply

21-Topaz I
June 4, 2018

Hi,

 

I use in the javascript some code like this.

$scope.app.m1reset = function()
{ twx.app.fn.triggerWidgetService("model-1", 'reset');
$scope.$applyAsync(); };

as for me is working fine. May be you can try

Thanks!

 

 

21-Topaz I
June 4, 2018

I tested also the mention method but it work fine so believe there is some thing else wrong.

For example the name of the model is not correct ...etc. 

You can press Strg - Shift - I key to start the Chrome in debugging mode:

2018-06-04_15-56-31.jpg

So in the console you can see what of error occurred. So for example I clicked the playAll button before the preview was not already initialized and therefore the error.

Clicking the Reset button here will call the function Reset1() which is working fine. e.g.:

2018-06-04_15-56-54.jpg

So I used the following script code:

///////////////////////// used in button "playAll"
$scope.sequence1 = function() {
angular.element(document.getElementById('model-1')).scope().playAll();
 
};

////////////////////////// used in button _"Reset"
$scope.reset1 = function() {
angular.element(document.getElementById('model-1')).scope().reset(); 
};
21-Topaz I
June 4, 2018

another version what also should work for a model with name "model-1"  is this:

/////////
$scope.testReset= () =>{
var element = angular.element(document.querySelector('twx-widget[widget-id=\"model-1\"] twx-dt-model'));
element.scope().reset();
};