Hi All,
I don’t even know if its technically possible but I thought I’d ask anyways:
Is there a converter to take an existing traditional VENUS method and turn it into a PyHamilton method set?
Thanks,
Brad
Hi All,
I don’t even know if its technically possible but I thought I’d ask anyways:
Is there a converter to take an existing traditional VENUS method and turn it into a PyHamilton method set?
Thanks,
Brad
Ive been asked this question a lot since a lot of companies are interested in PyHamilton but have many existing methods in Venus
Im sure its technically possible since methods compile to HSL. Reading an individual command and converting it to Python would not be difficult. Generically translating all the logic, abstractions etc would be pretty challenging. Ive converted methods from Venus to PyHamilton manually before and unless you have 50+ entirely unique methods it would most likely be easier to convert them manually than to build an all-encompassing transpiler.
If you have a lot of Venus methods you could potentially convert the same functionality into much fewer PyHamilton methods since Python is much better at building abstractions and reusable code into. Once youve invested in building those abstractions it gets a lot easier to write new code in the future (especially with Copilot).
One major hurdle will be the dialogs, and any dialogs where you configure parameters such as pipetting and plate transfers, as although the code to present them is in HSL, the actual configuration is not.
This seems like a great use case for AI.
You could presumably create a Plugin for VSCode for the HSL language if one doesn’t already exist, then use something like Cursor to convert blocks of HSL code to PyHamilton. There are extensive chm(html help files) in the directories of the Venus install that describe the inner workings of the HSL language which could be used as a basis for the plugin as well as additional context for an AI agent. Providing reference code is always a great way to refine things as well.
May also be possible to create a converter to directly interpret the HSL code and output PyHamilton using the above mentioned reference materials.
This of course depends on how much time and effort you want to sink into it. If your company has a few hundred methods you want to convert it may be worth the time.
I would love this if it is possible or can be a beta tester @Stefan if we want to try it and see what can be done
The Venus custom dialog configurations/definitions are in the .med file.
I worked on a project where one requirement was using Venus custom dialogs in an HSL library. I do not recommend this. I got it to work by having the initialize library function copy the .med file with custom dialog definitions from a dependencies directory into the library directory. The disconnect library function deletes the file from the library directory. If the .med file containing the custom dialog configurations exists in the same folder as the .hsl library file, Hamilton method editor will not allow the library to be added to a method because it recognizes the file as part of a method rather than a library. Also, whenever a custom dialog is edited, some of its parameters change, so then the HSL library code has to change to match. I repeat, don’t make your HSL libraries use Venus custom dialogs. It’s a pain to maintain.
If you have a method with a custom dialog, look in an .hsl file that is associated with the .med file and you will see lines of code for the custom dialog (ctrl+F for ‘InitCustomDialog’). It’s probably not too difficult to convert those lines into python-friendly Tkinter code (or use a fancier Python GUI library) to at least get the same number of drop-downs and check boxes that get parsed for method variables.
Can you give an example of this? Are you converting the .med to ascii?
Also, its not just custom dialogs, its things like aspiration/dispense parameters which are inside dialogs. These are not included in the hsl/hs_/hsi files at all.
Apologies for the delayed response.
I am not doing any special conversion. I am saving the .med file and checking the .hsl file that gets updated when the .med file is saved.
If you are talking about the dialogs that are created in Hamilton Method Editor, variables/parameters that are passed from the dialogs can show up in the .hsl files.
When you save a .med file with a custom dialog in Venus method editor, the .hsl file will contain some lines about the output variables:
Here’s an quick example…
customDialog configuration:
.hsl file: