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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Retrieve sequence stepname by index

Tony_Nystrand
4-Participant

Retrieve sequence stepname by index

Hello,

 

I know that it's possible to retrieve the stepname (created in Creo Illustrate) by listening for the "stepstarted" event or with "newStep" event.

But what if I like to e.g. generate a list with all the steps in the current loaded sequence, can that be done?

Is it possible to read the stepname of a specific sequence step based on an index number?

 

Cheers,

Tony

ACCEPTED SOLUTION

Accepted Solutions

Hi @Tony_Nystrand ,

 

currently I am not aware that you could get such list inside a Vuforia studio without playing the whole sequence , at least one time.  It could be possible the first time when a model is used/loaded  to start a temporary playAll call of a sequence and then to save the info anywhere as property.

Possible methods are :

 

/////////////////////////////////step completed /////////////////////
scope.$on('stepcompleted', function(evt, arg1, arg2, arg3) { 
 var parsedArg3 = JSON.parse(arg3);
  console.log("stepcompleted stepNumber="+parsedArg3.stepNumber + "  nextStep="+parsedArg3.nextStep);
 
$scope.app.stepNumber=parseInt(parsedArg3.stepNumber);
$scope.app.nextStep=parseInt(parsedArg3.nextStep);
$scope.app.duration=parseFloat(parsedArg3.duration);
$scope.app.stepActive=false;      
  $scope.app.setInActive=false;
}); 
/////////////////////////////////step started /////////////////////
$scope.$on('stepstarted', function(evt, arg1, arg2, arg3) { 
 var parsedArg3 = JSON.parse(arg3); 
console.log("stepstarted stepNumber="+parsedArg3.stepNumber);
 $scope.app.stepNumber=parseInt(parsedArg3.stepNumber);
$scope.app.nextStep=parseInt(parsedArg3.nextStep);
$scope.app.duration=parseFloat(parsedArg3.duration);  
}); 
/////////// new Step /////////////////////////////////////////
$scope.$on('newStep', function(evt,arg) {
 console.debug("console.debug: $scope.$on -> newStep:".concat("started") );
 var getStepRegex = /\((\d*)\//; 

 $scope.message = getStepRegex.exec(arg)[1];
 console.info('message='+$scope.message);
 //will print the current step

}); 

So as mention when we call playAll for a sequence  and this case we will get information about all steps /when we use one of the events /callback mention above

Of course you can use some info e.g. a json file which is extracted from a .pvz model file directly .

One example how to extract such data is mention in the posts:

 

[How to extract the components with properties from a pvz file] and [Extracting the viewables and the seqnece steps information from a .pvz file for the usage in TWX]

View solution in original post

1 REPLY 1

Hi @Tony_Nystrand ,

 

currently I am not aware that you could get such list inside a Vuforia studio without playing the whole sequence , at least one time.  It could be possible the first time when a model is used/loaded  to start a temporary playAll call of a sequence and then to save the info anywhere as property.

Possible methods are :

 

/////////////////////////////////step completed /////////////////////
scope.$on('stepcompleted', function(evt, arg1, arg2, arg3) { 
 var parsedArg3 = JSON.parse(arg3);
  console.log("stepcompleted stepNumber="+parsedArg3.stepNumber + "  nextStep="+parsedArg3.nextStep);
 
$scope.app.stepNumber=parseInt(parsedArg3.stepNumber);
$scope.app.nextStep=parseInt(parsedArg3.nextStep);
$scope.app.duration=parseFloat(parsedArg3.duration);
$scope.app.stepActive=false;      
  $scope.app.setInActive=false;
}); 
/////////////////////////////////step started /////////////////////
$scope.$on('stepstarted', function(evt, arg1, arg2, arg3) { 
 var parsedArg3 = JSON.parse(arg3); 
console.log("stepstarted stepNumber="+parsedArg3.stepNumber);
 $scope.app.stepNumber=parseInt(parsedArg3.stepNumber);
$scope.app.nextStep=parseInt(parsedArg3.nextStep);
$scope.app.duration=parseFloat(parsedArg3.duration);  
}); 
/////////// new Step /////////////////////////////////////////
$scope.$on('newStep', function(evt,arg) {
 console.debug("console.debug: $scope.$on -> newStep:".concat("started") );
 var getStepRegex = /\((\d*)\//; 

 $scope.message = getStepRegex.exec(arg)[1];
 console.info('message='+$scope.message);
 //will print the current step

}); 

So as mention when we call playAll for a sequence  and this case we will get information about all steps /when we use one of the events /callback mention above

Of course you can use some info e.g. a json file which is extracted from a .pvz model file directly .

One example how to extract such data is mention in the posts:

 

[How to extract the components with properties from a pvz file] and [Extracting the viewables and the seqnece steps information from a .pvz file for the usage in TWX]

Announcements

Top Tags