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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

With a single Button click, I am not getting the animation coming in mobile version

Milan_900
8-Gravel

With a single Button click, I am not getting the animation coming in mobile version

Hello Team,

I created an experience for the mobile version, I am facing a problem when I click the buttons with a single click. I am not getting the animation coming; with a double click, it is coming. Anyone please support on this issue.

 

Advanced Thanks.

3 REPLIES 3

Hi @Milan_900 ,

I think this is possibly an issue of syncronisation. when you set the model source and later set the model sequence and then play, thuse will requires first to load the model, When the model is loaded then if the sequence / firgure is quite complex this also could require some time. First when the sequence is complete loaded you will be able to play all or to play particular step.

so what to do ->. The simples trival (but durty solution) is to check and to call this wiht some dealy

 

 

 $scope.app.playModelStepPvz("engine_test_exp-div-speed_High","Figure 1","model-1",3,true, 600)
//.... 
/// .... where the defintion
//definition of the function
$scope.app.playModelStepPvz = function (pvz,sequence,modelName,step_number,play) {
 //pvz file
 //sequnece -sequnece name e.g. TestFigure1 - as shown in UI
//modelName - model name e.g. model-1 widget
//step_number - set this number to current step
//play   true/false execute play for the model
  

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

  
   $timeout(function () {
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'src', 'app/resources/Uploaded/'+pvz +'.pvz');}); 
    
  },50);
  

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


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

  $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)
   //angular.element(document.getElementById(modelName)).scope().play(); }, 100);
                      }
           , 200+delay);


};


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

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


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

  $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)
 
                      }, 600);


};

 

So possibly you can use for each action a delay so that it is enough time to set the model and to load the sequence and then to be able to play

but I think better appraoch or  for the case that with delay will not work because you do knot know how complex is the sequence - in this case you some events , then in the click button javascript we can set the sequence and then try to set some variable saying play event … so that the event sequence loaded will check this variable and will call the play service of the widget

 

 

 

/==========================================

// in the function which will load the sequence

$scope.app.wdgName=”model-1”

$scope.app.play =true

…

…

$scope.$on("sequenceloaded", function (evt, arg) {

if ($scope.app.play==true) $timeout(() =>{

$scope.$applyAsync();
$scope.app.fn.triggerWidgetService( $scope.app.wdgName,"play");
},100)

$scope.app.play =false

});

//==========================================

 

 

further more for the case that you have larger pvi files as models then you can do more advance the process using different events

- for the model widget loading you can use the modelLoad event. It could check which model is loaded and to set the sequence here. and in the sequence event as already mentioned above to play the step

 

 

 

//=======================================================================================
$rootScope.$on("modelLoaded", function() {
 
 for (var  i= 0; i < arguments.length; i++) 
   {
    console.log('Argument ['+i+']='+arguments[i]);
 }

  if (arguments.length >1){ 
    //==================  modelWidget model loaded
    var modelWidgetId=arguments[1];  
    let model_wdg= $scope.view.wdg[modelWidgetId];    
    let mdlsrc=$scope.getWidgetProp(modelWidgetId,'src');
    console.log( "mdlsrc="+mdlSrc); 
  
}
})

 

 

Here a HL2 test project (saved with 9.16.1)where the sequenceloaded event was used to play all sequnece steps when the sequence was loaded

Hi @Milan_900 ,

as requested I did converted the sample project for the Hololens as mobile project. Also example is more adapted based on your sample code handling click on 3DImage widget

Top Tags