<< Click to Display Table of Contents > 

Scanner Card Interface > Example Code > Simple Vector Marking

Simple Vector Marking
Previous pageReturn to chapter overviewNext page

The following example illustrates how to mark a few simple vectors. During the marking process the marking speed is changed on the fly.

First define the stream info variable:

sc_com_control_stream_info si;

 

External triggering is not desired and we do not work in continuous mode for this example:

m_optic_module.ScExternalTrigger = 0;
m_optic_module.ScContinuousMode = 0;

 

Afterwards the stream info structure is filled with information to define the beginning of the data stream. After the following code is executed all commands related to marking, jumping, streaming delays and values are executed and become effective in exactly the same order as they are called:

si.ident = scComControlStreamInfoIdentIdStart;
si.i_2 = scComControlStreamInfoSequenceIdJob;
si.i_1 = -1;
m_optic_module.ScStreamInfo(si);
 
si.ident = scComControlStreamInfoIdentIdStart;
si.i_2 = scComControlStreamInfoSequenceIdMain;
si.i_1 = -1;
m_optic_module.ScStreamInfo(si);

 

Now a device speed is configured for marking, the head is moved to a specific position and the laser is turned on. Because of that, the next two movement commands that draw a simple line are marking operations. Turning the laser on and off also decides which speed is used. In other words, that operation switches between jump speed (laser off state, jump from one position to another) and marking speed (laser on, move the laser for marking) for the movement commands. No separate function calls are necessary for jumping and marking:

m_optic_module.ScSetDeviceSpeed(scComStandardDeviceStyleIDMarkSpeed,20000);
m_optic_module.ScMoveLaserState = 0;
m_optic_module.ScMoveAbs(-15000.0,-15000.0);
m_optic_module.ScMoveLaserState = 1;
m_optic_module.ScMoveAbs(15000.0,-15000.0);
m_optic_module.ScMoveAbs(15000.0,15000.0);

 

The next segment turns the laser off, moves the head to a different position and changes the marking speed. The next marking operation after turning the laser on again uses the new marking speed:

m_optic_module.ScMoveLaserState = 0;
m_optic_module.ScMoveAbs(-5000.0,-5000.0);
m_optic_module.ScSetDeviceSpeed(scComStandardDeviceStyleIDMarkSpeed,10000);
m_optic_module.ScMoveLaserState = 1;
m_optic_module.ScMoveAbs(5000.0,-5000.0);
m_optic_module.ScMoveAbs(5000.0,5000.0);

 

As a last step this sequence of commands defines the end of the current job:

si.ident = scComControlStreamInfoIdentIdEnd;
si.i_2 = scComControlStreamInfoSequenceIdMain;
si.i_1 = -1;
m_optic_module.ScStreamInfo(si);
 
si.ident = scComControlStreamInfoIdentIdEnd;
si.i_2 = scComControlStreamInfoSequenceIdJob;
si.i_1 = -1;
m_optic_module.ScStreamInfo(si);

 

Due to the fact that the system is in non-continuous mode, no actual output has been generated. The sequence that has been defined and sent to the card can now be executed by setting

m_optic_module.ScExecute = 1;

 

This is a non-blocking operation. To stop the execution of the job ScExecute simply has to be set to 0. The same property can be used to check if the current marking sequence is finished: if its value switches from 1 back to 0 the job has been executed.

In case of a continuous operation the call to ScExecute() would have to be performed before sending the streams Main- and Job-Start-commands. That is necessary in this mode to enable the software to send the stream to the scanner card as soon as data is available.