Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Error using Python to create a station

I am attempting to use Python to recreate a station that I have previously created using the RoboDK UI, and have run into an error whilst attempting to use setParam to change the file path of the station:

def CreateStation():
   station = RDK.ActiveStation()
   station.setName('Python Test Station')
   station.setParam ('FILE_OPENSTATION','C:/Users/RBE/Downloads')
   RDK.Save('Python Test.rdk')

Specifically, I get the error "AttributeError: 'Item' object has no attribute 'setParam' when trying to change the path where the RDK file will be saved. Is someone able to enlighten me as to why setParam is not functioning? I am not sure if its a Python syntax thing, or I am attempting to use the API incorrectly...
The parameter FILE_OPENSTATION is a constant parameter and can't be changed. 

Instead, you can do the following to save the file to a specific location:
RDK.Save('C:/Users/RBE/Downloads/Python Test.rdk')

Then, you can read the FILE_OPENSTATION parameter.

To see the full list of available parameters for a specific station you can right click the station and select Station Parameters.


Users browsing this thread:
1 Guest(s)