Menu

Custom unit operation graphs

2022-10-27
2022-11-01
  • Cameron Aldren

    Cameron Aldren - 2022-10-27

    Hi Daniel,
    I hope you are doing well. I was wondering if you could answer a question regarding a custom unit-operation I have developed in python.net. I calculate some profiles for the unit and now want to be able to use ‘Insert<Chart’ in order to produce a graph of some of said profiles, such that is observable in the flowsheet (as you can with the normal unit operations). I see that, naturally, when I select my custom unit operation, none of my data sets can be chosen in the drop-down menu. Is there any way in which my python script can give these arrays such that the ‘Insert<Chart’ tool can access them?
    Would you be able to advise on how I can do this?
    Best Wishes,
    Cameron

     
    • Daniel Medeiros

      Daniel Medeiros - 2022-10-28

      Hi Cameron,

      It is not trivial to do it as there is currently no way to override the chart generation routines. What you could do:

      1- add an image to the flowsheet
      2- write a command to generate the plot image and override the 'Image' property of the image object on the flowsheet.
      3 - use Flowsheet.GetFlowsheetGraphicObject() to get the image object

      see the code at the end of this gist to generate the image as a SKImage object: https://gist.github.com/DanWBR/c355fd5420d20d960f5d084a7142cde8

       
    • Daniel Medeiros

      Daniel Medeiros - 2022-10-31

      In v8.3 I'll add some helper methods so you can display your charts in an easy manner.

      Regards
      Daniel

       
  • Cameron Aldren

    Cameron Aldren - 2022-11-01

    Great, thank you very much Daniel - not sure if my coding skills are up to it, but I will give it a go! Looking forwards to seeing the update.
    Regards,

    Cameron