control of external axis
MMike
✭
in RobotStudio
Hi
Project.UndoContext.BeginUndoStep("RsPathProcedureExample");
try
{
Logger.AddMessage(new LogMessage("Path " + CursData.CurveName + " started"));
// Create a PathProcedure.
RsPathProcedure myPath = new RsPathProcedure("Path_" + CursData.CurveName);
// Add the path to the ActiveTask.
station.ActiveTask.PathProcedures.Add(myPath);
myPath.ModuleName = "MyModule";
myPath.ShowName = true;
myPath.Synchronize = true;
myPath.Visible = true;
RsWorkObject w = station.ActiveTask.ActiveWorkObject;
//loop the points and stuff
for (int i = 0; i < CursData.ExtendedTransformSet.Count; i++)
{
RsRobTarget target1 = new RsRobTarget();
// Set the name of the RobTarget.
target1.Name = station.ActiveTask.GetValidRapidName(CursData.CurveName, "_", 10);
//just translation matrix to position the target
Matrix4 m = (Matrix4)CursData.ExtendedTransformSet;
target1.Frame.Matrix = m;
target1.IsInline = false;
station.ActiveTask.DataDeclarations.Add(target1);
// Create an RsTarget for the RobTarget.
RsTarget homeRsTarget = new RsTarget(station.ActiveTask.ActiveWorkObject, target1);
homeRsTarget.Name = target1.Name;
// Add it to the ActiveTask.
station.ActiveTask.Targets.Add(homeRsTarget);
// Create a MoveInstruction for the RobTarget.
RsMoveInstruction homeInstr = new RsMoveInstruction(station.ActiveTask, "Move", "Default", MotionType.Linear, station.ActiveTask.ActiveWorkObject.Name, target1.Name, station.ActiveTask.ActiveTool.Name);
// Add it to myPath.
myPath.Instructions.Add(homeInstr);
// now set axis values
double[] eaValues = MyAxisVals.GetAxisValues();
eaValues[5] = CursData.BasicAngleAtMidptDeg;
ExternalAxisValues.SetAxisValues(ref MyAxisVals, eaValues);
target1.SetExternalAxes(MyAxisVals, false);
Could anybody supply a code snippet showing how to control the external axis programmatically or indicate where I should be looking.
MMike2009-10-05 13:52:01
I am trying to automate the generation of paths for a set of curves along the surface of a cylinder which we have mounted on an external axis, I can set the external axis data ok but I cant get the axis to rotate under programatic control so I can set the configuratons
Code is below;
//activate external unit
station.Irc5Controllers[0].MechanicalUnits["STN1"].ActivationMode = MechanicalUnitActivationMode.Active;
RsTask myTask = station.ActiveTask;
foreach (clsCurveAnalysis CursData in TempList)
{ //poke the data onto the model
Project.UndoContext.BeginUndoStep("RsPathProcedureExample");
try
{
Logger.AddMessage(new LogMessage("Path " + CursData.CurveName + " started"));
// Create a PathProcedure.
RsPathProcedure myPath = new RsPathProcedure("Path_" + CursData.CurveName);
// Add the path to the ActiveTask.
station.ActiveTask.PathProcedures.Add(myPath);
myPath.ModuleName = "MyModule";
myPath.ShowName = true;
myPath.Synchronize = true;
myPath.Visible = true;
RsWorkObject w = station.ActiveTask.ActiveWorkObject;
//loop the points and stuff
for (int i = 0; i < CursData.ExtendedTransformSet.Count; i++)
{
RsRobTarget target1 = new RsRobTarget();
// Set the name of the RobTarget.
target1.Name = station.ActiveTask.GetValidRapidName(CursData.CurveName, "_", 10);
//just translation matrix to position the target
Matrix4 m = (Matrix4)CursData.ExtendedTransformSet;
target1.Frame.Matrix = m;
target1.IsInline = false;
station.ActiveTask.DataDeclarations.Add(target1);
// Create an RsTarget for the RobTarget.
RsTarget homeRsTarget = new RsTarget(station.ActiveTask.ActiveWorkObject, target1);
homeRsTarget.Name = target1.Name;
// Add it to the ActiveTask.
station.ActiveTask.Targets.Add(homeRsTarget);
// Create a MoveInstruction for the RobTarget.
RsMoveInstruction homeInstr = new RsMoveInstruction(station.ActiveTask, "Move", "Default", MotionType.Linear, station.ActiveTask.ActiveWorkObject.Name, target1.Name, station.ActiveTask.ActiveTool.Name);
// Add it to myPath.
myPath.Instructions.Add(homeInstr);
// now set axis values
double[] eaValues = MyAxisVals.GetAxisValues();
eaValues[5] = CursData.BasicAngleAtMidptDeg;
ExternalAxisValues.SetAxisValues(ref MyAxisVals, eaValues);
target1.SetExternalAxes(MyAxisVals, false);
}
}
Could anybody supply a code snippet showing how to control the external axis programmatically or indicate where I should be looking.
MMike2009-10-05 13:52:01
0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 786 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings