Skip to main content
1-Visitor
December 13, 2019
Question

Vuforia View app crashes when the property value changes

  • December 13, 2019
  • 1 reply
  • 2506 views

Hi,

I would like to play a certain sequence, which i already created in my Creo Illustrate model, when the bool value changes in the PLC.
After entering the JS code I have the problem that the app sporadically crashes.
But usually it happens when the value to be monitored changes.

 

I tried to play the sequence by using the watch function

 

$scope.PlaySequence = function ()
{
$timeout (function() {
$scope.app.view.Startseite.wdg["model-1"].currentStep = 17;
$timeout(function () {
$scope.$root.$broadcast('app.view["Startseite"].wdg["model-1"].svc.play');},250);},250);
$scope.$applyAsync(()=>{angular.element(document.getElementById('model-1')).scope().reset();});
return;

};

 

$scope.$watch(function(scope)
{
return $scope.app.mdl.HoRe_ALL.properties.TestBool
},

function ()
{
$scope.PlaySequence();
}
);

 

Can someone tell me what I'm doing wrong with this function?

 

 

Yours sincerely
Marco

1 reply

21-Topaz I
December 18, 2019

@Hi @MarcoNFT ,

 

I believe one problem which may   occur - is  when you are loading your project and the value changed but the model is not loaded yet.  If this is the problem you can avoid it  when you embed the watch construct inside the model Load event:

 

$rootScope.$on('modelLoaded', function() { 
/////////////////////////////////////////////
$scope.$watch(function(scope)
{
return $scope.app.mdl.HoRe_ALL.properties.TestBool
},

function ()
{
$scope.PlaySequence();
}
);
/////////////////////////////////////////
})

 

MarcoNFT1-VisitorAuthor
1-Visitor
December 19, 2019

Hi Roland,

 

first of all. Thanks for your help. Sounds like a possible solution.

I'm going to try this as soon as possible  and will give a feedback.

 

 

Best regards

Marco

1-Visitor
February 27, 2020

Hello Marco!

Did Roland's solution solve your problem?
I'm experiencing more or less similar issue - my experience crashes, after I overwrite currentStep-parameter, reload and try to play my model with $timeout().

 

Kind regards

Stanislav