RoboDK Forum
Change item's type in a python script可打印版本

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API)
+--- Thread: Change item's type in a python script (/Thread-Change-item-s-type-in-a-python-script)



Change item's type in a python script-Camille-04-26-2021

Hi,

Is it possible to change an item's type in a python script ?
I have a tool I am importing with SolidWorks plugin and when I drag and drop it to my robot its type is changed from object to tool, but when I import it and set its parent as a robot with a script, its type stays object.

What can I do to change its type at the same time I change its parent ?

Thanks,
Camille


RE: Change item's type in a python script-Jeremy-04-26-2021

嗨Camille,

Did you follow these instructions?
//www.sinclairbody.com/doc/en/PythonAPI/robolink.html#robolink.Robolink.AddFile

Jeremy


RE: Change item's type in a python script-Camille-04-26-2021

Hi Jeremy,

I considered this option but the application I have requires the user to import a tool, a part and a curve from SolidWorks right now.
So I would prefer to avoid using two different importing settings for the user.

If there is no other choice, I will use this way, but I wanted to check before.

Thanks,
Camille


RE: Change item's type in a python script-Jeremy-04-26-2021

嗨Camille,

Can you update RDK to the latest version, I think that with the newest version the object should automatically become a tool when you set a robot as a parent. Can you confirm?
Otherwise, we will look into it.

Jeremy


RE: Change item's type in a python script-Camille-04-26-2021

Unfortunately it did not work.

Camille


RE: Change item's type in a python script-Jeremy-04-26-2021

Ok, we'll keep you updated.

Jeremy


RE: Change item's type in a python script-Camille-06-03-2021

Hi Jeremy,

I think I figured it out, I used this line instead :


Code:
objet = robot.AddTool(nPose,nomObjet)

and it looks like it worked !

Camille