Author Topic: Python custom GUI component add-on to KUKA|prc?  (Read 312 times)

Nicholas Ziglio

  • Robots in Architecture Members
  • Forum User
  • *
  • Posts: 24
    • View Profile
Python custom GUI component add-on to KUKA|prc?
« on: August 10, 2020, 10:25:56 AM »
Hello, I have decided to develop a solution to automate welding programming parametrically.
It would be really useful to minimize the amount of components to be created for each weld by creating a component like "KUKA|prc CORE" which has a button that opens a custom GUI.

Does anyone know how this can be done? I'd appreciate a link to any documentation for doing this in python, thanks in advance!  :)
-Nicholas

Nicholas Ziglio

  • Robots in Architecture Members
  • Forum User
  • *
  • Posts: 24
    • View Profile
Re: Python custom GUI component add-on to KUKA|prc?
« Reply #1 on: August 10, 2020, 12:00:54 PM »
Update, so apparently ironpython in grasshopper doesn't support tkinter?
I found Eto however which allows to program custom GUI interfaces for Rhino and Grasshopper. See the last section here: https://developer.rhino3d.com/guides/rhinopython/

I'm still uncertain on how to add a button on the actual component in grasshopper but I have tested it with a "open_window" bool input and that also works although less elegant.
If anyone knows how to make a custom python component with a "open window" button, that would be appreciated  :)

Johannes @ Robots in Architecture

  • Lead Developer
  • Administrator
  • Forum User
  • *****
  • Posts: 1060
    • View Profile
    • Robots in Architecture
Re: Python custom GUI component add-on to KUKA|prc?
« Reply #2 on: August 10, 2020, 05:41:41 PM »
Hello Nicholas,

Now this is not the "clean" solution by far, but just to get started, how about you make the GUI with a nice GUI library - no matter if IronPython, Python, or something else - and save the data from the GUI in a text file, that you observe from Grasshopper? So whenever that text file changes, Grasshopper updates.

The KUKA|prc GUI is done using WPF, which you can also design in a graphic editor within Visual Studio, so that is of course also an option.

Best,
Johannes

Nicholas Ziglio

  • Robots in Architecture Members
  • Forum User
  • *
  • Posts: 24
    • View Profile
Re: Python custom GUI component add-on to KUKA|prc?
« Reply #3 on: August 10, 2020, 06:29:55 PM »
Thanks Johannes! That is such a good idea, I hadn't thought of that  ::)

I'm guessing you used C# for KUKA|prc then? I don't know C# and am a bit streched for time with this project so I will probably go with your first suggestion for now if Eto doesn't work out.
Thanks,
-Nicholas

Johannes @ Robots in Architecture

  • Lead Developer
  • Administrator
  • Forum User
  • *****
  • Posts: 1060
    • View Profile
    • Robots in Architecture
Re: Python custom GUI component add-on to KUKA|prc?
« Reply #4 on: August 10, 2020, 06:44:11 PM »
Hello Nicholas,

Yes, KUKA|prc is written in C# and you could actually also run it without Grasshopper in a standalone app, we used it e.g. within Unity.

Best,
Johannes