# control of external axis

**URL:** <https://tech-community.robotics.abb.com/t/control-of-external-axis/3086>\
**Category:** RobotStudio\
**Created:** [October 5, 2009, 1:49pm UTC](https://tech-community.robotics.abb.com/t/control-of-external-axis/3086 "2009-10-05T13:49:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MMike](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@MMike](https://tech-community.robotics.abb.com/u/MMike)\
**Post date:** [October 5, 2009, 1:49pm UTC](https://tech-community.robotics.abb.com/t/control-of-external-axis/3086/1 "2009-10-05T13:49:56Z")

</div>

Hi  
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._
