Menu

Accessing the linked object

Roberto
2020-08-05
2020-08-10
  • Roberto

    Roberto - 2020-08-05

    Is there a way to reference the linked object to the execution of an IronPython module? It is to avoid having to change the name of the object within the code.

     
  • Roberto

    Roberto - 2020-08-09

    I found the following solution:

    for scr in Flowsheet.Scripts.Values.Where(lambda x: x.Title == MyScript):
    equipment = Flowsheet.SimulationObjects[scr.LinkedObjectName]

    I still have to define the title of the script ("MyScript") but it is progress, any suggestion is welcome!

     
  • Daniel Medeiros

    Daniel Medeiros - 2020-08-09

    I don't understand why you want to change the name of the object from the code, can you elaborate on that?

     
    • Roberto

      Roberto - 2020-08-09

      Hi Daniel. I don't want to change the name of the object from the code, actually my concern is to import the selected object in the code to obtain the streams that are connected to it.
      Is there an option to identify the object by code without specifying any additional data (for example the title of the script)?

      Thank you in advance!

       
  • Daniel Medeiros

    Daniel Medeiros - 2020-08-10

    You can use

    obj = Flowsheet.GetFlowsheetSimulationObject('objname')
    
     
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.