How to modify tolerance script in macro

  • 29 December 2021
  • 4 replies
  • 171 views

I want to use macro do automatic tolerance analysis, could i modify the tolerance script code in macro code. how to do it if could. thanks!


4 replies

Userlevel 4
Badge +3

Do you mean that you want your macro to open and edit your tolerance script? Or you want a macro to run a tolerance analysis using a pre-defined tolerance script?

Do you mean that you want your macro to open and edit your tolerance script? Or you want a macro to run a tolerance analysis using a pre-defined tolerance script?

I want to use macro open and edit tolerance script.

Userlevel 6
Badge +2

Hi Lei,

 

I don’t think this is possible, but the tolerance scripts are just text-files. You can open them with any programing langages, and make modifications to it. Then, you could save the different tolerance scripts you want and have a macro run through those. Alternatively, is the ZOS-API a possibility for you or you don’t want to get into this at all?

If you tell us what you want to do in more details, it is easier to come up with an example for you.

Take care,

 

David

Userlevel 6
Badge +2

Hi @lei.song ,

To add on to what David said - since tolerance scripts are just text files, you do have the option of reading them into the ZPL with the file I/O commands we provide. For example, READSTRING will read a full line from a text file into the ZPL. Additionally, the command OUTPUT will allow you to choose where to write your PRINT commands - either to the screen, or to some external file. Finally, you can use string functions like $LEFTSTRING(A$, n) to modify a line. 

All of these commands can be used to modify or create a new tolerance script through the ZPL as David mentioned. 

What do you want to edit within the tolerance script? Maybe there’s an easier way to achieve what you’re looking for.

Reply