cancel
Showing results for 
Search instead for 
Did you mean: 

How to obtain Circ Motion in a Location

Creator
Creator

I tried to get an information about the motiontype (PTP, LIN or CIRC) of a location.

 

As i understand, these information is stored in the location parameters.

Especially the integer parameter "RRS_MOTION_TYPE" tells me what kind of Type it is

1 is PTP, 2 in LIN.

 

But now i try to get / set a location as Circ.

When ever i set a location as circ in PS and look into the location object, the "RRS_MOTION_TYPE" stays 2.

But 2 is LIN.

 

How can i obtain the information for a CIRC location?

 

private int getMotionType(TxRoboticViaLocationOperation loc)

{

int result = 0;

ArrayList Location_paramList = loc.Parameters; //get all Parameters as an Arraylist

for (int i = 0; i < Location_paramList.Count; i++) //iterate throug the arraylist

{

if (Location_paramList[i].GetType() == typeof(TxRoboticIntParam)) //if param is int

{

try

{

TxRoboticIntParam intParam = Location_paramList[i] as TxRoboticIntParam;

if (intParam.Type == "RRS_MOTION_TYPE")

{

result = intParam.Value; //return motiontype

}

}

catch (Exception e)

{

MessageBox.Show(e.Message);

throw;

}

}

}

return result;

}

 

 

3 REPLIES

Re: How to obtain Circ Motion in a Location

Creator
Creator

i found it out, by my self.

 

PTP is RRS_MOTION_TYPE 1

LIN is RRS_MOTION_TYPE 2

CIRC is RRS_MOTION_TYPE 4

 

i was checking for 3, but this must be something else

Re: How to obtain Circ Motion in a Location

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi,

 

You can easily check this by using the "RoboticParameterViewer" which is downloadable from GTAC.

 

 

paraViewer.jpg

Re: How to obtain Circ Motion in a Location

Siemens Phenom Siemens Phenom
Siemens Phenom

You can also read the olp parameters using that code. This is how you read the parametrs that you see in the Path Editor columns. You need to specify the name of the column and you get a string value for it.

The output of the code bellow is "Motion Type = CIRC" or PTP or LIN

 

public void ShowMotionType()
        {
             TxObjectList selectedObjects = TxApplication.ActiveSelection.GetItems();
             if (selectedObjects.Count == 1)
             {
                 ITxRoboticLocationOperation op = selectedObjects[0] as ITxRoboticLocationOperation;
                 if (op != null)
                 {
                     string paramValue = GetDynamicParameter((op.Collection as ITxRoboticOrderedCompoundOperation).Robot.Controller.Name, "Motion Type", op);
                     MessageBox.Show("Motion Type = " + paramValue);
                 }
             }
        }

        public string GetDynamicParameter(string controllername, string columnName, ITxOperation op)
        {
            string paramValue = string.Empty;

            TxOlpControllerUtilities utils = new TxOlpControllerUtilities();
            ITxOlpRobotControllerParametersHandler paramHandler = (ITxOlpRobotControllerParametersHandler)utils.GetInterfaceImplementationFromController(controllername, typeof(ITxOlpRobotControllerParametersHandler), typeof(TxRobotSimulationControllerAttribute), "ControllerName");
            if (paramHandler != null)
            {
                if (paramHandler.HasComplexRepresentation(columnName, op, TxOlpCommandLayerRepresentation.UI))
                {
                    paramValue = paramHandler.GetComplexRepresentation(columnName, op, TxOlpCommandLayerRepresentation.UI);
                }
            }

            return paramValue;
        }