I wanna get the TxRobot while path operation is selected, but cannot get when Operation is TxRoboticSeamOperation, that's why? and if it can be got, How to do?
some code like below:
if (IOp is TxWeldOperation weldOp)
locaOpList = weldOp.GetAllDescendants(weldViaLocaOpFilter);
robot = weldOp.Robot as TxRobot;
else if (IOp is TxGenericRoboticOperation genericRobotOp)
locaOpList = genericRobotOp.GetAllDescendants(genericViaLocaOpFilter);
robot = genericRobotOp.Robot as TxRobot;
else if (IOp is TxContinuousRoboticOperation continueOp)
locaOpList = continueOp.GetAllDescendants(viaLocaOpFilter);
robot = continueOp.Robot as TxRobot;
else if (IOp is TxRoboticSeamOperation seamOp)
locaOpList = seamOp.GetDirectDescendants(seamLocaOpFilter);// cannot get robot.
robot = seamOp
Solved! Go to Solution.
You're not being able to collect the Robot object because TxRoboticSeamOperation does not implement ITxRoboticOrderedCompoundOperation interface (which enables you to collect the robot).
I'm not used to seam operations, so I'm attaching below an image showing everything that appears when I search the interface above in the manual doc. Probably every operation that can collect a robot should be in the list (so a seam operation should be inside of one of the objects listed below).
Although, seeing your code, I assume you could use Interfaces to make your code cleaner (you can avoid a lot of the if/elseif statements) and safer. Have you tried that?