Plaxis Scripting - Pyside 2 Input Error

Hello folks

I am creating a gui-enabled script using Pyside2. My goal is to change the line length. The user will select the line to modify and enter the length. 

Selected_Line = self.Lines_QComboBox.currentText() #select the line 
Line_Length = float(self.Min_Line_Length_QLine_Edit.text()) #enter the length.
g_i.Selected_Line.Second.y.set(Line_Length) #change the length of the line

However I'm getting "AttributeError: Requested attribute 'Selected_Line' is not present".

In order to overcome this issue, I used the eval function. 

Selected_Line = self.Lines_QComboBox.currentText() #select the line 
Line_Length = float(self.Min_Line_Length_QLine_Edit.text()) #enter the length.
eval("g_i.%s.Second.y.set(Line_Length)"% (Selected_Line) #change the length of the line

Is there any alternative to overcome this problem without using eval function?

Thank you

Parents Reply Children