How can we help?

Focas Constants and Variables

You are here:
< All Topics

Focas Source Variables

Focas variables are used to hold data retrieved from Focas enabled devices.

The information in the curly brackets are parameters that must be filled out to specify additional detail about the data being acquired.

Some variables optionally support multiple paths. Valid options are nothing, a path number, or All. These are denoted in the variable list with a {} inside the variable brackets: [focas.variable_name{}]. The following are example values to determine which path to read:

  • Path 1:[Focas.cycle_status] or [Focas.cycle_status{1}]
  • Path 2: [Focas.cycle_status{2}]
  • Loop (checks if a variable is true for any path): [Focas.feed_hold_status{All}]
Variable NameNotes
Active Tool [Focas.active_tool{}]Returns the tool position of the active tool. Any individual path.
Alarm Code [Focas.alarm_code{}]Returns the alarm code without the description. Any individual path.
Alarm Detail [Focas.alarm_detail{}]Returns the alarm code with the description. Any individual path.
Alarm Status [Focas.alarm_status{}]0 = No Alarm. Any individual path.
Capture Focas Alarms [Focas.alarms{}]Used to capture all Focas alarms including those that go off simultaneously. Any individual path or all paths.
Auto Status [Focas.auto_status{}]Return whether a machine is in a RUN, PAUSED, or RESET state. Any individual path.
Axis Feed Rate [Focas.axis_feed_rate{}]Return the axis feed rate of the controlled axis. Any individual path.
Connect Time [Focas.connect_time]The connect time for the most recent poll. No path.
Connected Time [Focas.connected_time]Returns the amount of time in seconds since a successful connection to the Source. No path.
Current Block [Focas.current_block{}]The variable will hold the contents of the current line being executed until reaching the 1st new line or 500 characters, whichever comes first. Any individual path.
Current Executing Block RLN [Focas.current_block_rln{}]The variable will hold the contents of the current line being executed until reaching the 1st new line or 500 characters, whichever comes first. This variable will also remove line numbers that begin with the letter 'N' as well as remove any comment at the end of the line. Any individual path.
Current Executing Line Number [Focas.current_line_number{}]Returns the line number of the code currently executing. Line numbers must be defined in the program as N#### preceding the line of code. Any individual path.
Cycle Status [Focas.cycle_status{}]0 = Idle, 1 = Cycling. Any individual path or all paths.
Downtime Code [Focas.nc_downtime_code{}]Returns the downtime code from a comment in the top 500 characters of the NC program.  The comment must be DOWNTIME=(downtime_code). Any individual path.
Emergency Status [Focas.emergency_status{}]0 = Not in Emergency, 1 = In Emergency. Any individual path or all paths.
Feed Hold Status [Focas.feed_hold_status{}]0 = Not Holding, 1 = Holding. All paths only.
Feed Rate Override [Focas.feedrate_override{}]The current feed rate override as a percentage. Any individual path.
Has Downtime Code [Focas.has_nc_downtime_code{}] True = A downtime code exists in a comment, False = A downtime code does not exist. Any individual path or all paths.
Macro Variable [Focas.macro_variable{}]{VARIABLE}The current value held by a specific macro or system variable. Any individual path.
Mode Selection [Focas.mode_selection{}]The current setting for the mode selection.  Options are MDI (0), MEM (1), EDIT (3), JOG (5).  Constants, which are listed below, can be used to reference these numbers. Any individual path.
Optional Stop (M1) [Focas.optional_stop{}]Returns True if the program has stopped due to an M1 code. Any individual path or all paths.
P Code Macro Variable [Focas.pmacro_variable{}] {VARIABLE} Returns the Value of the specified P-Code macro variable. Any individual path.
Part Count [Focas.part_count{}]Returns the current part count from the Fanuc part counter. Any individual path.
Part Number [Focas.part_number{}]{PART_NUMBER_IDENTIFIER}Returns the part number from a comment in the top 500 characters of the NC program. By default the comment must be (PARTNUMBER=123456-01) where 123456-01 is the actual part number. (PARTNUMBER=); will return NONE. If your Focas part syntax is not "PARTNUMBER=" place the correct syntax in place of PART_NUMBER_IDENTIFIER. The syntax parameter is case sensitive. This parameter is optional, if your part syntax is "PARTNUMBER=" then the portion including {} can be omitted. Spaces and parentheses in the comment are ignored. Use this to find a part number in comments when your program does not start immediately after being loaded. Any individual path.

Works with CNC Memory and Fanuc Data Server. Cannot read from External Memory.
Part Number Executing Program [Focas.part_number_fep{}]{PART_NUMBER_IDENTIFIER}Returns the part number from a comment in the executing program regardless of where the machine is in the program. Part Number Identifier syntax works the same as [Focas.part_number]. Use this to find a part number in your executing program comments when your program starts immediately after being loaded. Any individual path.

Works with CNC Memory and Fanuc Data Server. Cannot read from External Memory.
Part Number Main Program [Focas.part_number_fmp{}]{PART_NUMBER_IDENTIFIER}Returns the part number from a comment in the main program regardless of where the machine is in the program. This variable will always read from the main program even if the machine is currently in a subprogram. Part Number Identifier syntax works the same as [Focas.part_number]. Use this to find a part number in your main program comments when your program starts immediately after being loaded. Any individual path.

Works with CNC Memory and Fanuc Data Server. Cannot read from External Memory.
Program Comment [Focas.comments{}]{string}Returns the program comment after the provided search string. If no string is provided all comments in the program are returned. Any individual path.

Works with CNC Memory and Fanuc Data Server. Cannot read from External Memory.
Program Number Executing [Focas.program_number_executing{}]Returns the executing program number.  This may be the main program or a sub program. Any individual path.
Program Number Main [Focas.program_number{}]Return the active main program number. Any individual path.
Program Stop (M0) [Focas.program_stop{}]Returns True if the program has stopped due to an M0 code. Any individual path or all paths.
Rapid Override [Focas.rapid_override{}]Returns the percentage of the rapid traverse override. Any individual path.
Read PMC Address [Focas.pmc_address_value{}] {PMC START ADDRESS,PMC END ADDRESS}Returns the content of the selected PMC range.  You can also enter in one address to return a single value.  Please note that when using PMC address as a result within an expression you must use parenthesis for example:[PCSDB.send_part_start] {([Focas.pmc_address_value]{D52,D54})}. Any individual path.
Reads a Bit Value of an Address [Focas.pmc_address_bit_value{}] {PMC ADDRESS,BIT (0-7)}Returns a 1 or a 0 for the specified bit. Any individual path.
Single Block Status [Focas.single_block_status{}]0 = Single Block off, 1 = Single Block On. Any individual path or all paths.
Spindle Load Meter [Focas.spindle_load_meter{}] {SPINDLE NUMBER}Returns the load on the specified spindle. Any individual path.
Spindle Load Meter Percent [Focas.spindle_load_meter_percent{}] {SPINDLE NUMBER}Spindle Load in percent for the specified spindle. Any individual path.
Spindle Override [Focas.spindle_override{}]The active spindle override as a percentage. Any individual path.
Spindle Speed [Focas.spindle_speed{}] {SPINDLE NUMBER}Returns the speed of the specified spindle. Any individual path.

The following variables hold the value for the previous poll from the Control. The same rules for reading paths above will apply.

Variable NameSyntax
Active Tool (Previous)[Focas.prev_active_tool{}]
Alarm Code (Previous)[Focas.prev_alarm_code{}]
Alarm Detail (Previous)[Focas.prev_alarm_detail{}]
Alarm Status (Previous)[Focas.prev_alarm_status{}]
Alarms (Previous)[Focas.prev_alarms{}]
Auto Status (Previous)[Focas.auto_status{}]
Axis Feed Rate (Previous)[Focas.prev_axis_feed_rate{}]
Connect Time (Previous)[Focas.prev_connect_time]
Connected Time (Previous)[Focas.prev_connected_time]
Current Executing Block (Previous)[Focas.prev_current_block{}]
Current Executing Block RLN (Previous)[Focas.prev_current_block_rln{}]
Current Executing Line Number (Previous)[Focas.prev_current_line_number{}]
Cycle Status (Previous)[Focas.prev_cycle_status{}]
Emergency Status (Previous)[Focas.prev_emercency_status{}]
Feed Hold Status (Previous)[Focas.prev_feed_hold_status{}]
Feed Rate Override (Previous)[Focas.prev_feedrate_override{}]
Macro Variable (Previous)[Focas.prev_macro_variable{}]{VARIABLE}
Main Program Number (Previous)[Focas.prev_program_number{}]
Mode Selection (Previous)[Focas.prev_mode_selection{}]
Optional Stop (M1) (Previous)[Focas.prev_optional_stop{}]
P Code Macro Variable (Previous)[Focas.prev_pmacro_variable{}] {VARIABLE}
Part Count (Previous)[Focas.prev_part_count{}]
Part Number (Previous)[Focas.prev_part_number{}]
Part Number Executing Program (Previous)[Focas.prev_part_number_fep{}]
Part Number Main Program (Previous)[Focas.prev_part_number_fmp{}]
Program Comment (Previous)[Focas.prev_comments{}]
Program Number Executing (Previous)[Focas.prev_program_number_executing{}]
Program Stop (M0) (Previous)[Focas.prev_program_stop{}]
Rapid Override (Previous)[Focas.prev_rapid_override{}]
Read PMC Address (Previous)[Focas.prev_pmc_address_value{}] {ADDRESS}
Single Block Status (Previous)[Focas.prev_single_block_status{}]
Spindle Load Meter (Previous)[Focas.prev_spindle_load_meter{}] {SPINDLE NUMBER}
Spindle Load Meter Percent (Previous)[Focas.prev_spindle_load_meter_percent{}] {SPINDLE NUMBER}
Spindle Override (Previous)[Focas.prev_spindle_override{}]
Spindle Speed (Previous)[Focas.prev_spindle_speed{}] {SPINDLE NUMBER}

Focas Constants

Constant NameSyntax
Idle[Focas.IDLE]
Cycling[Focas.CYCLING]
MDI Mode[Focas.MDI]
Memory Mode[Focas.MEM]
Edit Mode[Focas.EDIT]
Jog Mode[Focas.JOG]

Focas Target Commands

Focas Command NameSyntax
Send ON byte[Focas.send_on_byte]{ADDRESS,BIT}
Send OFF byte[Focas.send_off_byte]{ADDRESS,BIT}
Send Macro Variable[Focas.send_macro_variable]{VARIABLE,VALUE,DECIMAL PLACES}

Table of Contents