Start and stop recording python scripts
Rupert (Moderator (AUS)) 6 aastat tagasi Scripting • uuendaja fbilki (Moderator / Admin (AUS)) 6 aastat tagasi • 3
Are there python commands to start and stop recording the Micromine activity? I am using python to loop through kriging runs and thought it might be useful to automatically start recording the full process and then save that script at the end.
Customer support service by UserEcho
I can't quite tell what kind of script you have right now: you're obviously using Python for loop control, but how have you set up the individual kriging runs? Are you calling a macro from within your loop using MMpy.Macro.run()? Or did you record the kriging dialog as a script?
On the assumption that your script calls a macro, and you want to record the macro steps, you can easily do that by enabling the Record Script option (Scripting | Record Script) before running your script. It won't re-record the script steps, but it will record the macro steps just like any other macro recording. Just reselect the Record Script option to stop recording; Micromine will then prompt you to save the new script.
And, of course, you can use Record Script to record any macro, as well as interactive steps.
Lastly, just to cover off all bases in case I misunderstood the question: because MM doesn't re-record existing scripts, you won't be able to re-record your kriging runs if they're already scripted.
I hope this helps.
I recorded running a kriging form using the record script function and then modified that script to allow substitutions. When I want to krig I use a 'master' python script to generate all substitutions for each kriging run and feed each of the run parameters to the krig form script.
My question was whether I can use python to start and stop recording a python script whilst running the 'master' script. This would be a python MM function that is equivalent to me pressing the "Start or stop recording a python script" button and it would record every MM action my 'master' script made.
I don't use MM macros much any more but maybe a Scripting | Record Script function would be useful for them too?
It was just a thought.
Thanks for the explanation, Rupert.
"whether I can use python to start and stop recording a python script whilst running the 'master' script"
This is the same as the re-recording comment I made, so unfortunately the answer is no.
"I don't use MM macros much any more but maybe a Scripting | Record Script function would be useful"
Yes, it would definitely be useful. It's one of the many things on our to-do list.