hexagon logo

How to set decimal place when exporting into txt file?

I am creating a script that will get tracefield data and then create a file path and file using that data. I have that portion complete but the data from the dimensions going into the .txt are going out over 10 decimal places. How can I set the data to 3 decimal places rounded? Basically to match whatever the CMM report shows. I have the DISPLAYPRECISION set to 3.

Thanks
  • Only way I know of would be to pass every dimension into a variable and set the format with AssignV2=FORMAT("%.3f",V1), where V1 is the variable containing the value you want to format. 4 decimal places would be "%4.f", etc.

    Probably much easier to export to text file, then import that into excel, format the text, and either copy/paste or export. That is all stuff you can set up a macro for without too much trouble, but VBA for Excel is beyond the scope of this forum.

    OH...You could try using a feature set if these are all T values with a DOT product, then you would have one variable assignment to handle all the formatting. Not sure if that would work, I will try on my machine if I get time and get back to you.
  • Thanks Frazz but I am trying to avoid setting this in the actual PC-DMIS program. Is there a way to do this in Basic Script Editor or VB?
  • Are you going to put this stuff into excel? Because if you are then there really isn't any reason to do this through Cypress Enable (Hex's proprietary version of VB).