How to set name of user water level in python API?

waterlevel_s = g_i.waterlevel((-50,self.WaterLevelLeft), (0,self.WaterLevelLeft))
 
I have a water level as can be seen above. I would like to give it a name so I can retrieve it later. I have tried "waterlevel_s.Name = "WL_Left_" + self.WaterLevelLeft", but to no avail.
  • Hi

    This only works with user-generated water levels: the water levels generated by boreholes cannot be updated.
    Also note that each object should have a valid, safe object name, meaning e.g. it cannot contain spaces, start with a number, or have unsupported characters in the name, like a dot or a dash/hyphen.

    If you have a user water level, as you have in the above example it should work:

    # set water level elevation:
    WaterLevelLeft = -1.5
    
    # create a new PLAXIS User water level:
    waterlevel_s = g_i.waterlevel((-50, WaterLevelLeft), (0, WaterLevelLeft))
    
    # construct the new name for the water level:
    newWLname = "WL_Left_" + str(WaterLevelLeft)
    
    # remove any incorrect object name conditions:
    newWLname = newWLname.replace(".","_").replace("-","_")
    
    # finally, set the .Name value for this new waterlevel:
    waterlevel_s.Name = newWLname

    Answer Verified By: Iman Warsame