Creo String to Integer or Real Number Relation

I recently needed a method for converting a string parameter to an integer in Creo. So I created a script to generate a (rather long) relation to do the job.
There is the itos function which performs the opposite, so treat this as a stoi function.

Warning: This is a massive bodge, however i could not see any other method for doing it.


The source can be viewed:


  • Only works on a known length string.
  • Only works on whole numbers (but can output to a Real Number parameter).
  • To output to an Integer create the output parameter before adding the relation (it defaults to real).
  • For long strings the relation can get quite large, and i am unsure about the performance hit.