Skip to main content
1-Visitor
March 2, 2021
Question

Interact with a widget in a specific step in a certain sequence

  • March 2, 2021
  • 1 reply
  • 1716 views

Hi All,

 

I usually use the following code for making appear and disappear the widgets in a specific step in sequence:

 

$scope.$on('newStep', function() {
 
 switch($scope.view.wdg['model-3']['currentStep']) {

 case 3:
 $scope.setWidgetProp( "Warning", "text", 'Note: Only for T200 & T600 Series');
 break;
 }
});


However, this time in model-3 I have three different sequences and not just one. With this code, the widgets appear in all the sequences. What can I add to specify the sequence?

Thank you!

1 reply

21-Topaz I
March 2, 2021

May be you can try some thing like:

 

 

$scope.$on('newStep', function() {
 if($scope.view.wdg['model-3']['sequence'] == 'app/resources/Uploaded/l-Creo 3D - fig_5F1.pvi') 
//go to switch construct only if model wdiget has sequence fig_5F1 
 switch($scope.view.wdg['model-3']['currentStep']) {

 case 3:
 $scope.setWidgetProp( "Warning", "text", 'Note: Only for T200 & T600 Series');
 break;
 }
});

 

 

So means you will execute the switch statement only if the model widget sequence property == fig_5F1

21-Topaz I
March 3, 2021

for the compression statement , may be , is better to compare only a string is practically contained by the sequence

something like e.g. using indexOf  like:

 if($scope.view.wdg['model-3']['sequence'].indexOf("Figure 1") != -1) 
 //go to switch construct only if model wdiget has sequence Figure 1
 switch($scope.view.wdg['model-3']['currentStep']) {
 ....

 

1-Visitor
March 3, 2021

Thank you so much! It worked great!