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

Display sequence step names from Creo Illustrate

Highlighted

Re: Display sequence step names from Creo Illustrate

You can cut of the first part e.g. '( 1/11)  ' with a regexp  so that you end up with just the title.

The code snippet would look like this:

var labelId = "label-1"; // ID of the Label widget that displays the Step progress and description text
// this $on event handler switches the label based on the the sequence definition
// the arg variable is of the following form: (<step #>/<total step #) <step name>
$scope.$on('newStep', function(evt, arg) {
  var arg2 = arg.match(\(\d+\/\d+\) (.*))[1];
  $scope.setWidgetProp( labelId, "text", arg2); // get the currentStep from the arg
});

Re: Display sequence step names from Creo Illustrate

Hmm... It gives me an error. 

a4485855-4e5b-42bc-be63-65572c05000e.png

Re: Display sequence step names from Creo Illustrate

You might try using the 'stepstarted' and/or 'stepcompleted' events instead of newStep. The arguments returned by those events are not concatenated together (as is the case with newStep), and also include a stepDescription which should be the 'notes' for the step from Creo Illustrate.

 

$scope.$on('stepstarted', function(evt, arg1, arg2, arg3) { 
  var parsedArg3 = JSON.parse(arg3);
  $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 ;
});

 

Re: Display sequence step names from Creo Illustrate

Wow. Great idea. Thanks a lot. 

Re: Display sequence step names from Creo Illustrate

I tried your solution but it works only with the chrome browser "preview" of Vuforia Studio. Not in normal use on my iPhone or Tablet. The View app just says: undefined

Re: Display sequence step names from Creo Illustrate

Yes, it appears that the notes/description field is currently only available in Preview mode, but hopefully will also be included in View on various devices in the future.

Re: Display sequence step names from Creo Illustrate

Note: if "Allow download for offline viewing" is activated, it won't run properly in offline mode. You might need to change

$scope.setWidgetProp(labelId, "text", arg)

into

$scope.view.wdg['labelId']['text']=arg;

I don't know why, but it worked for me.

Re: Display sequence step names from Creo Illustrate

With the mentioned events ('stepstarted' and/or 'stepcompleted' )will work fine but the  described method in the original post should still work. 

So to monitor the steps in a view I used a similar approach with RegEx expression and it works stable.

So the following definition:

/////////////
var stepArray = ['0-Start Step',
                 '1-DoorLock installation', 
                 '2-mount the DoorFrame',
                 '3-Assemble the Isolation', 
                 '4-Assemble the Door panel',
                 '5-Assembly the Door Handles', 
                 '6-Check the Door Mechanism and clean',
                 'step 6', 
                 'step 7'];

$scope.$on('newStep', function(evt,arg) {
 console.debug("console.debug: $scope.$on -> newStep:".concat("started") );
 var getStepRegex = /\((\d*)\//; 
 console.log("console.log():".concat(arg));
 console.info("console.info():getStepRegex.exec(arg)[0]=".concat(getStepRegex.exec(arg)[0]) );
 console.warn("console.warn():getStepRegex.exec(arg)[1]=".concat(getStepRegex.exec(arg)[1]) );
 $scope.message = getStepRegex.exec(arg)[1];
 console.info('message='+$scope.message);
  console.info('modelXrotation='+$scope.modelXrotation);
}); 

Object.defineProperty($scope, 'message', {
  get: function () { return _message; },
  set: function (step) {
  if(stepArray[step]) {
    //_message = step + ': ' + stepArray[step];
    _message = 'PLAY STEP: ' + stepArray[step];
  } else {
    _message = "Something going wrong- retry,please!";
  }

The code above will print for e.g. step nr. 2 the following messages into the console (Str +Schift +I):

console.log():(2/7) Step 2
console.info():getStepRegex.exec(arg)[0]=(2/
console.warn():getStepRegex.exec(arg)[1]=2
message=PLAY STEP: 2-mount the DoorFrame

And it will update correctly the 3d Label with the correct instruction (picutre bellow for steps 1 ... 3 and 5)

2018-09-26_13-11-53.jpg

Re: Display sequence step names from Creo Illustrate

The description field is also not comming on  a HoloLense device.

So In Creo Illustrate (e.g. 5.0) we can define a text note to a step.

2018-10-02_15-48-34.jpg

In the Preview of the Chrome browser we can received this text via arg3 which is a string containing a json -where we can find also the step note from Creo Illustate . So e.g. the code:

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;
}); 

will print in the debugging console in chrome some thing like :

2018-10-02_15-57-10.jpg

So the code will work fine in the preview and will set the label with the text from  the step note in  Creo Illustrate

2018-10-02_15-35-38.jpg

When we review the experience on the HoloLens device - the 3d label will not change. The reason is that the arg3 of the callback function by the stepstarted event will not contain the step note.  When we check the Vuforia view log on the HoloLense:

...
2018-10-02 05:22:05.266 -07:00 [Debug] Speech recognition result generated with confidence: High and text "test"
2018-10-02 05:22:05.266 -07:00 [Debug] event [test] broadcast on rootScope and dispatched against domID [] with type [], targetName [] and data []
2018-10-02 05:22:05.286 -07:00 [Debug] event [stepcompleted] broadcast on rootScope and dispatched against domID [model-1] with type [null], targetName [model-1] and data [{"stepNumber":1,"stepName":"Step 1","nextStep":1,"totalSteps":5}]
2018-10-02 05:22:05.532 -07:00 [Debug] event [stepstarted] broadcast on rootScope and dispatched against domID [model-1] with type [null], targetName [model-1] and data [{"stepNumber":1,"totalSteps":5,"stepName":"Step 1"}]
2018-10-02 05:22:05.532 -07:00 [Debug] stepName=Step 1
2018-10-02 05:22:05.535 -07:00 [Debug] stepDescription=undefined
2018-10-02 05:22:05.535 -07:00 [Debug] nextStep=undefined
2018-10-02 05:22:13.892 -07:00 [Debug] event [stepcompleted] broadcast on rootScope and dispatched against domID [model-1] with type [null], targetName [model-1] and data [{"stepNumber":1,"stepName":"Step 1","acknowledge":false,"acknowledgeMessage":"TODO: figure out real acknowledge message","nextStep":2,"totalSteps":5}]
...

we can see that the arg3 argument contains the step number, next step, step name ... etc. but not the the step note.

To track the step number / name  and the total number of steps such code will work fine.  

Re: Display sequence step names from Creo Illustrate

Hello All,

 

I have managed to get the step names visible in Studio.

But I have some of those containing special character s (i.e. "é", "á"). Those are not showing correctly in the Studio preview.

Illustrate exports them fine, as I can judge from the .xlf file.

 

How can I get the correct values in Studio?

 

Thanks 

Announcements

Surveys are coming to the Vuforia Community!  Your feedback is valuable to us!  When prompted, please take our 60 second survey!