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

Step by step play button

RK_9880418
12-Amethyst

Step by step play button

Hi,

 

I have created three figures in Creo model. Figure 1 has three steps. So I want to bind the steps with different buttons. Example, step-1 button have to play, step-1 sequence. Same way step 2 button have to play step-2 sequence.

 

How to do this.

 

@JA @si 

3 REPLIES 3

Hi @RK_9880418 ,

you can try  to use a javascript some definition like this

//////////////
//definition of the function
$scope.app.playModelStep = function (sequence,modelName,step_number,play) {
//sequnece -sequnece name e.g. TestFigure1 - as shown in UI
//modelName - model name e.g. model-1
//step_number - set this number to current step
//play   true/false execute play for the model

 
$scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'sequence',  '');});


  $timeout(function () {
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'sequence',  'app/resources/Uploaded/l-Creo 3D - '+sequence +'.pvi');}); 
    
  },50);

  $timeout(function () {
     
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'currentStep', parseInt(step_number));});
  
 if(play)   //check if play should be applyed
  
 $timeout(function () {angular.element(document.getElementById(modelName)).scope().play(); }, 100);
                      }, 500);

};
/////////////////////////////////

so you can play it  e.g. for  Figure 1 in model-1 widget and step 3 via the call 

$scope.app.playModelStep("Figure 1","model-1",3,true)

 

So can define a extra callback for each  step or use the statment directly in the UI

2021-03-25_11-53-31.jpg

  

you need to bind 2 button with js

suppose for a Button 1 u need to bind it with model (Play all / play) and simultaneously need to right js code for sequence to play and similarly for button 2 also

With the code

$scope.playSpecificStep = function(step){
  $scope.view.wdg['model'].currentStep = step;
  $timeout(()=> twx.app.fn.triggerWidgetService("model", 'play'), 100)
}

 

For PlayButton1, Click JS: playSpecificStep(1)

For PlayButton2, Click JS: playSpecificStep(2)

 

Announcements

Top Tags