Technical Support FAQs | Updates | Technical Bulletins | Manuals| Drawings & 3D Models

 

Sign up to receive FH Flyer/ Fenix Flyer Technical Updates via email

What is the Event Builder and how do I use it?

 

Overview

 

The Event Builder allows a great deal of flexibility in the design and programming of custom automation sequences.

 

For instance, WinMark Pro'’s automation design provides a sequenced method of controlling input and output channels on the FLCC and the marking head. (See Technical Bulletin 01, available here, for complete details of the I/O available on the various models of marking heads and FLCCs.) The flowchart available from WinMark’s Help menu shows the automation flow (see the automation overview here).

 

But what if you need to set an output bit immediately after the mark is complete, and then want to verify an input bit before looping back to the beginning of the mark sequence? The WinMark automation scheme provides four distinct Event Builder stages that may be customized as desired:

 

      On Before Mark Session    runs once at the beginning of the mark session

      On Before Mark Piece       runs once before every mark in the mark session

      On After Mark Piece          runs once after every mark in the mark session

      On After Mark Session       runs once at the end of the mark session

 

So, what is a Mark Session? The mark session begins when the Mark command button (or the F1 key) is pressed, and ends when the number of pieces marked is equal to the drawing’s Mark Count property. Note that the mark session may be aborted by pressing the ESC key, but WinMark will not execute the On After Mark Session event builder commands*.

 

*Beginning with v4.3.3.4528, WinMark has a new Event Builder stage (On Abort Mark Session) that provides a means to control the marker’s behavior in the case of an aborted mark session.

 

Event Builder Commands

 

The Event Builder provides a number of pretty powerful automation commands.

What the Event Builder WILL NOT do is conditional branching – you cannot program the software to follow path A or path B based upon the result of a true/false test. The Event Builder allows a number of commands to be executed one at a time, with no way to break out of the EB if a condition is not met. If your application requires this sort of functionality, you should look at incorporating our ActiveX control into a custom User Interface.

The number of commands provided in WinMark’s event builder stages has grown over time. If you find that the WinMark version you are using does not include a command you need, you can upgrade your WinMark software from our download page, found here.

The current version of WinMark provides the following commands:

 

AskUserInput prompts the operator to input data through the keyboard

AssignDate                assigns a date/time/shift code

CallDLLFunc               allows the use of a custom DLL

DoBeep                      beeps (what else?)

DoPause                    pauses for a specified number of milliseconds

IncSerial                     increments a serial number

MarkingHeadOn          checks to see that the marking head is powered up, sets or clears output bit(s) if false

MatchDigitalState       tests for a particular input state, then assigns the True/False boolean result to an object property

ReadFromSerialPort    reads data in from the WinMark PC’s RS232 port, then assigns the data to the chosen object and property

ReadLineFromFile       reads data in from a text file, then assigns the data to the chosen object and property

ReadyStatus              (for use with a Fenix marker) checks the Fenix ready status, sets or clears output bit(s) if false

RestoreProperty          reads a property value from a ‘DAT’ file

SaveProperty              writes a property value to a ‘DAT’ file

SetDigitalState           sets output bit(s)

WaitDigitalState          checks the status of input bit(s), waits for a specified amount of time before moving on through the mark automation

 

[Back to top]

 

Command Configuration

 

Most* of the commands are configurable using ‘Command Details’ and ‘Target Object and Property’ settings:

 

Command Details define WinMark’s interaction with the command, such as I/O card address, timeout duration and user prompts. The command details in your version of WinMark may differ from those listed in this FAQ, as features and hardware support change over time. For instance, early versions of WinMark support only the analog head’s D/A card or the ISA type Fiber Link Controller Card (FLCC). The I/O card address Command Detail for these versions of WinMark is given as ‘D/A Card Address’. For WinMark v4, which supports only the PCI card, this Command Detail may be given as ‘PCI Card ID’. 

 

Target Object and Property (TO&P) selections define the object, and its property, to which the command’s result will be applied. All objects contained within the mark file are available for use. Once the target object is selected, you may choose from any of its properties. Note that the event builder will not test the target object and property selections to verify that the data type generated by the command matches up with the data type required of the target property. For instance, the MatchDigitalState command generates a Boolean value (True or False) that is meant to be applied to a Boolean property of the Target Object. If the Text Caption property of a Text object is selected, the caption will change to either ‘0’ or ‘1’. The data types assigned by the various commands are provided below in the command definitions.

 

* Some commands, such as DoBeep require little or no configuration. See the command definitions listed below for more information.

 

Command Definitions

 

AskUserInput

 

Description:

 

This command is similar to the ‘Auto Text Type: User Entry Text’ automation. When the command is executed, WinMark displays a message box that prompts the operator for data entry. Unlike the Auto Text function, which applies the entered data to the caption property of the text or barcode object, the AskUserInput command allows the entered data to be applied to any property of any of the drawing’s objects.

 

For instance, the operator may be prompted to enter any of the following:

the X or Y axis position data for an object

the mark power or velocity of an object

the number of parts to be marked in a mark session

the field rotation of the drawing

 

Furthermore, a data value that is to be applied to an entire lot of parts may be entered only once at the beginning of the mark session by using the AskUserInput command in the OnBeforeMarkSession event builder (see the Automation Flowchart in WinMark’s Help menu).

 

Command Details:

 

User Prompt           defines the string to be displayed in the user entry message box

Use Default            determines where the default data value is to be obtained:

      From Current Property Value uses the object’s current property value

      From Default Text takes the value defined in the Default Text property

Default Text           the default value to be used if Use Default is set to From Default Text

 

Target Object and Property:

 

Any Property of any of the drawing’s objects may be selected. Note that the AskUserInput command has no means to evaluate the user’s input data for suitability to the target property. For instance, if the command is configured to prompt the operator for the ObjectLeftPosition value of an object, the operator may enter a value that will put the object outside of the allowable marking field.

 

If you need to perform error checking on the data that has been entered, you will need to look at creating a custom application using our ActiveX control.

 

Examples:

 

To prompt the operator to enter the number of parts to be marked each mark session:

 

To read a text or barcode caption in from a barcode wedge (a scanner that plugs into the keyboard port on the WinMark PC) and apply it to an object (in this case Text1) for the entire mark session:

 

[Back to top]

 

AssignDate  

 

Description:

 

This command is similar to the ‘Auto Text Type: Date Code Text’ automation. When the command is executed, WinMark replaces the text or barcode caption with the date/time code value derived from the WinMark PC’s system clock. This command may be used to assign a date/time code value to an entire lot of parts by calling the command from the OnBeforeMarkSession event builder.

 

Given it’s superior functionality, you are advised to use the Auto Text: Date Code Text automation, unless you need to perform the AssignDate only at the beginning or end of the mark session.

 

Command Details:

 

Date Format specifies the date format to be used to define the Target Object’s property value. The date format may be any one of the standard formats that are pre-defined in WinMark, or a custom format, configured using the Date Format Customization window, described here.

 

Target Object and Property:

 

Any Property of any of the drawing’s objects may be selected. Note that the AssignDate command has no means to evaluate the date code’s data for suitability to the target property. For instance, if the command is configured to assign the date code to the drawing’s Field Width property, the scaling of the drawing will be severely affected.

 

Examples:

 

To assign a Julian production date code to a Data Matrix barcode (2D Barcode1) at the beginning of the mark session, so that the date doesn’t change if the mark session runs past midnight:

 

 

[Back to top]

CallDLLFunc

 

Description:

 

You can use CallDLLFunc to gain a great level of flexibility in your WinMark automation routine. For instance, if you need a custom date code that cannot be generated using WinMark’s available format commands, you can create a DLL that will read the system clock and return a date code string formatted in any way you like. This same sort of functionality can be attained by designing a custom front end using the WinMark ActiveX control, but a DLL approach contains only the root code capability without the Graphical User Interface design investment.

 

The DLL may return string or numeric data, but the data type should match the type expected by the Target Object and Property.

See the Program Files/WinMark/Samples/SampleDLL subfolder on your WinMark PC for an example DLL written in C++. 

 

Command Details:

 

DLL Filename specifies the DLL to be used. By default, the DLL will be expected to be placed in the WinMark folder. Some versions allow the DLL to be located elsewhere, in which case this property must define the entire path name.

 

Function Name specifies the function within the DLL that is to be used. The DLL may contain only one, or multiple functions.

 

User Arg #1, 2, 3 may be used to pass argument values to the DLL. For instance, the sample SerialComm DLL included with WinMark takes the serial port and the timeout value as arguments.

 

DoBeep    

     

Description:

 

Well… it beeps. It will not play Yankee Doodle Dandy, it just beeps. If you need to audibly prompt the operator to do something, you can have the PC beep at them. Enough said.

 

DoPause

       

Description:

 

Allows the insertion of a delay within the automation loop. The automation loop described here pretty well relieves the system of any need for delays, but in case you want to slow things down a little, you can use the DoPause command.

 

Command Details:

 

Delay (msecs) specifies the amount of time to pause in milliseconds. By default, this value is set to 1000, which provides a delay of 1 second, but can be set to 10 seconds or more (depending on WinMark version). 

 

Example:

 

To generate an output pulse of 250millisecond duration on OUT4, to take place after each mark:

 

[Back to top]

IncSerial     

   

Description:

 

This command is a limited version of the Auto Text: Serial Number Text function. The IncSerial command is mainly useful for incrementing (or decrementing) values just once per mark session. Given the superior feature set of the Auto Text function (see the full Auto Text details here), you are better off using it for normal serial number functions. See the SaveProperty, RestoreProperty description, here, for a possible use of the IncSerial command.

 

Command Details:

 

Delta specifies the increment step size. By default, this value is set to 1, but can be set to any positive or negative value. Positive values cause the Serial value to increase when the values is updated, negative values decrease on each update.

 

Target Object and Property:

 

Any Property of any of the drawing’s objects may be selected. As with other Event Builder commands, care must be taken to ensure the incrementing value is assigned to an appropriate Target Object and Property.

 

MarkingHeadOn 

     

Description:

The name of this command is misleading: the command causes WinMark to verify that the marking head is powered up. If the marking head does not respond correctly (is turned off or not communicating), WinMark asserts the defined output bit values.

 

So, the command could well be called MarkingHeadOFF. But I digress….

 

Note that, for this command to be useful, the monitoring circuit must be wired to the FLCC I/O, since the marking head I/O will most likely be inoperative when an error condition is detected. See Technical Bulletin #01, available here, for more information on using the FLCC card I/O.

 

Command Details:

 

DA Card Address (or PCI Card ID) specifies the location of the interface card whose outputs will be set/cleared by the command’s result. The software typically defaults to the card specified in the Tools/General Settings properties, but other cards may be selected. For ISA cards, this value should be the Decimal equivalent of the Hexadecimal card address.

 

Output Bit n defines the desired value of each of the output bits to be set, cleared, or left unchanged (ignored) if the MarkingHeadOn test produces a False result. Be sure to select output bit(s) that exist on the hardware being used.

 

[Back to top]

MatchDigitalState    

 

Description:

 

This command tests the hardware I/O input status and determines whether the inputs match a user defined input pattern. The Boolean result (inputs match = True; inputs don’t match = False) is then assigned to a desired target object’s property. As with other object-manipulating commands, care must be taken to ensure that the Boolean result is appropriate for the property being modified. For instance, the default Target Object and Properties are Drawing and Field Width. If you forget to set the TO&P as desired, you can inadvertently set the Drawing Field Width to zero – a common, but dramatic, mistake!

 

Command Details:

 

Timeout MSecs specifies the amount of time, in milliseconds, that the command will wait for the required input condition to be met. By default, this value is set to 10000 (10 seconds), but can be set to any value from 0 to 1000 seconds. A timeout value of –1 will cause the command to wait indefinitely until the input condition is met (or the ESC key is pressed to abort the mark session).

 

DA Card Address (or PCI Card ID) specifies the location of the interface card whose inputs will be monitored. The software typically defaults to the card specified in the Tools/General Settings properties, but other cards may be selected. For ISA cards, this value should be the Decimal equivalent of the Hexadecimal card address. Note that, for FH and Fenix markers, even if the I/O wiring is routed to the marker, the I/O status is recognized as occurring on the FLCC card to which they are connected via the fiberlink.

 

Input Bit n  specifies, for each input, the required input condition for the command to produce a TRUE result. If an input bit is set to Ignore, the input’s actual status will have no bearing on the result of the match.

 

Target Object and Property:

Any Property of any of the drawing’s objects may be selected. As with other object-manipulating commands, care must be taken to ensure that the Boolean result is appropriate for the property being modified. For instance, the default Target Object and Properties are Drawing and Field Width. If you forget to set the TO&P as desired, you can set the Drawing Field Width to zero, which is a bad thing.

 

Examples:

One of the most useful aspects of the MatchDigitalState command is to use the inputs to determine which objects within a mark file will be marked. See the detailed write-up of this technique here.

 

ReadFromSerialPort           

 

Description:

This is another command that mimics one of the Auto Text functions. ReadFromSerialPort is similar to the Auto Text: Serial Port Text function, but provides much more flexibility regarding the use of the resultant data. You can use this command to read data in from the WinMark PC’s RS232 port, then assign the data to any property of any of the drawing’s objects. You can also use the OnBeforeMarkSession stage to read the data only once at the beginning of the mark session.

 

Command Details:

 

COM Port specifies the COM port through which the RS232 data will be received. WinMark limits the port choices to those that are available on your PC.

 

Timeout MSecs      specifies the amount of time, in milliseconds, that the command will wait for a string of data,  terminated with a Carriage Return character (0D hex), to be received. By default, this value is set to 10000 (10 seconds), but can be set to any value from 0 to 1000 seconds. A timeout value of –1 will cause the command to wait indefinitely until the input condition is met (or the ESC key is pressed to abort the mark session).

 

Close After Read    (in some versions) allows the serial port to be closed between data read commands. Any spurious data is lost, rather than being handled as real data.

 

Target Object and Property:

 

Any Property of any of the drawing’s objects may be selected. Note that the command has no means to evaluate the input data for suitability to the target property. As with the other property modifier commands, take care to properly apply the incoming data to the selected TO&P. WinMark will automatically convert the incoming ASCII text data to the proper data type before applying it to the TO&P.

 

Examples:

 

To set the Mark Count as well as the caption and font used on a text object throughout a mark session:

 

When running this file, you will need to generate three RS232 transmissions. For instance, to program WinMark to mark “ABCDEF” using the ‘European’ Stroke font 100 times, you would send:

 

 

Note that the addition of two more serial port reads would allow the repositioning of the Text1 object each mark session. Other properties could be modified as well, such as Field Rotation, Mirroring, Text Height, Text Radius, etc. A great deal of flexibility is achieved using a single mark file, allowing a separate controller (PLC, PC or other) to dictate the precise nature of the marks made within a mark session.

 

[Back to top]

 

ReadLineFromFile

 

Description:

 

This is another command that mimics one of the Auto Text functions. ReadLineFromFile is similar to the ‘Auto Text: Disk File Text (xxx)‘ function, but provides much more flexibility regarding the use of the resultant data. You can use this command to read data from a text file, then assign the data to any property of any of the drawing’s objects.

 

Command Details:

 

Filename specifies the text file from which the data will be read. The data in the file should be standard ASCII text, with each line terminated by a line feed (LF) character.

 

Target Object and Property:

 

Any Property of any of the drawing’s objects may be selected. Note that the command has no means to evaluate the input data for suitability to the target property. As with the other property modifier commands, take care to properly apply the incoming data to the selected TO&P. WinMark will automatically convert the ASCII text data to the proper data type before applying it to the TO&P.

 

Examples:

 

An advantage that the Event Builder ReadLineFromFile command has over the Auto Text function is that the incoming data can be read just once at the beginning or end of the mark session, or on every mark. In addition, the data can be applied to any property of any object in the file – not just to the text or barcode caption.

 

For instance, a mark file can be setup to mark a list of names from a text file, each name having a different True Type Font applied to the text:

 

When you run this file, you should see that both the caption AND the font of the marked text changes with each mark.

 

Note that a separate file must be created for EACH property to be modified using the text file function. As of version 4.1.0.4402, WinMark has no way of reading the data in from a spreadsheet to be applied to multiple objects or properties.

 

[Back to top]

ReadyStatus

 

Description:

 

This command is similar to the MarkingHeadOn function, except that ReadyStatus checks the status of the laser’s Ready line in a Fenix marker. Within the Fenix is the same laser tube that is used in the 48-2 25W laser. One of the tube’s output signals is a Ready output, which is active when the following conditions are met:

 

Unlike the MarkingHeadOn command, ReadyStatus returning a ‘Not Ready’ result does NOT imply that the Fenix outputs are not functioning… the condition is more likely caused by the RMT INT or RMT KEY circuits being open (see the Fenix manual). The Fenix outputs should still be functional and capable of conforming to the ReadyStatus command output states.

 

Note that OEM heads (FH Index, FH Tracker, FH Smart heads, as well as SH and DH heads) do not electrically monitor the laser’s Ready status, so this command is meaningless unless used with a Fenix marker.

 

Note that WinMark sets or clears the output bit(s) if the Fenix reports that the Ready signal is absent, so this could well be called FenixNOTReady.

 

Command Details:

 

DA Card Address (or PCI Card ID) specifies the location of the interface card whose outputs will be set/cleared by the command’s result. The software typically defaults to the card specified in the Tools/General Settings properties, but other cards may be selected. For ISA cards, this value should be the Decimal equivalent of the Hexadecimal card address.

 

Output Bit n defines the desired value of each of the output bits to be set, cleared, or left unchanged (ignored) if the ReadyStatus test produces a False result. Be sure to select output bit(s) that exist on the hardware being used.

 

SaveProperty, RestoreProperty

 

Description:

 

These commands allow you to save and restore a property for a particular object in your mark file. By its very nature, this set of commands lends itself to dynamic data that you want to save at the end of one mark session, then restore at the beginning of the next mark session. Any property of any of the mark file’s objects may be saved and restored.

The data will be contained in a data file given the same name as the mark file but with a ‘.DAT’ file extension.

 

Example:

 

This automation will restore, increment, and save a Lot number at the beginning of each mark session:

 

With the SaveProperty occurring at the beginning of the session (as opposed to at the end of the session using On After Mark Session), the new Lot number is saved even if the mark session is aborted or ends unexpectedly. 

 

[Back to top]

SetDigitalState         

 

Description:

 

The SetDigitalState command provides a means to program more sophisticated output signal definitions than can be accomplished using the basic SetDigital… stages in the WinMark automation loop. For instance, you can use the SetDigitalState command, along with a DoPause or two, to generate an output pulse (or pulse train) of very specific timing.

Note that there may be Output bits available to be commanded that don’t actually exist in your hardware configuration. Please refer to your product manuals as well as Technical Bulletin #01, available here, for more information on I/O available on various marking hardware models.

 

Command Details:

 

DA Card Address (or PCI Card ID) specifies the location of the interface card whose outputs will be set/cleared by the command’s result. The software typically defaults to the card specified in the Tools/General Settings properties, but other cards may be selected. For ISA cards, this value should be the Decimal equivalent of the Hexadecimal card address.

 

Output Bit n defines the desired value of each of the output bits to be set, cleared, or left unchanged (ignored). Be sure to select output bit(s) that exist on the hardware being used.

 

WaitDigitalState       

 

Description:

 

This command tests the hardware I/O input status and determines whether the inputs match a user defined input pattern. You can specify how much time the command must wait for the defined input condition to be met before generating an error condition.

 

Command Details:

 

Timeout MSecs specifies the amount of time, in milliseconds, that the command will wait for the required input condition to be met. By default, this value is set to –1 (wait forever), but can be set to any value from 0 to 1000 seconds. A timeout value of –1 will cause the command to wait indefinitely until the input condition is met (or the ESC key is pressed to abort the mark session).

 

DA Card Address (or PCI Card ID) specifies the location of the interface card whose inputs will be monitored. The software typically defaults to the card specified in the Tools/General Settings properties, but other cards may be selected. For ISA cards, this value should be the Decimal equivalent of the Hexadecimal card address. Note that, for FH and Fenix markers, even if the I/O wiring is routed to the marker, the I/O status is recognized as occurring on the FLCC card to which they are connected via the fiberlink.

 

Input Bit n specifies, for each input, the input condition required for the software to continue to the next automation stage. If an input bit is set to Ignore, the input’s actual status will have no bearing on the result of the input comparison.

 

 

 

[Back to Questions] [Top of Page] [Previous Page] [Next Page]