Read and Import txt file and replace values

Hello, guys

I’m new to python and I’m trying to find a way to change the value of (DOF) A1 to A6 from a generated or handwritten TXT file.
Any suggestions on how to do that?
Those are the values I want to change:

 # DOF = Degree of freedom
comp.findNode("A1").Dof.VALUE = 150
comp.findNode("A2").Dof.VALUE = -100
comp.findNode("A3").Dof.VALUE = -50
comp.findNode("A4").Dof.VALUE = 88
comp.findNode("A5").Dof.VALUE = 121
comp.findNode("A6").Dof.VALUE = 55

Thanks in advance.

You need to write Link names like shown in the screen shot(Axis 1 ,Axis 2). Not the Joint names.
Other then that everything seems working.
Ekran Alıntısı

It works the way I’ve written it (it depends on what type of robot is used), but thanks. My question is, how to read from a TXT file and change those values?
For example:
I have a txt file with Axis1 = 90, Axis2 = 45, Axis3 = 55, Axis4 = 13, Axis5 = -90, Axis6 = -27 values
What do I need to add to my code so I can replace the values from the txt file with the existing ones in the script?

Thanks in advance,


how to write the values you’ve already discussed/find out.

You can import a textfile by programming python with something like this: