Menu

How to input from DWSIM environment a string as a scripting variable of IronPython script

2017-01-27
2023-05-19
  • Jiri Nepovim

    Jiri Nepovim - 2017-01-27

    Hi all, I have a problem with script of an Unit Operation I have prepared in DWSIM script editor. Unfortunately to specify a type of unit operation i need to create input string variable, however DWSIM won't let me create scripting variable other than type double. Is there a possibility other than number definition how to send an input string as a variable to the script?

     
  • Daniel Medeiros

    Daniel Medeiros - 2017-01-30

    The Script UO only accepts numeric (double) variables. Can't you convert your strings to indexes (0, 1, 2...), like in an enumeration?

     
  • Daniel Medeiros

    Daniel Medeiros - 2017-01-31

    I'll add string variable support to the Script UO on the next release.

     
  • Jiri Nepovim

    Jiri Nepovim - 2017-02-01

    HI Daniel, I already use conversion to indexes, that is as you wrote the only possibility. Thank you for the future support, it will really help.

     
  • red_doctor

    red_doctor - 2023-05-19

    I asked the following question in the wrong branch of this forum (Classic UI)... But it looks like I can solve this problem using this string variable. Only really I wish it were just the object name.

    "It would be convenient to have something like a "this" (C++) pointer in a Python script. I'd like to get the name of the object that's being calculated, so that I can print it in the console window along with other data. Something like...

    object_name = this.GetObjectName()
    print "Currently calculating "+object_name":\n"
    "

     
    • Daniel Medeiros

      Daniel Medeiros - 2023-05-19

      what is the context here, are you running a Custom UO and want to print its name?

       
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.