Within a custom plugin I've written for a MPG.
I have
- Code: Select all
UC.AddLinearMoveRel(0, inc / 2, Math.Abs(eX), 50, e.X > 0); //For X Axis
UC.AddLinearMoveRel(2, inc, Math.Abs(eZ), 50, e.Z > 0); //For Z Axis
Where inc is defined as one of 0.1, 0.01, 0.001.
e.X and e.Z are relative encoder counts from MPGs.
This works great for normal moves.
But I'd like to set an angle in a field and use the X axis MPG to jog on the angle (similar to a compound slide on a manual lathe).
This is what I've tried.
- Code: Select all
double rad = angle * (Math.PI / 180);
double dX = inc * Math.Sin(rad) * Convert.ToDouble(e.X);
double dZ = inc * Math.Cos(rad) * Convert.ToDouble(e.X);
UC.AddLinearMoveRel(0, dX / 2, Math.Abs(eX), 50, e.X > 0);
UC.AddLinearMoveRel(2, dZ, Math.Abs(eX), 50, e.X > 0);
When I call two AddLinearMoveRel the motion is not smooth.