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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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...
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?
The Script UO only accepts numeric (double) variables. Can't you convert your strings to indexes (0, 1, 2...), like in an enumeration?
I'll add string variable support to the Script UO on the next release.
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.
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"
"
what is the context here, are you running a Custom UO and want to print its name?