08-16-2018 08:56 AM
Hi,
I was wondering if there was an existing way to print or save real time sequence code as it appears in the Stimulus Profile Editor. With some preliminary testing, it seems clear that this functionality can be built up using the .NET API, but the time it will take me to develop this won't be trivial. Seeing as parsing the file is already done in the Stimulus profile editor, I thought I would check to see if this is available before embarking on the work.
cheers
Stuart
04-29-2020 03:05 PM
Hello - I have the same desire. Did you ever find a way to print out the code from the stimulus profile editor?
Thanks!
Best Regards,
Richard
05-01-2020 09:15 AM
Hi Richard,
I made a quick attempt using the .NET API and made decent headway but still had some bugs to work out. The original requirement in my project to retain readable copies of sequences that were run was somewhat mitigated by the fact that you can just save the RTS' on a run by run basis and use the SPE to view them. Yes, you have to have VeriStand installed on a machine to read them, but to run them you have to have it installed anyway, and there wasn't a strong case for someone needing to read through them at their desk somewhere that justified prioritizing the work at the time.
I believe I made a bunch of subVIs to extract and format the text of each statement type. I think I was slowed down by dealing with nested functions; i.e. a switch with a case that included and if statement that included another switch etc. I'll take a look at what I have and see if there's something worth salvaging there. I did some work recently using .NET to mine and modify system definitions so it's somewhat fresh in my mind.
cheers
Stuart
05-01-2020 11:19 AM
Hello Stuart,
Thanks for the reply. If you do find something, I am happy to be a beta-tester 🙂
Mostly, I would like to have a printable/saveable document to refer to in code reviews with others and also for visual reference in making new RTS.
I don't get why NI didn't just allow a "print" of the RTS from the editor window. Seems to me that would be easy since it has to be screen rendered anyway.
Best Regards,
Richard
05-04-2020 11:03 AM
Hi Richard,
I revisited my code and was able to get something working that seems to do the trick. I did fairly minimal testing and there are likely statement types I didn't come across so you would need to add those. It should be fairly simple following the example of the other cases. Let me know how it works.
cheers
Stuart
05-04-2020 11:31 AM
Hi Stuart. Thanks for this. I only have LV17 on the machine I have at home right now but I have LV19 on another machine at my office - I will try it tomorrow. Any general instructions? Just open the RTStoDisplayString VI and it will be obvious?
Best Regards,
Richard
05-04-2020 12:35 PM
I saved it to 2017 and attached it.
Just open the RTStoDisplayString VI, point to the file and run it.
cheers
Stuart
05-04-2020 01:40 PM
Hi Stuart,
Wow - that is cool! It is almost perfect. Just 2 small items I noticed when I ran it on a sequence I am constructing:
1) Mixes up the multitask tasks a little in the main loop. Lines 24-27 should be after 115 and line 23 should be after line 51. This is interesting because it worked perfectly on the multitask in the cleanup section.
2) Could add a space after the "IF" primitive - it is a little hard to read with no space there. All the other primitives have a space after them.
I attach the rts file that I am building in case you want to explore why the multitask didn't work perfectly. Perhaps it is because I have 3 tasks at once....
Anyway - thanks so much, this an awesome piece of work. It will help me a lot!
Best Regards,
Richard
05-04-2020 01:42 PM
Seems I attached the wrong file. Sorry.
05-04-2020 03:58 PM
Thanks for the feedback. I'll take a look when I get a chance. I was a bit muddled when it came to the ordering of all the lines. I tried to insert them in the right order as they were processed but there is likely a smarter way to do this. There is a common VI for all the statement processing subVIs that attempts to insert the current statement in the right place but there's obviously a significant bug that seems to present when the statements are deeper than a few levels.
Stuart