0

I am working on CATScript in optimization of a part.

When I run the script everytime it shoud provide numbers in ascending order.

For example if I run the program for the first time it should provide the output as " 1 " and if I run the program again it shoud provide the output as " 2 " and so on.

I am stuck with this and I could not figure out th logic that we have to use here.

Looking forward for your help.

Thank you!!

user3714887
  • 77
  • 3
  • 16
  • why is MATLAB a tag? – Benoit_11 Dec 03 '14 at 16:07
  • I have interfaced CATIA and MATLAB in my project if i get the logic i can either implement in CATScript or in MATLAB.. – user3714887 Dec 03 '14 at 16:10
  • I'm not really familiar with the workflow between programs, but you can keep a variable external to your script (either in the base workspace or in an external file) that you iterate every run. – sco1 Dec 03 '14 at 16:16

2 Answers2

1

An option (matlab based) could be to save a counter variable to a .mat-file at the end of the script, which is then loaded again at the beginning of the script.

That would allow you to keep track of how many times the script have been run.

Christian
  • 61
  • 4
0

In CATIA if it is being run multiple times on the same part/product, you could add a hidden, integer parameter to the specification tree and increment it each time the macro is run.

Another, more generic way would be to create a text file on the user's local and update the number in the text file.

Lardman363
  • 23
  • 7