9.1.3 Ellipses |
The MARK_ELLIPSE_xxx commands may be used to define elliptical arcs as (parts of) the path that the laser beam should follow over the target surface during marking operations.
Here are some details of the way these commands and their parameters are implemented and handled on the SP-ICE-3 Card.
Consider an ellipse with centre-point C and axis ratio n/m, whose major axis is rotated by φ about C:
From an arbitrary starting point S on the ellipse, we may describe an elliptical arc a terminating at point E:
When the card executes MARK_ELLIPSE_xxx, it first calculates the length of the elliptical arc using the specified parameters, and hence the number of micro-steps required between S and E.
For each successive micro-step along a, the card finds the end point of that micro-step by using a parametric representation of the ellipse.
In 2D, a point P on a may be found from:
P = ( m • cos tP, n • sin tP )
where
tS < tP <= tE,
tE = tS + sweep
The desired value of sweep should be passed as a parameter in calls to methods of the CommandList.AppendEllipseXXX family.
ListAPI Method | SP-ICE-3 Command |
---|---|
Note |
---|
Boilerplate code is omitted from this example for brevity: please refer to 12.3 Example Code in this Manual. |
using ( ClientAPI client = new ClientAPI() ) { try { client.Connect( CardIP ); client.System.ResetToDefaults(); // // For this example, we choose to make the arc fairly small compared to the available marking field. // // Note how we use the (pre-)configured size of the marking field: double sizeX = client.Scanner.GetConfig().FieldSize.X / 10; double sizeY = client.Scanner.GetConfig().FieldSize.Y / 10; // define the starting point S double Sx = 1 * sizeX; double Sy = 5 * sizeY; // define the centre point C double Cx = 3 * sizeX; double Cy = 1 * sizeY; // define the parametric ellipse sweep value // NB: negative value means clockwise double sweep = -1.5; // define the major-axis rotation angle φ (rad) // NB: positive angle = counter-clockwise double phi = 10 * Math.PI / 180; // define the axis ratio double ratio = 1.0 / 3.0; double jumpSpeed = 1.0; double markSpeed = 0.1; CommandList list = new CommandList(); // Append process parameter values to the List: list.AppendJumpSpeed( jumpSpeed ); list.AppendMarkSpeed( markSpeed ); // Append vectors to the List: // // move to the start of the arc at S list.AppendJumpAbs( Sx, Sy ); // // mark the elliptical arc list.AppendEllipseAbs( Cx, Cy, sweep, phi, ratio ); int listID = 0; client.List.Set( listID, list ); client.Laser.ArmLaser( true ); client.List.Execute( listID ); // obviously, the timeout has to be appropriate for the marking speed, etc. int timeoutMs = 1000; int? doneID; if ( !client.List.WaitForListDone( out doneID, timeoutMs ) ) { throw new ListException( "Timed out waiting for ListDone." ); } if ( doneID != listID ) { throw new ListException( "Got ListDone for wrong listID!" ); } } catch ( Exception ex ) { // // TODO: // Define suitable error handling for your application. // Console.WriteLine( "Uhhh, Houston? We've had a problem...{0}", ex.ToString() ); } }