RobotStudio event

Is it possible to copy Rapid Move Instructions between Modules using PC SDK ?

Options
I would like to extract Move Instructions (alone) from one module and write it to other module ?
Is there any possiblity to do this using PC SDK ?
I could not find any in Rapid Domain.
Thanks in advance.

Answers

  • scottMHA
    Options
    I would like to extract Move Instructions (alone) from one module and write it to other module ?
    Is there any possiblity to do this using PC SDK ?
    I could not find any in Rapid Domain.
    Thanks in advance.
    I don't think it is possible to modify rapid data through Rapid Domain, but you can through the station.

    private void button1_Click(object sender, EventArgs e)
            {
                Station station = Project.ActiveProject as Station;
                List<SyncLogMessage> SyncLog = new List<SyncLogMessage>();
    
                // Create a station controller object
                RsIrc5Controller rsIrc5Controller = new RsIrc5Controller(@"C:\Users\your.username\Documents\RobotStudio\Systems\TargetSystem");
    
                // You can use this to automate the sync from RAPID to station... Not sure whats passed in the dataId string? I guess data name!
                // Assumption is that task index 1 is your rapid motion task!
                rsIrc5Controller.Tasks[1].SyncData("YourData", SyncDirection.ToStation, SyncLog);
    
                // Gets all objects in your station.... Remember to sync from RAPID to station!
                ProjectObject[] _projectObject = station.GetAllObjects();
    
                // Indexs through all objects
                for (int i = 0; i < _projectObject.Length; i++)
                {
                    // If object is a robtarget copy and add to target controller
                    if (_projectObject.GetType().Name == "RsTarget")
                    {
                        // Cast project object to RsTarget
                        RsTarget _newTarget = (RsTarget)_projectObject[i];
    
                        // Assumption is that task index 1 is your rapid motion task!
                        rsIrc5Controller.Tasks[1].Targets.Add(_newTarget);
                        
                        // Sync back to controller
                        rsIrc5Controller.Tasks[1].SyncData(_newTarget.UniqueId, SyncDirection.ToController, SyncLog);
                    }
                }
            }

  • vikram6892
    edited February 2019
    Options
    Hello @scottMHA
    I already did it. By the way thank you very much for your code snippet.