![RobotStudio event](https://new.abb.com/images/librariesprovider89/default-album/rs_webinar_invitation_2025_2.jpg)
How to attach a part or tool to the robot
![hohox](https://secure.gravatar.com/avatar/2253b10bed1a9d38be8a0aef42baf937/?default=https%3A%2F%2Fus.v-cdn.net%2F5020483%2Fuploads%2Fdefaultavatar%2FK2266OAKOLNC.jpg&rating=g&size=200)
hohox
✭
in RobotStudio
How to attach a part or a tool to the robot?
Addin program with C#
Thanks!
0
Comments
-
this was the example code given in the training course, it attaches things too the tool and attaches peices to a pallet in the station. I have modified it to suit everything i have needed so hopefully it will help you out.A?A? A? A? A?public void Macro_DetachAttachTube()A?A? A? A? A?{A?A? A? A? A? A? A?Station actStn = Project.ActiveProject as Station;A?A? A? A? A? A? A?foreach (Attachment at in actStn.Attachments)A?A? A? A? A? A? A?{A?A? A? A? A? A? A? A? A?if (at.AttachmentParent.Parent.Name == "MyGripper")A?A? A? A? A? A? A? A? A?{A?A? A? A? A? A? A? A? A? A? A?GraphicComponent gc = at.AttachmentChild as GraphicComponent;A?A? A? A? A? A? A? A? A? A? A?Matrix4 matTube = gc.Transform.GlobalMatrix;A?A? A? A? A? A? A? A? A? A? A?//find flangeA?A? A? A? A? A? A? A? A? A? A?Mechanism mech = at.AttachmentParent.Parent as Mechanism;A?A? A? A? A? A? A? A? A? A? A?if (mech == null) Logger.AddMessage(new LogMessage("mech null"));A?A? A? A? A? A? A? A? A? A? A?mech.GetToolDataInfo()[0].Detach(gc as IAttachableChild);A?A? A? A? A? A? A? A? A? A? A?gc.Transform.GlobalMatrix = matTube;A?A? A? A? A? A? A? A? A? A? A?IAttachableParent ap = actStn.GraphicComponents["euro_pallet"] as IAttachableParent;A?A? A? A? A? A? A? A? A? A? A?if (ap == null) Logger.AddMessage(new LogMessage("no pallet"));A?A? A? A? A? A? A? A? A? A? A?ap.Attach(gc as IAttachableChild, false, new Matrix4(new Vector3(0, 0, 0)));A?A? A? A? A? A? A? A? A?}A?A? A? A? A? A? A?}A?A? A? A? A?}A?A? A? A? A?public void Macro_DetachFromPallet()A?A? A? A? A?{A?A? A? A? A? A? A?Station actStn = Project.ActiveProject as Station;A?A? A? A? A? A? A?foreach (Attachment at in actStn.Attachments)A?A? A? A? A? A? A?{A?A? A? A? A? A? A? A? A?if (at.AttachmentParent.Name == "euro_pallet")A?A? A? A? A? A? A? A? A?{A?A? A? A? A? A? A? A? A? A? A?GraphicComponent gc = at.AttachmentChild as GraphicComponent;A?A? A? A? A? A? A? A? A? A? A?IAttachableParent ap = actStn.GraphicComponents["euro_pallet"] as IAttachableParent;A?A? A? A? A? A? A? A? A? A? A?ap.Detach(gc as IAttachableChild);A?A? A? A? A? A? A? A? A?}A?A? A? A? A? A? A?}A?A? A? A? A?}0
-
Yes! I resolve the problem!Your information is so helpful! Thank you so much!The way I do is:1. Find the flange of the robot. "Flange[] Mechanism.GetFlanges()"2. Attach the part to the flange."bool Flange.Attach(IAttachableChild child, bool mount)"And detach is "bool Flange.Detach(IAttachableChild child)"0
Categories
- All Categories
- 5.5K RobotStudio
- 398 UpFeed
- 19 Tutorials
- 13 RobotApps
- 299 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 323 IRC5
- 63 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 812 RAPID Programming
- 5 AppStudio
- 3 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings