Frame Properties Example
This example creates a frame, shows it in the graphics, moves it 100 mm along the X-axis and then prints its transformation in the logger (the output window in RobotStudio).
Example
Project.UndoContext.BeginUndoStep("FrameProperties");
try
{
Station station = Station.ActiveStation;
// Create a frame.
Frame myFrame = new Frame();
myFrame.Name = "MyFrame_1";
// Add the frame to the station.
station.Frames.Add(myFrame);
// Make the frame twice as big.
myFrame.FrameSize = myFrame.FrameSize * 2;
// Make sure the name of the frame and the frame itself is displayed in the graphics.
myFrame.ShowName = true;
myFrame.Visible = true;
// Move the frame 100 mm along the X-axis.
myFrame.Transform.X = myFrame.Transform.X + 0.1;
// Output the transform of the frame.
Logger.AddMessage(new LogMessage("Transform: x:" + myFrame.Transform.X.ToString() +
" y:" + myFrame.Transform.Y.ToString() +
" z:" + myFrame.Transform.Z.ToString() +
" Rx:" + myFrame.Transform.RX.ToString() +
" Ry:" + myFrame.Transform.RY.ToString() +
" Rz:" + myFrame.Transform.RZ.ToString()));
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}