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

Re: Display sequence step names from Creo Illustrate

I had the same problem, and I found encoding and decoding the string seems to do the trick:

 

$rootScope.$on("newStep", function(evt, arg) {
  var text = decodeURIComponent(escape(arg.match(/\d*\)\s*(.*)$/)[1]));
  console.log("newStep: setting steptext to " + text);
  $scope.stepText = text;
});

Re: Display sequence step names from Creo Illustrate

Wait, I take it back. I just discovered that this approach doesn't work on many devices. Back to the drawing board...

Re: Display sequence step names from Creo Illustrate

So, it turns out, my solution works great in the browser preview, but it throws exceptions on iOS (at least some of the time). Happily, I found that on iOS I could just pass through the string and it would render correctly.

 

Here's a new version of the function that seems to work OK both in preview and on iOS:

$scope.$on("newStep", function (evt, arg) {
    var stepname = $scope.fixEncoding(arg);
    $scope.setWidgetProp("instruction","text", stepname);
  });

$scope.fixEncoding = function(str) {
  try {
    return decodeURIComponent(escape(str));
  }
  catch (ex) {
    // can't convert, just use string as-is
    return str;
  }
}