RobotStudio event

SpeedData

Hi.

How can i read/write Speeddata. Cant find the name space.

Best regards Klaus

Best Regards

Klaus Soenderhegn
www.cadalysator.dk

Comments

  • You use GetRapidData to get an instance of RapidData = to variable you want, then you cast it to the RapidType you want, in your case SpeedData, then you work with the elements of the SpeedData type, then write the new value back to the controller. Here is a sample from the help:

    private void IncXOrientation(Conroller c)
    {
        try
        {
            // Create RapidData instance to Rapid array
            RapidData rdRobtarget = c.Rapid.GetRapidData("T_ROB1","MyModule","rt_array");

            // Values are added in reverse order
            for (int i = 5;i > 0;i--)
            {
                 // Get value of item
                 RobTarget rtValue = (RobTarget) rdRobtarget.ReadItem(i);

                 // Increase X
                 rtValue.Trans.X += 1;

                 // Apply new value to Rapid data in controller
                 rdRobtarget.WriteItem(rtValue,i);
            }
        }
        catch (GeneralException ee)
        {
            // TODO: Add error handling
        }
        catch (System.Exception ee)
        {
            // TODO: Add error handling
        }
        finally
        {
            if (rdRobtarget != null)
                 rdRobtarget.Dispose();
        }
    }

    Russell Drown