Community Tip - You can change your system assigned username to something more personal in your community settings. X
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.
Solved! Go to Solution.
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..
Hello Vivekse,
I think that the best is to have a custom javascript function who runs the sequence.
$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
hi, i have a question.
in the sequence tab, what should I put there?
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..
hi,
can you send the project file for this?
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