cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Sequence animations on hololens

SOLVED
micah
Amethyst

Sequence animations on hololens

Hi,

I can't seem to get an animation to play on hololens 2.

 

I created the sequence in Illustrate 6.1 and used the code:

 

$scope.app.playModelStepPvz("Roller Handle","Figure 1","roller_handle",1,true) 

//////////////
//definition of the function
$scope.app.playModelStepPvz = function (pvz,sequence,modelName,step_number,play) {
 
//pvz file
//sequnece -sequnece name e.g. TestFigure1 - as shown in UI
//modelName - model name e.g. model-1 widget
//step_number - set this number to current step
//play   true/false execute play for the model
 
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'src',  '');});   
  $timeout(function () {
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'src', 'app/resources/Uploaded/'+pvz +'.pvz');});
  },50);
  $timeout(function () {
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'sequence',  '');});    
  },50);
  $timeout(function () {
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'sequence',  'app/resources/Uploaded/l-Creo 3D - '+sequence +'.pvi');});     
  },50);
  $timeout(function () {     
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'currentStep', parseInt(step_number));});
 if(play)   //check if play should be applyed
 $timeout(function () {angular.element(document.getElementById(modelName)).scope().play();  }, 100)
   //angular.element(document.getElementById(modelName)).scope().play(); }, 100);
                      }
           , 500);
};

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Sequence animations on hololens

We were able to solve the issue.

 

We found that hololens wasn't able to locate the PVI file within the PVZ the same way mobile devices do.

 

So to get around this we had to open the pvz file with 7zip, extract the pvi file and upload it within vuforia.

 

Another issue that was solved as a result of this workaround was the naming of figures created in Illustrate. We had to ensure that when we published the pvzs from Illustrate, the figures had to have unique names for the function to work.

View solution in original post

13 REPLIES 13

Re: Sequence animations on hololens

Hello Micah,

 

I have some questions :

  • Is it an issue due to Javascript only ?
  • What appends when playing sequence by a simple binding in Experience for Hololens ?
  • Does Sequence is playing fine in a mobile Experience ?
  • Does the sequence is playing fine in Preview in Vuforia Studio ?
  • Do you have a Project to share where the issue is reproducible where we can work on it ?

 

Also, it might be possible to have a look to this thread about a similar issue :

https://community.ptc.com/t5/Vuforia-Studio/Sequences-does-not-work-on-hololens-using-javascript/m-p...

 

Best regards,

Samuel

Re: Sequence animations on hololens

The problem could be due to javascript only, I'm not sure. It plays on mobile fine and in the vuforia studio preview. Another thing that might be of note is that I have several pvz models within the experience that have animation sequences.

 

I've attached the experience we're working on.

Re: Sequence animations on hololens

It works with a simple binding to a 3D button.

Re: Sequence animations on hololens

Hello Micah,

 

Ok, thanks you for your feedback and the Project.

I will check that.

 

One thing that you can do also, in a such case, is to look in Vuforia View log file in Hololens.

It might be possible to find an error reported who can explains the issue.

https://www.ptc.com/en/support/article/CS283816

 

Best regards,

Samuel

Re: Sequence animations on hololens

Hi @micah ,

when the binding is working then some call like this should also work:

 try{
   $scope.app.fn.triggerWidgetService("3DVideo-1","play");
    } catch(ex){console.warn("ex="+ex);}

where the 3DVideo-1 is the widget name. In my test it was 3d Video but it should also work for the model Widget 

Re: Sequence animations on hololens

Hi Roland,

 

I tried using that code within my switch case and it still doesn't work.

 

	
$scope.app.playModelStepPvz("Roller Handle","Figure 1","roller_handle",1,true) 
	 try{
       $scope.app.fn.triggerWidgetService("roller_handle","play");
       } catch(ex){console.warn("ex="+ex);}  

 

 I also tried it without the playModelStepPvz function and without the try function.

Re: Sequence animations on hololens

Here's a couple of lines in the vuforia view log file that looks like it could be the problem.

 

2020-12-06T14:39:29.690-08:00 [Debug] javascript - loadPVI failed with data: [WinRTError: Element not found.
]
2020-12-06T14:39:29.690-08:00 [Debug] javascript - roller_handle failed to load pvi app/resources/Uploaded/l-Creo 3D - Figure 1.pvi

Re: Sequence animations on hololens

Hi @micah ,

I tested some code here in a mobile project and it was working:

$scope.testClick= function () {
$scope.app.playModelStepPvz("engine_test_exp","Figure 1","model-3",3,true)
}

//////////////
//definition of the function
$scope.app.playModelStepPvz = function (pvz,sequence,modelName,step_number,play) {
 
//pvz file
//sequnece -sequnece name e.g. TestFigure1 - as shown in UI
//modelName - model name e.g. model-1 widget
//step_number - set this number to current step
//play   true/false execute play for the model
 
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'src',  '');});   
  $timeout(function () {
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'src', 'app/resources/Uploaded/'+pvz +'.pvz');});
  },50);
  $timeout(function () {
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'sequence',  '');});    
  },50);
  $timeout(function () {
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'sequence',  'app/resources/Uploaded/l-Creo 3D - '+sequence +'.pvi');});     
  },50);
  $timeout(function () {     
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'currentStep', parseInt(step_number));});
 if(play)   //check if play should be applyed
 $timeout(function () {
 //replace this
 //angular.element(document.getElementById(modelName)).scope().play();  
 //to this one
 $scope.app.fn.triggerWidgetService(modelName,"play");
 }, 100)
   //angular.element(document.getElementById(modelName)).scope().play(); }, 100);
                      }
           , 500);
       $scope.$applyAsync();
};

So, here I  changed the function (above )and called form a button. 

If it will not work in this case, we need to check the call context more detailed / project or at least the pvz model.

e.g. the question Where and when you call this function?  Location where the pvz is saved (may be in a subfolder of the upload folder ... etc.).

Also the question is if you need to simplify this function. e.g. When the pvz is already assigned to the model widget you do not need to set the src and could omit this call. The same is with the sequence property ... etc.

Re: Sequence animations on hololens

Hi @micah ,

I tested it further with models with different complexity. Yes in some cases the delay is not long enough. So e.g. when you start the play the sequence is not loaded yet- and this will explain the behavior what you mentioned in the log file.

In this case is better as mentioned to use only this setting which are necessary in the particular case ( e.g. if not required not to set the pvz)

Another option is to split the call. When you set the model - the sequence setting could be done in the modelLoad event. When you set a sequence you can call then the step setting and play in the sequenceloaded event

Here is an example which was working with a large model on IOS and Android:

// $scope, $element, $attrs, $injector, $sce, $timeout, $http, $ionicPopup, and $ionicPopover services are available
$scope.ExecuteWhenSequenceLoaded=false;
$scope.SequenceModelWidget='';
$scope.SequenceStepNr=1;

$scope.testClick= function () {
$scope.app.playModelStepPvz("engine_test_exp","Figure 1","model-3",3 )
}

//////////////
//definition of the function
$scope.app.playModelStepPvz = function (pvz,sequence,modelName,step_number ) {
 
//pvz file
//sequnece -sequnece name e.g. TestFigure1 - as shown in UI
//modelName - model name e.g. model-1 widget
//step_number - set this number to current step
 
 
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'src',  '');});   
  $timeout(function () {
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'src', 'app/resources/Uploaded/'+pvz +'.pvz');});
  },50);
  $timeout(function () {
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'sequence',  '');});    
  },150);
  $timeout(function () {
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'sequence',  'app/resources/Uploaded/l-Creo 3D - '+sequence +'.pvi');});     
  },250);
  $scope.ExecuteWhenSequenceLoaded=true;
  $scope.SequenceModelWidget=modelName;
  $scope.SequenceStepNr=step_number;

  
   //angular.element(document.getElementById(modelName)).scope().play(); }, 100);
};
//
$scope.$on("sequenceloaded", function (evt, arg) {
   
  if($scope.ExecuteWhenSequenceLoaded)
  if(arg == $scope.SequenceModelWidget)
   $timeout(function () {     
  $scope.$applyAsync(()=>{$scope.setWidgetProp($scope.SequenceModelWidget, 'currentStep', parseInt($scope.SequenceStepNr));});

                      }
           , 50);
       $scope.$applyAsync();
 
 $timeout(function () {
  
 $scope.app.fn.triggerWidgetService($scope.SequenceModelWidget,"play");
 }, 250)
//because I use the variable I will reset them with a delay
// this is   not the best program stile
   $scope.$applyAsync();
$timeout( function () {
 $scope.ExecuteWhenSequenceLoaded=false;
$scope.SequenceModelWidget='';
$scope.SequenceStepNr=1;},900)
});

 

Re: Sequence animations on hololens

I did not test it on the HoloLens 2. Please, let me know if the last code is not working  on the HoloLens 2, then I could test on this device - HL2

Re: Sequence animations on hololens

Hi Roland,

 

This is still not working on the HL2. It works in vuforia studio preview. But I'm still getting the same couple of lines from the log file:

 

 

2020-12-08T08:13:58.792+11:00 [Debug] javascript - loadPVI failed with data: [WinRTError: Element not found.
]
2020-12-08T08:13:58.792+11:00 [Debug] javascript - roller_handle failed to load pvi app/resources/Uploaded/l-Creo 3D - Figure 1.pvi

 

 

Could you please test your code on the hololens 2?

Re: Sequence animations on hololens

We were able to solve the issue.

 

We found that hololens wasn't able to locate the PVI file within the PVZ the same way mobile devices do.

 

So to get around this we had to open the pvz file with 7zip, extract the pvi file and upload it within vuforia.

 

Another issue that was solved as a result of this workaround was the naming of figures created in Illustrate. We had to ensure that when we published the pvzs from Illustrate, the figures had to have unique names for the function to work.

View solution in original post

Re: Sequence animations on hololens

Thanks for the feedback.

Actually in old Studio version we needed to unzip the pvz - rename to zip and open with any zip file (ok without renaming if the program will recognize the pvz file  as compressed file) . This will be used   still in same cases   as workaround. But I think if the direct binding from button click event  to the play service is working - in this case it should also work with JS: What I think here is that for the direct binding it always all properties are already  set – e.g.  the sequence step and pvz etc.  / in case with javascript code –  here we need to  set all of these properties. Therefore I think this could be some kind of a synchronization issue or some problem with the name of the sequence - path or any characters. Sometimes we can try to use some URL encoding (encodeURIComponent() -example on https://www.w3schools.com/tags/ref_urlencode.ASP)

Announcements
Join an
AR Working Group!

Topics available:
AR/VR for Data Optimization AR/VR for Security and Control AR/VR for Inspection