Skip to main content
1-Visitor
January 3, 2020
Solved

how to show the sequence on button rather than showing using squence list.

  • January 3, 2020
  • 1 reply
  • 2911 views

$scope.setSequenceList = function(){
$scope.app.params.sequencelist = [
{
"display":"FAN SERVICE",
"value":"app/resources/Uploaded/l-Creo 3D - FAN SERVICE.pvi"
}
,
{
"display":"FAN REPAIR",
"value":"app/resources/Uploaded/l-Creo 3D - FAN REPAIR.pvi"
}
,
{
"display":"HARNESS REPLACE",
"value":"app/resources/Uploaded/l-Creo 3D - HARNESS REPLACE.pvi"
}
]
}
$scope.setSequenceList();

$scope.selectSequence = function(){
console.log($scope.app);
if($scope.app.view.RepairSequence.wdg["sequence-select"].value){
$scope.app.view.RepairSequence.wdg["bottom-nav-grid"].visible = true;
$scope.app.view.RepairSequence.wdg["select-popup"].visible = false;
}
else {
$scope.app.view.RepairSequence.wdg["bottom-nav-grid"].visible = false;
$scope.app.view.RepairSequence.wdg["select-popup"].visible = true;
}}

 

This is the code i am using to show the sequence through sequnce select list.

Now i need to show each step on different button individually

Best answer by Swapnil_More

Hello Manoj,

Please change model ID and Step number so you can use this code.

Please find below code and read it carefully so you can get my point.

$scope.sequence1 = function () {


$scope.$applyAsync(()=>{angular.element(document.getElementById('Model-ID')).scope().reset();});
//does not work synchronously
//delay of .5 sec to be sure that all action are done
$timeout(function () {
$scope.$applyAsync(()=>{$scope.setWidgetProp('model-1', 'currentStep', your_step_number);});
//further delay for a 0.5 sec to be sure that the step is set and then play
$timeout(function () {$scope.$root.$broadcast('app.view["Home"].wdg["model-1"].svc.play'); }, 500);
}, 500);
};

1 reply

15-Moonstone
January 3, 2020

Hello Manoj,

As per your question, you want to add each step/sequence on different button

so please find below code for same.

 Please change Model Id & Step No. for same.

$scope.sequence1 = function () {


$scope.$applyAsync(()=>{angular.element(document.getElementById('model-1')).scope().reset();});
//does not work synchronously
//delay of .5 sec to be sure that all action are done
$timeout(function () {
$scope.$applyAsync(()=>{$scope.setWidgetProp('model-1', 'currentStep', 2);});
//further delay for a 0.5 sec to be sure that the step is set and then play
$timeout(function () {$scope.$root.$broadcast('app.view["Home"].wdg["model-1"].svc.play'); }, 500);
}, 500);
};
1-Visitor
January 3, 2020

Hello Swapnil,

Thanks for replying.

there is an issue encountered ,using this code i have to place three different model and then show the three sequence.

I just want to place one model and then show the three sequence in three different buttons.

 

Regards

Manoj

1-Visitor
January 4, 2020

Hello Swapnil,

Thanks For Replying on my query. As the code which you had shared has worked and i am able to show threedifferent sequence on three different buttons.

 

COde which i have used

///////////////
$scope.sequence2 = function () {
$scope.app.params.training_button = false;
$scope.app.params.configuration_button= false;

$scope.view.wdg['Repair_sequence']['sequence'] = 'app/resources/Uploaded/l-Creo 3D - 1.pvi';
//reset it only if you want to interrupt a playing step otherwise is not necessarily

$scope.$applyAsync(()=>{angular.element(document.getElementById('Repair_sequence')).scope().reset();});
//does not work synchronously
//$scope.view.wdg['Repair_sequence']['currentStep']=1;
//delay of .5 sec to be sure that all action are done
$timeout(function () {
$scope.$applyAsync(()=>{$scope.setWidgetProp('Repair_sequence', 'currentStep', 1);});
//further delay for a 0.5 sec to be sure that the step is set and then play
$timeout(function () {$scope.$root.$broadcast('app.view["RepairSequence"].wdg["Repair_sequence"].svc.play'); }, 500);
}, 500);

};
$scope.sequence3 = function () {
$scope.app.params.training_button = false;
$scope.app.params.configuration_button= false;

$scope.view.wdg['Repair_sequence']['sequence'] = 'app/resources/Uploaded/l-Creo 3D - 2.pvi';
//reset it only if you want to interrupt a playing step otherwise is not necessarily

$scope.$applyAsync(()=>{angular.element(document.getElementById('Repair_sequence')).scope().reset();});
//does not work synchronously
//$scope.view.wdg['Repair_sequence']['currentStep']=2;
//delay of .5 sec to be sure that all action are done
$timeout(function () {
$scope.$applyAsync(()=>{$scope.setWidgetProp('Repair_sequence', 'currentStep', 2);});
//further delay for a 0.5 sec to be sure that the step is set and then play
$timeout(function () {$scope.$root.$broadcast('app.view["RepairSequence"].wdg["Repair_sequence"].svc.play'); }, 500);
}, 500);

};

 

Thanks & Regards 

Manoj Pandey.