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

Switching between sequence using buttons in vuforia studio

SOLVED
Highlighted
Aquamarine

Switching between sequence using buttons in vuforia studio

My pvz file of model contains two sequences. I want to place 2 buttons on 2D canvas which will choose which sequence to play. For example button-1 should play 'sequence-1' and button-2 should play 'sequence-2'.

 

Any suggestion would be appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Switching between sequence using buttons in vuforia studio

Hi @potatochips 

Actually I didn't understand your query. As far as my query is concerned i used the following code to solve the problem-

 

$scope.sequence2 = function () {

$scope.view.wdg['model-1']['sequence'] = 'app/resources/Uploaded/l-Creo 3D - 2.pvi';
//reset it only if you want to interrupt a playing step otherwise is not necessarily

$scope.$applyAsync(()=>{angular.element(document.getElementById('model-1')).scope().reset();});
//does not work synchronously
//$scope.view.wdg['model-1']['currentStep']=2;
//delay of .5 sec to be sure that all action are done
$timeout(function () {
$scope.$applyAsync(()=>{$scope.setWidgetProp('model-1', 'currentStep', 2);});
//further delay for a 0.5 sec to be sure that the step is set and then play
$timeout(function () {$scope.$root.$broadcast('app.view["Home"].wdg["model-1"].svc.play'); }, 500);
}, 500);

};

 

 

Hope this helps..

View solution in original post

5 REPLIES 5
Highlighted

Re: Switching between sequence using buttons in vuforia studio

Hello Vivekse,

 

I think that the best is to have a custom javascript function who runs the sequence.

 

  1. Use a similar code in the javascript :
$scope.playSequence = function (sequence_file, time) {
   $scope.setWidgetProp('myModel', 'sequence', sequence_file);
   $scope.playMyAnimation(time);
}

$scope.playMyAnimation = function (timer) {
  $scope.$applyAsync();
  $timeout(function() {
     $scope.$boradcast('app.view["model"].svc.playAll')
  }, timer);
]

     2. In buttons, in Click event, click js button

     3. In button A, add this javascript code :

 

playSequence('MySequenceName', '4000');

      Where MySequenceName is a value similar to this format : MySequenceName.pvi.

      It is a filename with extension .pvi who can be found in pvz file exported from Creo Illustrate.

      A pvz file can be opened in zip archive editor to look inside it!

      4000 is the time in millisecond of the duration of the Sequence.

     4. Repeat the same step as at step 3 but change the parameters given to the function playSequence 

 

Best regards,

Samuel

Highlighted

Re: Switching between sequence using buttons in vuforia studio

hi, i have a question.

Capture1.PNG

in the sequence tab, what should I put there? 

Highlighted

Re: Switching between sequence using buttons in vuforia studio

Hi @potatochips 

Actually I didn't understand your query. As far as my query is concerned i used the following code to solve the problem-

 

$scope.sequence2 = function () {

$scope.view.wdg['model-1']['sequence'] = 'app/resources/Uploaded/l-Creo 3D - 2.pvi';
//reset it only if you want to interrupt a playing step otherwise is not necessarily

$scope.$applyAsync(()=>{angular.element(document.getElementById('model-1')).scope().reset();});
//does not work synchronously
//$scope.view.wdg['model-1']['currentStep']=2;
//delay of .5 sec to be sure that all action are done
$timeout(function () {
$scope.$applyAsync(()=>{$scope.setWidgetProp('model-1', 'currentStep', 2);});
//further delay for a 0.5 sec to be sure that the step is set and then play
$timeout(function () {$scope.$root.$broadcast('app.view["Home"].wdg["model-1"].svc.play'); }, 500);
}, 500);

};

 

 

Hope this helps..

View solution in original post

Highlighted

Re: Switching between sequence using buttons in vuforia studio

hi,

can you send the project file for this?

Highlighted

Re: Switching between sequence using buttons in vuforia studio

If u want swiching steps with the help of different buttons try to use this method.

 

https://community.ptc.com/t5/Vuforia-Studio/Creating-Buttons-For-Each-Step/m-p/645641 

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