Skip to main content
1-Visitor
March 9, 2020
Question

I need label and arrow to be visible till the finish of current sequence.

  • March 9, 2020
  • 2 replies
  • 990 views

Hi,

 

I need label and arrow to be visible till the finish of current sequence and then go invisible once the particular step in that sequence finishes. 
For eg:

If i am playing step1 in sequence of step. the label and arrow pertaining to step1 should be visible till the finish of that particular step and then go inivisble and step2 label must appear.

 

Is it possible to do through the script. if yes please help me out with that.

 

Thanks

2 replies

21-Topaz I
March 9, 2020

Hi @Nithin ,

 

I think this could be done when you use the stepstarted and stepcomleted events. So you can check which is the current stepnumber and then in a switch construct disable or enable the appropriate step labels:

 

/////////////////////////////// 'stepcompleted'
$scope.$on('stepcompleted', function(evt, arg1, arg2, arg3) { 
 var parsedArg3 = JSON.parse(arg3);
 console.warn(arg3);
 
 
 console.log("stepcompleted stepNumber="+parsedArg3.stepNumber);
 
 if(parsedArg3.stepNumber) {
switch((parseInt(parsedArg3.stepNumber)+1).toString()) { next step
case '1' : blankAllLabels(); $scope.view.wdg['3DLable-1']['visible'] =true 
 break;
case '2': blankAllLabels(); $scope.view.wdg['3DLable-2']['visible'] =true 
 break;
...
}


}

}); 
/////////////////////////////////////////////////////////////////
$scope.$on('stepstarted', function(evt, arg1, arg2, arg3) { 
 var parsedArg3 = JSON.parse(arg3); 
 console.warn(arg3); 
 
 console.log("stepstarted stepNumber="+parsedArg3.stepNumber);
 if(parsedArg3.stepNumber) {
switch(parsedArg3.stepNumber) {
case '1' : blankAllLabels(); $scope.view.wdg['3DLable-1']['visible'] =true 
 break;
case '2': blankAllLabels(); $scope.view.wdg['3DLable-2']['visible'] =true 
 break;
...
} 
 
}); 

So in the envents callback you can used the arguments  to find out which is the played step , but it is also possible to use the current step of the modelwidget:

view.wdg["model-1"].currentStep

 

 

1-Visitor
March 12, 2020

HI @Nithin 

You can use the following code in order to acheive the same:

 

$scope.showStepDesc = function() {

if ($scope.view.wdg['model-2']['sequence'] == "app/resources/Uploaded/l-Creo 3D - 3.pvi") {
var stepNo = $scope.view.wdg['model-2'].currentStep;

$scope.view.wdg['stepLabel'].visible = true;


if (stepNo == 1){
$scope.view.wdg['stepLabel'].text = 'Step.1. Unscrew all the nuts on top plate and piston rod and remove the washers.'

$scope.setWidgetProp('image-12', 'visible', true);
}

if (stepNo == 2){
$scope.view.wdg['stepLabel'].text = 'Step.2. Remove the top plate with the valve.'

$scope.setWidgetProp('image-12', 'visible', false);
}
if (stepNo == 3){
$scope.view.wdg['stepLabel'].text = 'Step.3. Seperate the piston assembly from the rest of the body.'
}
if (stepNo == 4){
$scope.view.wdg['stepLabel'].text = 'Step.4. Remove the seal and check for any failure.'

}}

 

 

 

 

where '3' = name of the sequence

'stepLabel' = stuido id of the 2d label

'image-12' = studio id of 3d image to be displayed and hide.