Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
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.
Solved! Go to Solution.
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.
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.