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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

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

manojpandey
13-Aquamarine

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

$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

ACCEPTED SOLUTION

Accepted Solutions

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);
};
Regards,
Swapnil More

View solution in original post

5 REPLIES 5

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);
};
Regards,
Swapnil More

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

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);
};
Regards,
Swapnil More

Hello Swapnil,

Thanks For replying,

$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', 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["Home"].wdg["model-1"].svc.play'); }, 500);
}, 500);
};
$scope.sequence12 = 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);
};
$scope.sequence123 = 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', 3);});
//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);
};

This Code i am using.

My model ID is model-1 and step no is 1

But still i have to select any one sequence in the model widget ,then only the sequence is playing.

For the other two buttons the same sequence is playing.

 

PFAI for refernce

 

Regards,

Manoj

 

 

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.

 

Announcements

Top Tags