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
Warning: This is a massive bodge, however i could not see any other method for doing it.
- Goto http://bl.ocks.org/veggielane/raw/449293ab850608d73a93/
- Change the String Length, String Param and Output Param.
- The String Param is the Input parameter name.
- Copy all the relation text.
- Paste it into the relations dialog in Creo.
The source can be viewed: https://gist.github.com/veggielane/449293ab850608d73a93
- 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.