Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Event Name (evt.name) | Description | Arguments and Usage Notes | Example |
newStep | Triggered by going to a new step in an animation sequence. | arg1 (text) of the following form: (<step#>/<total steps>) <step name> For example: (4/8) Step 4 -remove case | $scope.$on('newStep', function(evt, arg) { $scope.view.wdg['label-1']['text'] = $scope.view.wdg['label-1']['text'] + " evt: " + evt.name + " arg: " + arg ;}); |
So i am using this event newStep as above complete description is given.
MY USECASE:
I have two sequences in my animation and each has different steps so for example I have declared my array in home.js --> MAIN ARRAY= [1,2,3,4,5]
Sequence 1 = [1,3,5]
Sequence 2 = [2,4]
Now according to the selection of the sequence either it is sequence 1 or sequence 2 I will fill my temp array and just go on those steps.
My function below newStep to get the steps from the animation and then match with my MAIN ARRAY and then get only steps which we have in the sequence which we have selected.
$scope.$on("newStep", function (evt, arg) {
//Triggered by going to a new step in an animation sequence.
let currentStepName = arg.match(/\(\d+\/\d+\) (.*)/)[1];
let currentStepElement = MainArray.find((x) => x.stepName == currentStepName);
if (!currentArray[arg.match(/\d+/)[0]]) {
currentArray[arg.match(/\d+/)[0]] = currentStepElement;
}});
Now my second function for the playing of the animation with the play service from the model is as below:
$scope.playBtnPressed = function () {
//original function
$scope.view.wdg['model-1'].currentStep = currentStep;
$timeout(function () {
$scope.app.fn.triggerWidgetService("model-1", "play");
}, 500);
};
now when i click on the play button which executes the service of Play from the model. It changes my step also like what i am doing with the forward function. for example if i am on step 1 and click play button then it moves to step 2. WHY IS LIKE THAT?
forward function ( which performs to go the next step)
$scope.stepForward = function () {
// set the marker for newStep
if (currentStep < maxSteps) currentStep++;
$scope.setWidgetProp("model-1", "currentStep", currentStep);
I am looking for the brief answers with the information as much as you can give. I am new to vuforia studio world.
My Vuforia version : 9.11.4.0
Is there a reason you didn't just create two Figures in Creo Illustrate? One for each sequence? That way the sequences are separated more effectively than what you're trying to do here. However, in my experience, what you're doing should work. We've done something similar before, but we use JSONs instead of arrays. I don't think that would change anything, but it works well enough for us.
I have already created a two sequences and onselection i can select them but there is an array where i iterate with the sequence from animation and get things done.
if i understood the question correctly u need to use switch case here in javascript it will work.
check with these links.