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

Play two sequence by two different Buttons

SOLVED
Highlighted
Regular Member

Play two sequence by two different Buttons

Hello,

i create two sequences and i want to play the sequences by two different buttons.

I found a post there is similar to this topic, but it doesn´t work.

Does anyone has a demo project, where that is shown or can explain how it works?

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Play two sequence by two different Buttons

Hi @DenGrz,

 

If I understand you correctly, do you mean that you have a single 3D model with two sequences created, and you would like to play each of them with different buttons?

 

If yes, you can achieve this with the following code. Do not assign any sequence to your model first and leave it as blank.

$scope.playSequence1 = function() {
  
  $scope.view.wdg['model-1']['sequence'] = '<sequence-1>.pvi';
  $scope.$applyAsync();
  
  $timeout(function() {
    $scope.$broadcast('app.view["model-1"].svc.playAll')
  }, 400)
}

$scope.playSequence2 = function() {
  
  $scope.view.wdg['model-1']['sequence'] = '<sequence-2>.pvi';
  $scope.$applyAsync();
  
  $timeout(function() {
    $scope.$broadcast('app.view["model-1"].svc.playAll')
  }, 400)
}

 

Replace <sequence-1>.pvi and <sequence-2>.pvi with your own sequences. Then, create two buttons to trigger the two functions (playSequence1() and playSequence2() ) respectively.

 

If you want to reset the model animation, you can remove its sequence with the following function.

$scope.resetSequence = function() {
  $scope.view.wdg['model-1']['sequence'] = '';
}

 

Hope this helps.

 

View solution in original post

2 REPLIES 2
Highlighted

Re: Play two sequence by two different Buttons

Hi @DenGrz,

 

If I understand you correctly, do you mean that you have a single 3D model with two sequences created, and you would like to play each of them with different buttons?

 

If yes, you can achieve this with the following code. Do not assign any sequence to your model first and leave it as blank.

$scope.playSequence1 = function() {
  
  $scope.view.wdg['model-1']['sequence'] = '<sequence-1>.pvi';
  $scope.$applyAsync();
  
  $timeout(function() {
    $scope.$broadcast('app.view["model-1"].svc.playAll')
  }, 400)
}

$scope.playSequence2 = function() {
  
  $scope.view.wdg['model-1']['sequence'] = '<sequence-2>.pvi';
  $scope.$applyAsync();
  
  $timeout(function() {
    $scope.$broadcast('app.view["model-1"].svc.playAll')
  }, 400)
}

 

Replace <sequence-1>.pvi and <sequence-2>.pvi with your own sequences. Then, create two buttons to trigger the two functions (playSequence1() and playSequence2() ) respectively.

 

If you want to reset the model animation, you can remove its sequence with the following function.

$scope.resetSequence = function() {
  $scope.view.wdg['model-1']['sequence'] = '';
}

 

Hope this helps.

 

View solution in original post

Highlighted

Re: Play two sequence by two different Buttons

Hello @WilsonT ,

 

sorry for the last reply.

I test the code and works now perfect.

 

Thanks a lot.

Announcements
Join an
AR Working Group!

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