I have made my own custom filter UO in a Python script block. It works as I want it for now, but I need about 20 of the same filter-unit in my flowsheet and I want to be able to edit the python code in one place and not have to edit all 20 units every time i need to make a small change to the code.
How can this be done? Can I save the custom block as a type somehow?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Daniel,
That sound like an acceptable solution.
However when I move the code to the script editor and use the exec(code) in the Python Script I get an error. I think I am missing some small simple thing because I get the same error at the first line of code no matter what I put in the script.
This error:
Daniel, that worked !
Thank you very much for the fast support 👍
I have been using DWSIM only a few days and I already have some very nice simulations going. And I have the source code compiled in Visual Studio so I can dig a bit into the code. Very useful.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have made my own custom filter UO in a Python script block. It works as I want it for now, but I need about 20 of the same filter-unit in my flowsheet and I want to be able to edit the python code in one place and not have to edit all 20 units every time i need to make a small change to the code.
How can this be done? Can I save the custom block as a type somehow?
You can save the main part of the code in a new script on the script manager, then call it using
Hello Daniel,
That sound like an acceptable solution.
However when I move the code to the script editor and use the exec(code) in the Python Script I get an error. I think I am missing some small simple thing because I get the same error at the first line of code no matter what I put in the script.
This error:
System.Exception: File "<string>", line 7
feed=ims1
^
SyntaxError: unexpected token '\r' ---> Microsoft.Scripting.SyntaxErrorException: unexpected token '\r'</string>
Sorry, try this:
Daniel, that worked !
Thank you very much for the fast support 👍
I have been using DWSIM only a few days and I already have some very nice simulations going. And I have the source code compiled in Visual Studio so I can dig a bit into the code. Very useful.