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

setLink function not found

#1
Hello everyone,

I encountered a strange bug when using setLink function from the Python RoboDk API.

I installed RoboDk v5.6.2.23532 (64b) - 2023-07-04 on two Windows PC.  Both RoboDK have the exact same station opened.

I used the function setLink() from robolink on a target manually created. It works on my PC, but not on the other one. 

Here's a sample code for reproduction:
Code:
from robodk.robolink import *

# Connect to the RoboDK API
RDK = Robolink()

if __name__ == "__main__":
robot = RDK.Item('ABB_IRB_4600-45/2.05')
    p_drop_in_Aicon = RDK.Item("p_drop_in_Aicon",ITEM_TYPE_TARGET)
p_drop_in_Aicon.setLink(robot)

On my PC this code do what it should.

On the second PC I have this error :
Code:
Traceback (most recent call last):
 File "C:\Users\ASUS\test.py"
AttributeError: 'Item' object has no attribute 'setLink'

I checked the item type and name and it had the right values and then procedeed to check also the methods available on this object:
Code:
p_drop_in_Aicon= RDK.Item("p_drop_in_Aicon",ITEM_TYPE_TARGET)
   object_methods = [method_name for method_name in dir(type(p_drop_in_Aicon))
                 if callable(getattr(type(p_drop_in_Aicon), method_name))]
   print(object_methods)

Output:
Code:
['AccuracyActive', 'AddCurve', 'AddFile', 'AddGeometry', 'AddPoints', 'AddShape', 'AddTool', 'AttachClosest', 'Busy', 'Childs', 'Collision', 'Color', 'Connect', 'ConnectSafe', 'ConnectedState', 'ConnectionParams', 'Copy', 'Delete', 'DetachAll', 'DetachClosest', 'Disconnect', 'FilterProgram', 'FilterTarget', 'Frame', 'GeometryPose', 'GetPoints', 'Htool', 'Instruction', 'InstructionCount', 'InstructionDelete', 'InstructionList', 'InstructionListJoints', 'InstructionSelect', 'IsInside', 'JointLimits', 'JointPoses', 'Joints', 'JointsConfig', 'JointsHome', 'MakeProgram', 'MoveC', 'MoveJ', 'MoveJ_Test', 'MoveJ_Test_Blend', 'MoveL', 'MoveL_Test', 'Name', 'ObjectLink', 'Parent', 'Paste', 'Pause', 'Pose', 'PoseAbs', 'PoseFrame', 'PoseTool', 'PoseWrt', 'ProgramStart', 'ProjectPoints', 'RDK', 'Recolor', 'RunCode', 'RunCodeCustom', 'RunInstruction', 'RunProgram', 'RunType', 'Save', 'Scale', 'SearchL', 'SelectedFeature', 'ShowInstructions', 'ShowSequence', 'ShowTargets', 'SimulatorJoints', 'SolveFK', 'SolveIK', 'SolveIK_All', 'Stop', 'Tool', 'Type', 'Update', 'Valid', 'Visible', 'WaitFinished', 'WaitMove', '__class__', '__delattr__', '__dir__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'addMoveC', 'addMoveJ', 'addMoveL', 'addMoveSearch', 'customInstruction', 'equals', 'getAI', 'getDI', 'getLink', 'getParam', 'isJointTarget', 'setAO', 'setAcceleration', 'setAccelerationJoints', 'setAccuracyActive', 'setAsCartesianTarget', 'setAsJointTarget', 'setColor', 'setColorCurve', 'setColorShape', 'setConnectionParams', 'setDO', 'setFrame', 'setGeometryPose', 'setHtool', 'setInstruction', 'setJointLimits', 'setJoints', 'setJointsHome', 'setMachiningParameters', 'setMillingParameters', 'setName', 'setParam', 'setParamRobotTool', 'setParent', 'setParentStatic', 'setPose', 'setPoseAbs', 'setPoseFrame', 'setPoseTool', 'setRobot', 'setRounding', 'setRunType', 'setSpeed', 'setSpeedJoints', 'setTool', 'setValue', 'setVisible', 'setZoneData', 'waitDI']


So everything that I was expected to have in a Target, but no sign of setLink function.

Does anyone know what could happen ?

Thank you
#2
What version of Python are you using?

If you use the latest version I recommend you to to use Python embedded version that comes with RoboDK:
  1. Select Tools-Options
  2. Select the Python tab
  3. Enter this path as the Python interpreter:
    C:/RoboDK/Python-Embedded/python.exe
#3
I use python3.7 on both PC.

Note that i'm not using python inside RoboDK but only using python to manipulate RoboDK.
I'm forced to use version 3.7 because of other third_party software that we need.
#4
In this case you should make sure you update the RoboDK API for Python:
Code:
pip install --upgrade robodk

And delete these folders:
Code:
C:/RoboDK/Python/robodk
C:/RoboDK/Python/robolink
#5
I tried to completely reinstall RoboDK, just to be sure.

It seems there's a absolute path problem.
As the name's Albert, I think it's your own path haha.
Code:
C:\RoboDK\Python-Embedded\Scripts>pip install --upgrade robodk
Fatal error in launcher: Unable to create process using '"C:\Users\Albert\Desktop\Shared-Sam-Albert\build-python\Python-Embedded\python.exe"  "C:\RoboDK\Python-Embedded\Scripts\pip.exe" install --upgrade robodk': ???????????


Attached Files Thumbnail(s)
   
#6
Good point, we'll try to fix this issue in a timely manner. However, the latest version of RoboDK already includes the latest version of the RoboDK API. It should have the setLink function available.

As a workaround, it should work if you run this command instead of pip:
Code:
python -m pip install --upgrade robodk
#7
Ok, we investigated exactly what happened before having the problem.

In fact, the second PC was installed with RoboDK5.6 but already had the 5.4 installed. The problem is that someone overwrited the existing installation.
As RoboDk updated its python version, the older one was still in the Robodk folder.

I managed to tweak my third_party software to be able to run in python3.10 and reinstalled everything correctly.
Now everything is working as intended :)

Sorry for wasting your time, the problem was completely on our side, and thank you for your answers !
#8
That sounds great, thank you for your feedback!

Feel free to reach out to us anytime.
  




Users browsing this thread:
1 Guest(s)