Attached parent/child object
Is there a way, using the SDK, to get the the object another object is attached too. Also in reverse, is there a way to get a list of all objects attached to an object?
I have looked through all the methods and properties of parts\graphic component\project objects and can not find anything
I have looked through all the methods and properties of parts\graphic component\project objects and can not find anything
0
Answers
-
Hey Simon, I am not quite sure, but it should be something with ChildInstances. What exactly do you need? The name or the object itself?0
-
Hello
Use the class attachementCollection. Exemple :
Station station = Station.ActiveStation;
foreach (Attachment attach in stn.Attachments.ToArray())
{
MessageBox.Show( attach.AttachmentChild.ToString());}1 -
Didn't realise that attachments are held at station level and not at component level. Two simple functions with linQ queries returning either the part you are attached to, or the children parts attached to the specified part fixed this problemprivate ProjectObject GetAttachedParent(ProjectObject part){Station station = Project.ActiveProject as Station;var attachements = station.Attachments;ProjectObject parent = (from a in attachementswhere a.AttachmentChild.DisplayName == part.DisplayNameselect a.AttachmentParent).FirstOrDefault();return parent;}private IEnumerable<ProjectObject> GetAttachedChildren(ProjectObject part){Station station = Project.ActiveProject as Station;var attachements = station.Attachments;var child = (from a in attachementswhere a.AttachmentParent.DisplayName == part.DisplayNameselect a.AttachmentChild);return child;}0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 800 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings