The PTC Community will be on read only status starting March 23rd in preparation for moving our platform to a new provider. Read more here
How to bring notes written in creo illustrate while creating sequence in vuforia studio by Javascript.I have written saftey precautions in notes while creating steps in sequence. I want to display it in Vuforia studio while running sequence in View app. How to do it with Javascipt?
Can please anyone suggest the code for this?
Hi @InfinityX
So far I know , in generally 2d annotaitons are not available/ in Studio newStep event .
But for the step started and stepfinished events- I think there are some parameters which we can use / and the note form Creo /In UI in the parameter tab is also comming
You can test with some code like this:
var _stepDescription; // private member
Object.defineProperty($scope,"stepDescription",{
get: function() { return _stepDescription; },
set: function(value) { _stepDescription = value;
if(_stepDescription) $scope.setWidgetProp("3DLabel-1", "text", _stepDescription); }
});
$scope.$on('stepstarted', function(evt, arg1, arg2, arg3) {
var parsedArg3 = JSON.parse(arg3);
console.warn(evt);
console.warn(arg1);
console.warn(arg2);
console.warn(arg3);
console.log("stepName="+parsedArg3.stepName);
console.log("stepDescription="+parsedArg3.stepDescription);
console.log("nextStep="+parsedArg3.nextStep);
$scope.stepDescription=parsedArg3.stepDescription;
//$scope.view.wdg['label-1']['text'] = "Event: " + evt.name + " arg3 fields, name: " + parsedArg3.stepName + " duration(ms): " + parsedArg3.duration + " total steps: " + parsedArg3.totalSteps + " step desc: " + parsedArg3.stepDescription ;
});
The arg3 contains the more relevant information - here e.g. :
{"stepNumber":2,"stepName":"Step 2",
"stepDescription":"Notiz zu step2",
"duration":6878,
"acknowledge":false,
"acknowledgeMessage":"",
"totalSteps":5,
"nextStep":3}
The example above show the usage /arguments for stepstarted
But it should the same also for stepcompleted - difference is that the one event is stated on step start and the other as the step is completed and also ,may be , there are some parameter in the arg3 different / next step ... etc , not sure/ but you can check it by simple print it to the console with console warn().
Example for stepcompleted:
/////////////////////////////// '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) {
$scope.app.params['my_current_step']=parsedArg3.stepNumber;
my_play_loop(parseInt(parsedArg3.stepNumber),5000);}
});
