1
0

Initial commit

This commit is contained in:
2026-02-22 14:16:24 +01:00
commit 1692d191fa
3684 changed files with 10817616 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
# CUT_METHODS.DAT
##########################################################################
#
# PURPOSE:
#
# This is the database file used for defining "Cut Method" in
# Machining method. The library reference is used for Feeds and
# Speeds Specifications.
#
# REVISIONS:
# Sl.No. Date Name Reason
# 01 06/15/99 Subhash Initial
# 02 07/31/99 Subhash Include Format statement
# 03 10/29/99 Murthy Changes to data and file description
# 04 29-jun-2004 Mark Rief Add 3 HSM
# 05 11-Oct-2005 rlm Update for HSM data
# 06 18-Apr-2019 Reinier Capelle Change text for OPD0_00011
#
##########################################################################
##########################################################################
##
## The following key words for Attribute ids are defined
##
## LIBREF cutmthd_libref - Unique record identifier (Library Reference)
## MODE machine_mode - Machine mode - MILL
## - DRILL
## - LATHE
## NAME name - Name of Cutting Method
## (appears on the label in method view)
#########################################################################
# --------+-------------------------------+---------------------
FORMAT LIBRF MODE NAME DESCRIPTION
#---------+--------------------------------+--------------------
DATA|OPD0_00001|LATHE|TURN, POINT|0
#DATA|OPD0_00002|DRILL|BORING|0
#DATA|OPD0_00003|LATHE|TURN, CUTOFF|0
#DATA|OPD0_00006|MILL|FACE MILLING|0
#DATA|OPD0_00007|MILL|END MILLING|0
#DATA|OPD0_00008|MILL|SLOTTING|0
#DATA|OPD0_00010|MILL|SIDE/SLOT MILL|0
DATA|OPD0_00011|DRILL|DRILLING|With limited Catalogue Machining Data
DATA|OPD0_00021|MILL|HSM ROUGH MILLING|HSM - With Proven Machining Data
DATA|OPD0_00022|MILL|HSM SEMI FINISH MILLING|HSM - With Proven Machining Data
DATA|OPD0_00023|MILL|HSM FINISH MILLING|HSM - With Proven Machining Data

View File

@@ -0,0 +1,64 @@
# *CUT_METHODS.DEF
##########################################################################
#
# PURPOSE:
#
# This is definition file for defining "Cut Method" in
# Machining method from a database.
#
# REVISIONS:
#
# 00 23Mar99 Murthy R Mandaleeka Initial Version
# 01 26JUL99 Subhash Changed order of attributes
# presented
# 02 29OCT99 Murthy R Mandaleeka Changed RSET names
# 03 15Jan2003 rlm Add alias for Description and
# add it to the RSET
##########################################################################
DB_PREFIX "DB("
DB_SUFFIX ")"
ESS_PREFIX "ESS("
ESS_SUFFIX ")"
DB_ALIAS libref
{
DB_ID LIBRF
DB_ID_TYPE s
DIALOG_NAME "libref"
RSET_NAME "Library Reference"
}
DB_ALIAS mode
{
DB_ID MODE
DB_ID_TYPE s
DIALOG_NAME "mode"
RSET_NAME "Mode"
}
DB_ALIAS name
{
DB_ID NAME
DB_ID_TYPE s
DIALOG_NAME "name"
RSET_NAME "Name"
}
DB_ALIAS description
{
DB_ID DESCRIPTION
DB_ID_TYPE s
DIALOG_NAME "description"
RSET_NAME "Description"
}
LIBREF libref
CLASS CUT_METHOD
{
TYPE CUT_METHOD
QUERY "[1] == [1]"
DIALOG libref mode name
RSET libref mode name description
UI_NAME "Cutting Method"
}

View File

@@ -0,0 +1,485 @@
# *CUT_METHODS.TCL
###############################################################################
# cut_methods.tcl - DBC Event Handler for Cut Methods database stored
# as ascii file
###############################################################################
# REVISIONS
# Date Who Reason
# 03/24/99 Murthy Mandaleeka Initial
# 05/19/99 Murthy Mandaleeka New Environment Variable
# 07/21/99 Subhash Included dbc_general_ascii.tcl file
# 07/21/99 Subhash Used general functions for
# opening and reading dat files.
# 08/06/99 Subhash Removed some unwanted comments
# 08/20/99 Subhash Added procedure
# ASC_file_execute_query_check_attr
# to search for the records with the
# same mode as the operation.
# This procedure is a modification of
# ASC_file_execute_query
# 11/11/2003 rlm Add ASC_output_header
# 01/30/2004 rlm Move ASC_write to dbc_ascii_general
# 02/12/2004 rlm Add last revision information
# 06/28/2011 Peter Mao 6556892 Add DBC_ask_library_values
# 08/10/2020 Yusheng Chen 9847704 Initialize file_unit in DBC_retrieve
# 08/12/2023 Xi Wang Add ASC_translate_att_alias in DBC_translate_att_alias to fix query
##############################################################################
#
# The format of each line in the text file is:
#
# cut_method_index - Integer
# machine_mode - String
# cut_method - String
#-------------------------------------------------------------------------------
#---------------------------------------------
# Non DBC Global Variables
#---------------------------------------------
#MOM_set_debug_mode ON
#set dbFileName "[MOM_ask_env_var UGII_CAM_LIBRARY_FEEDS_SPEEDS_DATA_DIR]cut_methods.dat"
set DEBUG 0
set fPointer ""
#---------------------------------------------
# Global variables set by DBC for Input/Output
#---------------------------------------------
set dbc_lhs_exp ""
set dbc_rhs_exp ""
set dbc_relop ""
set dbc_query ""
set dbc_subqry1 ""
set dbc_subqry2 ""
set dbc_boolop ""
set dbc_class_name ""
set dbc_attr_count 0
set dbc_attr_id ""
set dbc_query_count 0
set dbc_cutmthd_libref ""
set dbc_var_list ""
set dbc_machine_mode "MILL"
set asc_debug 0
#---------------------------------------------
proc ASC_t_create_filename {env_var_name filename} \
{
#
# Creates a complete filename by evaluating an environment variable
# for the directory information
#
set env_var [MOM_ask_env_var $env_var_name]
if { $env_var == "" } \
{
set message "Can't read environment variable $env_var_name"
MOM_abort "\n $message"
}
set fname ""
set fname [append fname $env_var $filename]
return $fname
}
#---------------------------------------------
proc MOM__boot {} {
#---------------------------------------------
# source some general procedures
#
# dbc_ascii_general.tcl
#
set filename \
[ASC_t_create_filename "UGII_UG_LIBRARY_DIR" "dbc_ascii_general.tcl"]
if { [catch {source $filename}] == "1" } \
{
set message "Can't load .tcl file: $filename"
MOM_abort "\n $message"
}
}
proc MOM__halt {} \
{
}
#------------------------------------------------------------
proc DBC_init_db { } \
{
global DEBUG
global dataBase
global lastRowNumber
global dbFileName
global fPointer
global asc_file_name
set asc_part_units ""
set data_unit 0
set mode 0
#
# Set the filename for ASCII Data File
#
ASC_set_data_file_name
#
# And load the file into memory
#
# ASC_load_data_file $asc_file_name $data_unit $mode
# Since we are now reading the records one by one, no need to load
# the data file. ( Changed on 20-Aug-99 )
}
#---------------------------------------------
proc ASC_set_data_file_name {} {
#---------------------------------------------
global dbc_part_units
global asc_file_name
global asc_part_units
MOM_ask_part_units ;# writes to dbc_part_units
set env_var UGII_CAM_LIBRARY_FEEDS_SPEEDS_DATA_DIR
set asc_file_name [ASC_t_create_filename "$env_var" "cut_methods.dat"]
set asc_part_units $dbc_part_units
}
#---------------------------------------------
proc DBC_translate_att_alias {} {
#---------------------------------------------
global DEBUG
global dbc_alias
global dbc_id
# The input dbc_id is the column in the RSET
# set dbc_id "\$dataBase($dbc_id)"
ASC_translate_att_alias
}
#------------------------------------------------------------
proc DBC_create_criterion { } {
#------------------------------------------------------------
global DEBUG
global dbc_lhs_exp
global dbc_rhs_exp
global dbc_relop
global dbc_query
# set dbc_query "\[$dbc_lhs_exp\] $dbc_relop \[$dbc_rhs_exp\]"
ASC_create_criterion
}
#------------------------------------------------------------------------
proc DBC_create_query { } {
#------------------------------------------------------------------------
global DEBUG
global dbc_query
global dbc_subqry1
global dbc_subqry2
global dbc_boolop
set dbc_query "$dbc_subqry1 $dbc_boolop $dbc_subqry2"
ASC_create_query
}
#---------------------------------------------
proc ASC_file_execute_query_check_attr { file_name file_unit } \
{
#
# Executes query on cut_methods file. This procedure is derived from
# ASC_file_execute_query.It is slightly modified so that an attribute
# of the record can be checked for some value and then populated to Rset
#
# Input filename - name of the database file, in this case cut_methods.dat
#
# file_unit - Unit of the records, in this case none
#
# Returns 0 -> Succesful Loading
# 1 -> File open error
#
global asc_debug
global dbc_class_name
global dbc_query
global dbc_query_count
global dbc_attr_count
global dbc_attr_aliases
global dbc_attr_id
global asc_database
global asc_database_count
global dbc_machine_mode
global asc_next_line
if { $asc_debug == "1" } {
puts "ASC_file_execute_query"
puts "dbc_class_name = $dbc_class_name"
puts "dbc_query = $dbc_query"
}
# The following procedure writes to the variables
# dbc_attr_count, dbc_attr_aliases
DBC_load_rset_data
#
# Open the file
#
set ret_code [catch {open $file_name "r"} fp]
if { $ret_code } \
{
return 1
}
ASC_init_database
#
# Loop over all the DATA records
#
# The db_row variable has to be initialized (see also ASC_translate_att_alias)
set db_row 0
set rset_row 0
set asc_next_line ""
while {[ASC_read_next_db_object $fp $file_name $file_unit $db_row] >= 0} \
{
set local_dbc_machine_mode [ASC_ask_att_val MODE $db_row "" 0 flag]
if {[string compare $dbc_machine_mode $local_dbc_machine_mode] == 0 ||
[string compare $dbc_machine_mode "ALL"] == 0 } \
{
set dum [catch {expr $dbc_query} ret]
if { $ret == "1" } \
{
ASCi_write_to_rset fp $dbc_attr_count dbc_attr_aliases \
$rset_row $db_row
incr rset_row
incr dbc_query_count
}
catch {unset asc_database}
set asc_database_count 0
}
}
if { $asc_debug == "1" } {
puts "End of ASC_file_execute_query "
puts "Count: $dbc_query_count"
}
close $fp
return 0
}
#------------------------------------------------------------------------
proc DBC_execute_query { } {
#------------------------------------------------------------------------
global asc_units
global file_unit
global asc_file_name
set file_unit $asc_units(unknown)
ASC_file_execute_query_check_attr $asc_file_name $file_unit
}
#---------------------------------------------------------------------
proc DBC_retrieve { } {
#---------------------------------------------------------------------
global DEBUG
global dbc_libref
global dbc_retrieve_var_list
global dataBase
global dbc_machine_mode
global dbc_name
global dbc_description
global dbFileName
global fPointer
global asc_debug
global asc_database_count
global asc_file_name
global file_unit
# intialize file_unit
if { ![info exists file_unit] } {
global dbc_part_units
global asc_units
MOM_ask_part_units ;# writes to dbc_part_units
if { $dbc_part_units == "metric" } {
set file_unit $asc_units(mm)
} else {
set file_unit $asc_units(inch)
}
}
if { $asc_debug == "1" } \
{
puts " =========================================="
puts " procedure DBC_retrieve for cut methods"
puts " libref -> $dbc_libref"
}
#
# Look for the desired libref
#
set found 2
set found [ASC_file_find_object_by_att $asc_file_name $file_unit \
LIBRF $dbc_libref db_row]
if { $found == 2 } \
{
set message "Error retrieving Cut Method from external library."
set message "$message \n Cut Method with the library reference $dbc_libref"
set message "$message \n does not exist in the"
set message "$message \n ASCII Data File: $asc_file_name"
MOM_abort "\n $message"
}
if { $found == 1 } \
{
set message "Error retrieving Cut Method from external library."
set message "$message \n ASCII Data File: $asc_file_name"
set message "$message \n does not exist."
MOM_abort "\n $message"
}
#
# Get the Machining Mode
#
set dbc_machine_mode [ASC_ask_att_val MODE $db_row "" 0 flag]
#
# Get the Cut Method Name
#
set dbc_name [ASC_ask_att_val NAME $db_row "" 0 flag]
}
#------------------------------------------------------------------------
proc DBC_write { } {
#------------------------------------------------------------------------
global asc_database_name
set asc_database_name "cut_methods.dat"
ASC_write
}
#---------------------------------------------------------------------
proc ASC_output_header { fileid } {
#---------------------------------------------------------------------
global dbc_attr_count
global dbc_attr_aliases
global dbc_attr_id
global dbc_logname
set daytime [clock seconds]
set out_daytime [clock format $daytime -format "%a %b %d %Y %I:%M %p"]
set headerMessage "# CUT_METHODS.DAT
##########################################################################
#
# PURPOSE:
#
# This is the database file used for defining Cut Method in
# Machining method. The library reference is used for Feeds and
# Speeds Specifications.
#
#
# REVISED:
# $dbc_logname $out_daytime
#
##########################################################################
##########################################################################
##
## The following key words for Attribute ids are defined
##
## LIBREF cutmthd_libref - Unique record identifier (Library Reference)
## MODE machine_mode - Machine mode - MILL
## - DRILL
## - LATHE
## NAME name - Name of Cutting Method
## (appears on the label in method view)
#########################################################################
# --------+-------------------------------+---------------------"
puts $fileid "$headerMessage"
# load the database structure
DBC_load_rset_data
# output FORMAT line
set format_line "FORMAT"
for {set i 0} {$i < $dbc_attr_count} {incr i} \
{
DBC_ask_attr_id $dbc_attr_aliases($i)
set format_line "$format_line $dbc_attr_id"
}
puts $fileid $format_line
puts $fileid "#--------------------------------------------------------------------------------"
}
proc DBC_ask_library_values {} \
{
global dbc_libref
global dbc_db_ids_count
global dbc_db_ids
global dbc_event_error
global asc_file_name
global asc_units
global dbc_return_status
global dbc_db_ids_value
# Do not change this string
set NO_MATCH "No matching record found for $dbc_libref in $asc_file_name"
set dbc_return_status 0
#
# Look for the desired libref from the file directly
#
set found [ASC_file_find_object_by_att $asc_file_name $asc_units(unknown) \
LIBRF $dbc_libref db_row]
#
# and set the desired values
#
if {$found == 1 || $found == 2} {
set dbc_event_error $NO_MATCH
set dbc_return_status 1
} else {
for { set inx 0 } { $inx < $dbc_db_ids_count } { incr inx } \
{
set dbc_db_ids_value($dbc_db_ids($inx)) \
[ASC_ask_att_val $dbc_db_ids($inx) $db_row "" "" flag]
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,122 @@
# *FEEDS_SPEEDS.DEF
###############################################################################
# Definitions File for Speeds/Feeds Database implemented in an ASCII text file
###############################################################################
# REVISIONS:
#
# 00 23Mar99 Murthy R Mandaleeka Initial Version
# 01 26JUL99 Subhash Changed order of attributes
# presented
# 02 29Oct99 Murthy R Mandaleeka Removed options
# 03 17Feb2004 rlm Add aliases for all fields
##########################################################################
DB_PREFIX "db("
DB_SUFFIX ")"
ESS_PREFIX "ess("
ESS_SUFFIX ")"
################################################################################
# The list of DB_ALIAS
#
# DB_ALIAS <alias>
# {
# DB_ID < identifier of parameter in a UG part file >
# DB_ID_TYPE < Type of the identifier >
# d _ double
# i _ integer
# s _ string
# }
#
###############################################################################
DB_ALIAS libref
{
DB_ID LIBRF
DB_ID_TYPE s
DIALOG_NAME "Speeds/Feeds Key"
}
DB_ALIAS optype
{
DB_ID OPERTYPE
DB_ID_TYPE s
DIALOG_NAME "Operation type "
RSET_NAME "Cut Method"
}
DB_ALIAS ptmtl
{
DB_ID PARTMAT
DB_ID_TYPE s
DIALOG_NAME "Material Name"
RSET_NAME "Part Material"
}
DB_ALIAS tlmtl
{
DB_ID TOOLMAT
DB_ID_TYPE s
DIALOG_NAME "Tool Material"
RSET_NAME "Tool Material"
}
DB_ALIAS depthinch
{
DB_ID DPT_CUT_IN
DB_ID_TYPE d
DIALOG_NAME "Depth"
RSET_NAME "Depth - Inch"
}
DB_ALIAS depthmm
{
DB_ID DPT_CUT_MM
DB_ID_TYPE d
DIALOG_NAME "Depth"
RSET_NAME "Depth - mm"
}
DB_ALIAS speedinch
{
DB_ID SURF_SPEED_FPM
DB_ID_TYPE d
DIALOG_NAME "Speed"
RSET_NAME "Speed - Inch"
}
DB_ALIAS speedmm
{
DB_ID SURF_SPEED_MPM
DB_ID_TYPE d
DIALOG_NAME "Speed"
RSET_NAME "Speed - mm"
}
DB_ALIAS feedinch
{
DB_ID FEED_IPT
DB_ID_TYPE d
DIALOG_NAME "feed"
RSET_NAME "Feed - Inch"
}
DB_ALIAS feedmm
{
DB_ID FEED_MMPT
DB_ID_TYPE d
DIALOG_NAME "feed"
RSET_NAME "Feed - mm"
}
LIBREF optype
CLASS FEEDS_SPEEDS
{
TYPE FEEDS_SPEEDS
QUERY "[1] == [%]"
DIALOG libref optype ptmtl tlmtl depthinch speedinch feedinch
RSET libref optype ptmtl tlmtl depthinch depthmm speedinch speedmm feedinch feedmm
UI_NAME "CAM Speeds and Feeds Library"
}

View File

@@ -0,0 +1,489 @@
# *FEEDS_SPEEDS.TCL
###############################################################################
# feeds_speeds.tcl - DBC Event Handler for database stored as ascii file
###############################################################################
# Revisions
# Date Who Reason
# 03/24/99 Murthy Mandaleeka Initial
# 05/19/99 Murthy Mandaleeka New Environment Variable
# 07/21/99 Subhash Included dbc_general_ascii.tcl file
# 07/21/99 Subhash Used general functions for
# opening and reading dat files.
# 08/06/99 Subhash Changed some functions to improve performance
# 08/19/99 Subhash Changed the logic so that feed and speed value
# is picked from a range depending on depth of cut
# 09/01/99 Gopal Srinath In the retrieve proc removed call to
# MOM_abort.
# 01/15/02 Murthy Mandaleeka Relate more feed types as percentages of Cut feed.
# 06/06/02 Murthy Mandaleeka Update depth of cut for Cavity Milling Operations
# 17Feb2004 rlm Add support for execute_query
# 24May2004 Murthy Mandaleeka Fix StepOver Feedrate Percent problem.
# 06Dec2004 rlm 1369488 Add DBC_execute_query_for_count
# 16Dec2004 rlm 2044460 Add more Cut Depth variables
# 26Oct2018 Shorbojeet Das PR8340732: Add customization support for double precision control.
################################################################################
#
# The format of each line in the text file is:
#
# libref optype ptmtl tlmtl speed feed
#
# libref is a string
# optype is "Milling" "Turning" "Drilling"
# ptmtl is code number for now
# tlmtl is "HSS" "Carbide" "CBN"
# depth is a double
# speed is a double
# feed is a double
#
# The DB_ID of a DB_ALIAS is its field number in the line (0-based)
###############################################################################
#MOM_set_debug_mode ON
#---------------------------------------------
# Non DBC Global Variables
#---------------------------------------------
#set dbFileName "[MOM_ask_env_var UGII_CAM_LIBRARY_FEEDS_SPEEDS_DATA_DIR]feeds_speeds.dat" ; # The ASCII Database File
set DEBUG 1
set fPointer ""
#---------------------------------------------
# Global variables set by DBC for Input/Output
#---------------------------------------------
set dbc_lhs_exp ""
set dbc_rhs_exp ""
set dbc_relop ""
set dbc_query ""
set dbc_subqry1 ""
set dbc_subqry2 ""
set dbc_boolop ""
set dbc_class_name ""
set dbc_attr_count 0
set dbc_attr_id ""
set dbc_query_count 0
set dbc_libref ""
set dbc_var_list ""
set dbc_tool_diameter ""
set dbc_tool_height ""
set dbc_part_units "english" ; # ( english : 0 , metric : 1)
set dbc_cutmthd_libref ""
set dbc_part_material_libref ""
set dbc_tool_material_libref ""
# Default double precision value format.
set double_precision_format "g"
#
# Express feedrates for the following feed types
# as percentages of Cut feedrate.
# A value of 0 indicates no relation to Cut feedrate.
#
set dbc_engage_percent 90
set dbc_first_cut_percent 60
set dbc_approach_percent 0
set dbc_step_over_percent 0
set dbc_retract_percent 0
set dbc_departure_percent 0
set dbc_return_percent 0
set asc_debug 0
proc ASC_t_create_filename {env_var_name filename} \
{
#
# Creates a complete filename by evaluating an environment variable
# for the directory information
#
set env_var [MOM_ask_env_var $env_var_name]
if { $env_var == "" } \
{
set message "Can't read environment variable $env_var_name"
MOM_abort "\n $message"
}
set fname ""
set fname [append fname $env_var $filename]
return $fname
}
#---------------------------------------------
proc MOM__boot {} {
#---------------------------------------------
# source some general procedures
#
# dbc_ascii_general.tcl
#
set filename \
[ASC_t_create_filename "UGII_UG_LIBRARY_DIR" "dbc_ascii_general.tcl"]
if { [catch {source $filename}] == "1" } \
{
set message "Can't load .tcl file: $filename"
MOM_abort "\n $message"
}
}
proc MOM__halt {} \
{
}
#---------------------------------------------
proc DBC_init_db {} {
#---------------------------------------------
global DEBUG
global dataBase
global dbFileName
global fPointer
global asc_file_name
set asc_file_name ""
set asc_part_units ""
set data_unit 0
set mode 0
#
# Set the filename for ASCII Data File
#
ASC_set_data_file_name
# Changed to improve performance
# And load the file into memory
#
ASC_load_data_file $asc_file_name $data_unit $mode
}
#---------------------------------------------
proc ASC_set_data_file_name {} {
#---------------------------------------------
global dbc_part_units
global asc_file_name
global asc_part_units
MOM_ask_part_units ;# writes to dbc_part_units
set env_var UGII_CAM_LIBRARY_FEEDS_SPEEDS_DATA_DIR
set asc_file_name [ASC_t_create_filename "$env_var" "feeds_speeds.dat"]
set asc_part_units $dbc_part_units
}
#---------------------------------------------
proc ASC_get_depthofcut { DB_ROW DPTH_OF_CUT} {
#---------------------------------------------
upvar $DB_ROW db_row
upvar $DPTH_OF_CUT dpth_of_cut
global dbc_part_units
MOM_ask_part_units
if { $dbc_part_units == "english" } \
{
set dpth_of_cut [ASC_ask_att_val DPT_CUT_IN $db_row "%$::double_precision_format" 0 flag]
} else \
{
set dpth_of_cut [ASC_ask_att_val DPT_CUT_MM $db_row "%$::double_precision_format" 0 flag]
}
}
#---------------------------------------------
proc ASC_get_feedspeed { DB_ROW FEED_VALUE SPEED_VALUE } {
#---------------------------------------------
upvar $DB_ROW db_row
upvar $FEED_VALUE asc_feed_value
upvar $SPEED_VALUE asc_speed_value
global dbc_part_units
global dbc_surface_speed
global dbc_feed_per_tooth
if { $dbc_part_units == "english"} \
{
set asc_speed_value [ASC_ask_att_val SURF_SPEED_FPM $db_row \
"%$::double_precision_format" 0 flag]
set asc_feed_value [ASC_ask_att_val FEED_IPT $db_row \
"%$::double_precision_format" 0 flag]
} else \
{
set asc_speed_value [ASC_ask_att_val SURF_SPEED_MPM $db_row \
"%$::double_precision_format" 0 flag]
set asc_feed_value [ASC_ask_att_val FEED_MMPT $db_row \
"%$::double_precision_format" 0 flag]
}
}
#---------------------------------------------
proc ASC_get_depthofcut_from_oper {LOCAL_DEPTH_OF_CUT} {
#---------------------------------------------
upvar $LOCAL_DEPTH_OF_CUT local_depth_of_cut
global dbc_cut_level_max_depth
global dbc_depth_per_cut
global dbc_depth_of_cut
global dbc_max_cut_depth
global dbc_cut_depth
global dbc_range_1_depth_per_cut
global dbc_global_cut_depth
global dbc_multi_depth_cut_increment
if { [info exist dbc_cut_level_max_depth] } \
{
set local_depth_of_cut $dbc_cut_level_max_depth
} elseif { [info exist dbc_range_1_depth_per_cut] } \
{
set local_depth_of_cut $dbc_range_1_depth_per_cut
} elseif { [info exist dbc_depth_per_cut] } \
{
set local_depth_of_cut $dbc_depth_per_cut
} elseif { [info exist dbc_depth_of_cut] } \
{
set local_depth_of_cut $dbc_depth_of_cut
} elseif { [info exist dbc_max_cut_depth] } \
{
set local_depth_of_cut $dbc_max_cut_depth
} elseif { [info exist dbc_cut_depth] } \
{
set local_depth_of_cut $dbc_cut_depth
} elseif { [info exist dbc_global_cut_depth] } \
{
set local_depth_of_cut $dbc_global_cut_depth
} elseif { [info exist dbc_multi_depth_cut_increment] } \
{
set local_depth_of_cut $dbc_multi_depth_cut_increment
} else { set local_depth_of_cut 0}
}
#------------------------------------------------------------------------
proc DBC_create_query { } {
#------------------------------------------------------------------------
global DEBUG
global dbc_query
global dbc_subqry1
global dbc_subqry2
global dbc_boolop
# set dbc_query "$dbc_subqry1 $dbc_boolop $dbc_subqry2"
ASC_create_query
}
#---------------------------------------------
proc DBC_translate_att_alias {} {
#---------------------------------------------
ASC_translate_att_alias
}
#---------------------------------------------
proc DBC_create_criterion {} {
#---------------------------------------------
ASC_create_criterion
}
#------------------------------------------------------------------------
proc DBC_execute_query { } {
#------------------------------------------------------------------------
global asc_database_count
ASC_execute_query
}
#------------------------------------------------------------------------
proc DBC_execute_query_for_count { } {
#------------------------------------------------------------------------
global asc_database_count
ASC_execute_query_for_count
}
#---------------------------------------------
proc DBC_retrieve {} {
#---------------------------------------------
global DEBUG
global dbc_event_error
global dbc_part_units
global dbc_cutmthd_libref
global dbc_part_material_libref
global dbc_tool_material_libref
global dbc_tool_height
global dbc_tool_diameter
global dbc_surface_speed
global dbc_feed_per_tooth
global dbc_engage_percent
global dbc_first_cut_percent
global fPointer
global dbFileName
global asc_database_count
global asc_database
global asc_file_name
global file_unit
global asc_units
global asc_next_line
ASC_get_depthofcut_from_oper local_depth_of_cut
set hig_dpth_cut [expr $local_depth_of_cut + 99]
set low_dpth_cut 0
set index 0
set record_indx 0
set low_record_indx 0
set hig_record_indx 0
set initialize_flag 1
set asc_feeds_file_name $asc_file_name
set asc_next_line ""
if { $dbc_part_units == "english" } \
{
set file_unit $asc_units(inch)
} else \
{
set file_unit $asc_units(mm)
}
## Changed function to improve performance
set ret_code [catch {open $asc_feeds_file_name "r"} fp]
if { $ret_code } \
{
return 1
}
ASC_init_database
#
# Loop over all the DATA records
#
# The db_row variable has to be initialized (see also ASC_translate_att_alias)
set db_row 0
set found 2
set present_record_index 0
set local_depth_of_cut [format "%4.4f" $local_depth_of_cut]
while {[ASC_read_next_db_object $fp $asc_file_name $file_unit $db_row] >= 0} \
{
set ascii_cutmethd_libref [ ASC_ask_att_val OPERTYPE \
$db_row "" 0 flag]
set ascii_part_material_libref [ASC_ask_att_val PARTMAT $db_row \
"" 0 flag]
set ascii_tool_material_libref [ASC_ask_att_val TOOLMAT $db_row \
"" 0 flag]
incr present_record_index
# Find the row for the desired record
if { $dbc_cutmthd_libref == $ascii_cutmethd_libref && \
$dbc_part_material_libref == $ascii_part_material_libref && \
$dbc_tool_material_libref == $ascii_tool_material_libref } \
{
set found 0
set break_flag 1
ASC_get_depthofcut db_row dpth_cut
set dpth_cut [format "%4.4f" $dpth_cut]
if { $dpth_cut == $local_depth_of_cut } \
{
# Obtained the record. Get the values...
set record_indx $db_row
ASC_get_feedspeed record_indx dbc_feed_per_tooth dbc_surface_speed
return 0
} elseif { $dpth_cut < $local_depth_of_cut && \
$dpth_cut > $low_dpth_cut} \
{
## Exact match not found
set low_record_indx $present_record_index
set low_dpth_cut $dpth_cut
# Store the low feeds and speed value in tmp var for future ref.
ASC_get_feedspeed db_row low_feed_per_tooth low_surface_speed
} elseif { $dpth_cut > $local_depth_of_cut && \
$dpth_cut < $hig_dpth_cut } \
{
set hig_record_indx $present_record_index
set hig_dpth_cut $dpth_cut
# Store the high feeds and speed value in tmp var for future ref.
ASC_get_feedspeed db_row hig_feed_per_tooth hig_surface_speed
} else \
{
if { $break_flag == 1} { set break_flag 2}
}
if {$break_flag == 2} { break }
}
}
close $fp
if { $found != 0 } \
{
set dbc_event_error "No appropriate feed speed data found"
return
}
if {$record_indx} \
{
set final_indx $record_indx
} else \
{
if {!$low_record_indx} \
{
set dbc_feed_per_tooth $hig_feed_per_tooth
set dbc_surface_speed $hig_surface_speed
} elseif {!$hig_record_indx} \
{
set dbc_feed_per_tooth $low_feed_per_tooth
set dbc_surface_speed $low_surface_speed
} else \
{
# Exact Match for Depth of Cut not found
set low_diff [expr $local_depth_of_cut - $low_dpth_cut]
set hig_diff [expr $hig_dpth_cut - $local_depth_of_cut]
if {$low_diff < $hig_diff} \
{
# Actual depth of cut is closer to next higher depth of cut in data file
set dbc_feed_per_tooth $low_feed_per_tooth
set dbc_surface_speed $low_surface_speed
} else \
{
# Actual depth of cut is closer to previous lower depth of cut in data file
set dbc_feed_per_tooth $hig_feed_per_tooth
set dbc_surface_speed $hig_surface_speed
}
}
}
}
# To enable the new customization mechanism.
# This should ALWAYS be the last line in the file.
MOM_extend_for_customization UGII_CAM_CUSTOM_LIBRARY_FEEDS_SPEEDS_ASCII_DIR dbc_custom_ascii_feeds_speeds.tcl

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,225 @@
# *MACHINING_DATA.DEF
###############################################################################
# Definitions File for Machining Data Database implemented in an ASCII text file
###############################################################################
# REVISIONS:
#
# 00 23Mar99 Murthy R Mandaleeka Initial Version
# 01 26JUL99 Subhash Changed order of attributes
# presented
# 02 29Oct99 Murthy R Mandaleeka Removed options
##########################################################################
DB_PREFIX "db("
DB_SUFFIX ")"
ESS_PREFIX "ess("
ESS_SUFFIX ")"
################################################################################
# The list of DB_ALIAS
#
# DB_ALIAS <alias>
# {
# DB_ID < identifier of parameter in a UG part file >
# DB_ID_TYPE < Type of the identifier >
# d _ double
# i _ integer
# s _ string
# }
#
###############################################################################
DB_ALIAS libref
{
DB_ID LIBRF
DB_ID_TYPE s
DIALOG_NAME "Speeds/Feeds Key"
}
DB_ALIAS optype
{
DB_ID OPERTYPE
DB_ID_TYPE s
DIALOG_NAME "Operation type "
RSET_NAME "Cut Method"
}
DB_ALIAS ptmtl
{
DB_ID PARTMAT
DB_ID_TYPE s
DIALOG_NAME "Material Name"
RSET_NAME "Part Material"
}
DB_ALIAS tlmtl
{
DB_ID TOOLMAT
DB_ID_TYPE s
DIALOG_NAME "Tool Material"
RSET_NAME "Tool Material"
}
DB_ALIAS diam_in
{
DB_ID DIAM_IN
DB_ID_TYPE d
DIALOG_NAME "Diam"
RSET_NAME "Diam - Inch"
}
DB_ALIAS diam_mm
{
DB_ID DIAM_MM
DB_ID_TYPE d
DIALOG_NAME "Diam"
RSET_NAME "Diam - mm"
}
DB_ALIAS length_in
{
DB_ID LENGTH_IN
DB_ID_TYPE d
DIALOG_NAME "Length"
RSET_NAME "Length - Inch"
}
DB_ALIAS length_mm
{
DB_ID LENGTH_MM
DB_ID_TYPE d
DIALOG_NAME "Length"
RSET_NAME "Length - mm"
}
DB_ALIAS depthinch
{
DB_ID DPT_CUT_IN
DB_ID_TYPE d
DIALOG_NAME "Depth"
RSET_NAME "Depth - Inch"
}
DB_ALIAS depthmm
{
DB_ID DPT_CUT_MM
DB_ID_TYPE d
DIALOG_NAME "Depth"
RSET_NAME "Depth - mm"
}
DB_ALIAS stepover_in
{
DB_ID STEPOVER_IN
DB_ID_TYPE d
DIALOG_NAME "Stepover"
RSET_NAME "Stepover - Inch"
}
DB_ALIAS stepover_mm
{
DB_ID STEPOVER_MM
DB_ID_TYPE d
DIALOG_NAME "Stepover"
RSET_NAME "stepover - mm"
}
DB_ALIAS speedinch
{
DB_ID SURF_SPEED_FPM
DB_ID_TYPE d
DIALOG_NAME "Speed"
RSET_NAME "Speed - Inch"
}
DB_ALIAS speedmm
{
DB_ID SURF_SPEED_MPM
DB_ID_TYPE d
DIALOG_NAME "Speed"
RSET_NAME "Speed - mm"
}
DB_ALIAS feedinch
{
DB_ID FEED_IPT
DB_ID_TYPE d
DIALOG_NAME "feed"
RSET_NAME "Feed - Inch"
}
DB_ALIAS feedmm
{
DB_ID FEED_MMPT
DB_ID_TYPE d
DIALOG_NAME "feed"
RSET_NAME "Feed - mm"
}
DB_ALIAS approach_pct
{
DB_ID APPROACH_PCT
DB_ID_TYPE i
DIALOG_NAME "Approach Percent"
RSET_NAME "Approach Percent"
}
DB_ALIAS engage_pct
{
DB_ID ENGAGE_PCT
DB_ID_TYPE i
DIALOG_NAME "Engage Percent"
RSET_NAME "Engage Percent"
}
DB_ALIAS frstcut_pct
{
DB_ID FRSTCUT_PCT
DB_ID_TYPE i
DIALOG_NAME "First Cut Percent"
RSET_NAME "First Cut Percent"
}
DB_ALIAS stepover_pct
{
DB_ID STEPOVER_PCT
DB_ID_TYPE i
DIALOG_NAME "Stepover Percent"
RSET_NAME "Stepover Percent"
}
DB_ALIAS retract_pct
{
DB_ID RETRACT_PCT
DB_ID_TYPE i
DIALOG_NAME "Retract Percent"
RSET_NAME "Retract Percent"
}
DB_ALIAS return_pct
{
DB_ID RETURN_PCT
DB_ID_TYPE i
DIALOG_NAME "Return Percent"
RSET_NAME "Return Percent"
}
DB_ALIAS depart_pct
{
DB_ID DEPART_PCT
DB_ID_TYPE i
DIALOG_NAME "Depart Percent"
RSET_NAME "Depart Percent"
}
LIBREF optype
CLASS TECH_SETTINGS
{
TYPE TECH_SETTINGS
QUERY "[1] == [1]"
DIALOG libref optype ptmtl tlmtl depthinch speedinch feedinch
RSET libref optype ptmtl tlmtl diam_in diam_mm length_in length_mm depthinch depthmm stepover_in stepover_mm speedinch speedmm feedinch feedmm approach_pct engage_pct frstcut_pct stepover_pct retract_pct return_pct depart_pct
UI_NAME "CAM Machining Data Library"
}

View File

@@ -0,0 +1,879 @@
# *MACHINING_DATA.TCL
###############################################################################
# machining_DATA.tcl - DBC Event Handler for database stored as ascii file
###############################################################################
# Revisions
# Date Who Reason
# 22Oct2003 rlm Initial
# 26Jan2004 rlm Return integers for cut feed percentages
# 26Jan2004 rlm remove rest of debugging code
# 30Jan2004 rlm Move ASC_write to dbc_ascii_general
# 12Feb2004 rlm Add library revision information
# 25Jun2004 rlm Enhance data interpolation
# 26Oct2004 rlm Enhance for import machining data func
# 13Apr2005 rlm Expand hierarchy for retrieve record selection
# 24Jan2006 rlm fix ratio computation protection
# 18Mar2008 rlm add missing continuation on first
# ASC_interpolate_data call
# 14Jan2009 rlm Fix test protecting zero divide when
# computing local_ratio
# 10Feb2009 rlm Fix second line of previous rev
# 24Mar2009 rlm apply holder offset to tool length
# 18Feb2010 rlm Add test for single record diameter match
# 23Jul2010 rlm 6384077 Fix global reference in first fallback test
# 13Apr2011 Peter Mao 1842883 Ignore tool length adjustment if shank is defined
# 16Aug2012 R. Miner 1908948 Perform all tests on all records
# 26Oct2018 Shorbojeet Das PR#8340732: Add customization support for double precision control.
# 08Nov2018 Updates
# 07Jul2020 Benson Wang 9697869 Fix the issue that ASC_get_tool_projection_length can't get correct tool length
# 18Aug2020 Jingzhao Zhang PR#9607517 Support exact match only for maching data
################################################################################
#
# The format of each line in the text file is:
#
# libref optype ptmtl tlmtl speed feed
#
# libref is a string
# optype is "Milling" "Turning" "Drilling"
# ptmtl is code number for now
# tlmtl is "HSS" "Carbide" "CBN"
# depth is a double
# speed is a double
# feed is a double
#
# The DB_ID of a DB_ALIAS is its field number in the line (0-based)
###############################################################################
#MOM_set_debug_mode ON
#---------------------------------------------
# Non DBC Global Variables
#---------------------------------------------
#set dbFileName "[MOM_ask_env_var UGII_CAM_LIBRARY_FEEDS_SPEEDS_DATA_DIR]machining_data.dat" ; # The ASCII Database File
set DEBUG 1
set fPointer ""
#---------------------------------------------
# Global variables set by DBC for Input/Output
#---------------------------------------------
set dbc_lhs_exp ""
set dbc_rhs_exp ""
set dbc_relop ""
set dbc_query ""
set dbc_subqry1 ""
set dbc_subqry2 ""
set dbc_boolop ""
set dbc_class_name ""
set dbc_attr_count 0
set dbc_attr_id ""
set dbc_query_count 0
set dbc_libref ""
set dbc_var_list ""
set dbc_tool_diameter ""
set dbc_tool_height ""
set dbc_part_units "english" ; # ( english : 0 , metric : 1)
set dbc_cutmthd_libref ""
set dbc_part_material_libref ""
set dbc_tool_material_libref ""
# Default double precision value format.
set double_precision_format "g"
#
# Express feedrates for the following feed types
# as percentages of Cut feedrate.
# A value of 0 indicates no relation to Cut feedrate.
#
set dbc_engage_percent 90
set dbc_first_cut_percent 60
set dbc_approach_percent 0
set dbc_stepover_percent 0
set dbc_retract_percent 0
set dbc_departure_percent 0
set dbc_return_percent 0
set asc_debug 0
proc ASC_t_create_filename {env_var_name filename} \
{
#
# Creates a complete filename by evaluating an environment variable
# for the directory information
#
set env_var [MOM_ask_env_var $env_var_name]
if { $env_var == "" } \
{
set message "Can't read environment variable $env_var_name"
MOM_abort "\n $message"
}
set fname ""
set fname [append fname $env_var $filename]
return $fname
}
#---------------------------------------------
proc MOM__boot {} {
#---------------------------------------------
# source some general procedures
#
# dbc_ascii_general.tcl
#
set filename \
[ASC_t_create_filename "UGII_UG_LIBRARY_DIR" "dbc_ascii_general.tcl"]
if { [catch {source $filename}] == "1" } \
{
set message "Can't load .tcl file: $filename"
MOM_abort "\n $message"
}
}
proc MOM__halt {} \
{
}
#---------------------------------------------
proc DBC_init_db {} {
#---------------------------------------------
global DEBUG
global dataBase
global dbFileName
global fPointer
global asc_file_name
global asc_database_count
global dbc_dat_file_override
global dbc_dat_file_name
set asc_file_name ""
set asc_part_units ""
set data_unit 0
set mode 0
#
# Set the filename for ASCII Data File
#
if {[info exists dbc_dat_file_override] } \
{
if {$dbc_dat_file_override == 1} \
{
set asc_file_name $dbc_dat_file_name
} else \
{
ASC_set_data_file_name
}
} else \
{
ASC_set_data_file_name
}
# Changed to improve performance
# And load the file into memory
#
ASC_load_data_file $asc_file_name $data_unit $mode
}
#---------------------------------------------
proc ASC_set_data_file_name {} {
#---------------------------------------------
global dbc_part_units
global asc_file_name
global asc_part_units
MOM_ask_part_units ;# writes to dbc_part_units
set env_var UGII_CAM_LIBRARY_FEEDS_SPEEDS_DATA_DIR
set asc_file_name [ASC_t_create_filename "$env_var" "machining_data.dat"]
set asc_part_units $dbc_part_units
}
#---------------------------------------------
proc ASC_get_tool_size { DB_ROW DIAMETER LENGTH } {
#---------------------------------------------
upvar $DB_ROW db_row
upvar $DIAMETER asc_tool_diameter
upvar $LENGTH asc_tool_length
global dbc_part_units
if { $dbc_part_units == "english"} \
{
set asc_tool_diameter [ASC_ask_att_val DIAM_IN $db_row \
"%$::double_precision_format" 0 flag]
set asc_tool_length [ASC_ask_att_val LENGTH_IN $db_row \
"%$::double_precision_format" 0 flag]
} else \
{
set asc_tool_diameter [ASC_ask_att_val DIAM_MM $db_row \
"%$::double_precision_format" 0 flag]
set asc_tool_length [ASC_ask_att_val LENGTH_MM $db_row \
"%$::double_precision_format" 0 flag]
}
}
#---------------------------------------------
proc ASC_get_machining_data { DB_ROW CUT_DEPTH STEPOVER FEED_VALUE SPEED_VALUE } {
#---------------------------------------------
upvar $DB_ROW db_row
upvar $CUT_DEPTH asc_cut_value
upvar $STEPOVER asc_stepover
upvar $FEED_VALUE asc_feed_value
upvar $SPEED_VALUE asc_speed_value
global dbc_part_units
if { $dbc_part_units == "english"} \
{
set asc_cut_value [ASC_ask_att_val DPT_CUT_IN $db_row \
"%$::double_precision_format" 0 flag]
set asc_stepover [ASC_ask_att_val STEPOVER_IN $db_row \
"%$::double_precision_format" 0 flag]
set asc_speed_value [ASC_ask_att_val SURF_SPEED_FPM $db_row \
"%$::double_precision_format" 0 flag]
set asc_feed_value [ASC_ask_att_val FEED_IPT $db_row \
"%$::double_precision_format" 0 flag]
} else \
{
set asc_cut_value [ASC_ask_att_val DPT_CUT_MM $db_row \
"%$::double_precision_format" 0 flag]
set asc_stepover [ASC_ask_att_val STEPOVER_MM $db_row \
"%$::double_precision_format" 0 flag]
set asc_speed_value [ASC_ask_att_val SURF_SPEED_MPM $db_row \
"%$::double_precision_format" 0 flag]
set asc_feed_value [ASC_ask_att_val FEED_MMPT $db_row \
"%$::double_precision_format" 0 flag]
}
}
#---------------------------------------------
proc ASC_get_feedrate_percentages { DB_ROW APPROACH_PERCENT ENGAGE_PERCENT \
FIRSTCUT_PERCENT STEPOVER_PERCENT RETRACT_PERCENT RETURN_PERCENT DEPART_PERCENT } {
#---------------------------------------------
upvar $DB_ROW db_row
upvar $APPROACH_PERCENT asc_approach_pct
upvar $ENGAGE_PERCENT asc_engage_pct
upvar $FIRSTCUT_PERCENT asc_firstcut_pct
upvar $STEPOVER_PERCENT asc_stepover_pct
upvar $RETRACT_PERCENT asc_retract_pct
upvar $RETURN_PERCENT asc_return_pct
upvar $DEPART_PERCENT asc_depart_pct
set asc_approach_pct [ASC_ask_att_val APPROACH_PCT $db_row \
"%d" 0 flag]
set asc_engage_pct [ASC_ask_att_val ENGAGE_PCT $db_row \
"%d" 0 flag]
set asc_firstcut_pct [ASC_ask_att_val FRSTCUT_PCT $db_row \
"%d" 0 flag]
set asc_stepover_pct [ASC_ask_att_val STEPOVER_PCT $db_row \
"%d" 0 flag]
set asc_retract_pct [ASC_ask_att_val RETRACT_PCT $db_row \
"%d" 0 flag]
set asc_return_pct [ASC_ask_att_val RETURN_PCT $db_row \
"%d" 0 flag]
set asc_depart_pct [ASC_ask_att_val DEPART_PCT $db_row \
"%d" 0 flag]
}
#------------------------------------------------------------------------
proc DBC_create_query { } {
#------------------------------------------------------------------------
global DEBUG
global dbc_query
global dbc_subqry1
global dbc_subqry2
global dbc_boolop
# set dbc_query "$dbc_subqry1 $dbc_boolop $dbc_subqry2"
ASC_create_query
}
#------------------------------------------------------------------------
proc DBC_execute_query { } {
#------------------------------------------------------------------------
global asc_database_count
ASC_execute_query
}
proc ASC_set_engage_retract_to_rapid { } {
if { $::dbc_engage_percent == 0 } \
{
set ::dbc_engage_percent "RAPID"
}
if { $::dbc_retract_percent == 0 } \
{
set ::dbc_retract_percent "RAPID"
}
}
#---------------------------------------------
proc DBC_retrieve {} {
#---------------------------------------------
global DEBUG
global dbc_event_error
global dbc_part_units
global dbc_cutmthd_libref
global dbc_part_material_libref
global dbc_tool_material_libref
global dbc_tool_diameter
global dbc_tool_length
global dbc_tool_holder_offset
global dbc_surface_speed
global dbc_feed_per_tooth
global dbc_depth_of_cut
global dbc_stepover
global dbc_approach_percent
global dbc_engage_percent
global dbc_first_cut_percent
global dbc_stepover_percent
global dbc_retract_percent
global dbc_return_percent
global dbc_departure_percent
global fPointer
global dbFileName
global asc_database_count
global asc_database
global asc_file_name
global file_unit
global asc_units
global asc_next_line
global dbc_libref
global dbc_support_exact_match
# These hold data for finding nearest L/D ratio
set index 0
set low_record_indx -1
set low_ratio_delta 99999
set low_ratio 99999
set high_record_indx -1
set high_ratio_delta 99999
set high_ratio 99999
# These hold data for records which match diameter only
set low_len_rec_indx -1
set low_len_delta 99999
set low_len_ratio 99999
set high_len_rec_indx -1
set high_len_delta 99999
set high_len_ratio 99999
# These hold data for records which are near the input tool in diameter and length
set near_low_rec_indx -1
set near_low_delta 99999
set near_low_ratio 99999
set near_high_rec_indx -1
set near_high_delta 99999
set near_high_ratio 99999
# These hold data for records which match diameter only
set low_len_rec_indx -1
set low_len_delta 99999
set low_len_ratio 99999
set high_len_rec_indx -1
set high_len_delta 99999
set high_len_ratio 99999
# These hold data for records which nearly match diameter only
set near_diam_low_rec_indx -1
set near_diam_low_ratio_delta 99999
set near_diam_low_ratio 99999
set near_diam_high_rec_indx -1
set near_diam_high_ratio_delta 99999
set near_diam_high_ratio 99999
# These hold data for records which match length only
set low_diam_rec_indx -1
set low_diam_delta 99999
set low_diam_ratio 99999
set high_diam_rec_indx -1
set high_diam_delta 99999
set high_diam_ratio 99999
# These hold data for records which nearly match length only
set near_length_low_rec_indx -1
set near_length_low_ratio_delta 99999
set near_length_low_ratio 99999
set near_length_high_rec_indx -1
set near_length_high_ratio_delta 99999
set near_length_high_ratio 99999
# tracking exact match on diameter
set diameter_match_rec_index -1
set diameter_match_count 0
# Nearness band for input tool diameter and length
set nearness 0.10
set initialize_flag 1
set asc_data_file_name $asc_file_name
set asc_next_line ""
if { $dbc_part_units == "english" } \
{
set file_unit $asc_units(inch)
} else \
{
set file_unit $asc_units(mm)
}
## Changed function to improve performance
# set ret_code [catch {open $asc_data_file_name "r"} fp]
# if { $ret_code } \
# {
# return 1
# }
# ASC_init_database
set dbc_tool_length [ASC_get_tool_projection_length]
# compute the D4/L3 ratio for the input tool
if { $dbc_tool_diameter > 0 } \
{
set input_ratio [expr pow($dbc_tool_length,3) / pow($dbc_tool_diameter,4)]
# set input_ratio [expr pow($dbc_tool_diameter,4) / pow($dbc_tool_length,3)]
} else \
{
set input_ratio 0
}
# compute nearness band around input tool diameter and length
set high_diam [expr (1 + $nearness) * $dbc_tool_diameter]
set low_diam [expr (1 - $nearness) * $dbc_tool_diameter]
set high_length [expr (1 + $nearness) * $dbc_tool_length]
set low_length [expr (1 - $nearness) * $dbc_tool_length]
#
# Loop over all the DATA records
#
# The db_row variable has to be initialized (see also ASC_translate_att_alias)
set db_row 0
while { $db_row < $asc_database_count } \
{
set ascii_cutmethd_libref [ ASC_ask_att_val OPERTYPE \
$db_row "" 0 flag]
set ascii_part_material_libref [ASC_ask_att_val PARTMAT $db_row \
"" 0 flag]
set ascii_tool_material_libref [ASC_ask_att_val TOOLMAT $db_row \
"" 0 flag]
# See if row matches primary selection criteria
if { $dbc_cutmthd_libref == $ascii_cutmethd_libref && \
$dbc_part_material_libref == $ascii_part_material_libref && \
$dbc_tool_material_libref == $ascii_tool_material_libref } \
{
# It does. Get tool size and check for match
ASC_get_tool_size db_row local_tool_diameter local_tool_length
if { $dbc_tool_diameter == $local_tool_diameter && \
$dbc_tool_length == $local_tool_length } \
{
# Got a matching record, get remaining data and return
ASC_get_machining_data db_row dbc_depth_of_cut dbc_stepover \
dbc_feed_per_tooth dbc_surface_speed
ASC_get_feedrate_percentages db_row dbc_approach_percent \
dbc_engage_percent dbc_first_cut_percent dbc_stepover_percent \
dbc_retract_percent dbc_return_percent dbc_departure_percent
ASC_set_engage_retract_to_rapid
return 0
} elseif { $dbc_support_exact_match == 0 } \
{
## Exact match not found check D4/L3 ratio for possible interpolation consideration
if {$local_tool_diameter > 0} \
{
set local_ratio [expr pow($local_tool_length,3) / pow($local_tool_diameter,4)]
} else \
{
set local_ratio 99999
}
ASC_check_ratio_closeness db_row input_ratio local_ratio \
low_record_indx low_ratio_delta low_ratio \
high_record_indx high_ratio_delta high_ratio
# Now start checking for special cases.
# First, record diameter and length within nearness band of input tool
if { $local_tool_diameter >= $low_diam && \
$local_tool_diameter <= $high_diam && \
$local_tool_length >= $low_length && \
$local_tool_length <= $high_length } \
{
ASC_check_ratio_closeness db_row input_ratio local_ratio \
near_low_rec_indx near_low_delta near_low_ratio \
near_high_rec_indx near_high_delta near_high_ratio
}
if { $dbc_tool_diameter == $local_tool_diameter } \
{
# Exactly matching diameters
ASC_check_closeness db_row dbc_tool_length local_tool_length \
local_ratio low_len_rec_indx low_len_delta low_len_ratio \
high_len_rec_indx high_len_delta high_len_ratio
set diameter_match_rec_index $db_row
incr diameter_match_count
}
if { $local_tool_diameter >= $low_diam && \
$local_tool_diameter <= $high_diam } \
{
# Diameter only within nearness band
ASC_check_ratio_closeness db_row input_ratio local_ratio \
near_diam_low_rec_indx near_diam_low_ratio_delta near_diam_low_ratio \
near_diam_high_rec_indx near_diam_high_ratio_delta near_diam_high_ratio
}
if { $dbc_tool_length == $local_tool_length } \
{
# Exactly matching lengths
ASC_check_closeness db_row dbc_tool_diameter local_tool_diameter \
local_ratio low_diam_rec_indx low_diam_delta low_diam_ratio \
high_diam_rec_indx high_diam_delta high_diam_ratio
}
if { $local_tool_length >= $low_length && \
$local_tool_length <= $high_length } \
{
# Length only within nearness band
ASC_check_ratio_closeness db_row input_ratio local_ratio \
near_length_low_rec_indx near_length_low_ratio_delta near_length_low_ratio \
near_length_high_rec_indx near_length_high_ratio_delta near_length_high_ratio
}
}
}
incr db_row
}
# If we get here, we did not find an exact match on tool diameter and length,
# so check alternatives
if { $dbc_support_exact_match == 0 } \
{
# first a single record with matching diameter
if { $diameter_match_rec_index > -1 && $diameter_match_count == 1 } \
{
ASC_get_machining_data diameter_match_rec_index dbc_depth_of_cut dbc_stepover \
dbc_feed_per_tooth dbc_surface_speed
ASC_get_feedrate_percentages diameter_match_rec_index dbc_approach_percent \
dbc_engage_percent dbc_first_cut_percent dbc_stepover_percent \
dbc_retract_percent dbc_return_percent dbc_departure_percent
ASC_set_engage_retract_to_rapid
# next records near in both diameter and length
} elseif { $near_low_rec_indx > -1 && $near_high_rec_indx > -1 } \
{
ASC_interpolate_data near_low_rec_indx near_low_ratio near_high_rec_indx \
near_high_ratio input_ratio
# Exact match found on diameter only
} elseif { $low_len_rec_indx > -1 && $high_len_rec_indx > -1} \
{
ASC_interpolate_data low_len_rec_indx low_len_ratio high_len_rec_indx \
high_len_ratio input_ratio
# Near records on diameter only
} elseif { $near_diam_low_rec_indx > -1 && $near_diam_high_rec_indx > -1} \
{
ASC_interpolate_data near_diam_low_rec_indx near_diam_low_ratio near_diam_high_rec_indx \
near_diam_high_ratio input_ratio
# Exact match found on length only
} elseif { $low_diam_rec_indx > -1 && $high_diam_rec_indx > -1} \
{
ASC_interpolate_data low_diam_rec_indx low_diam_ratio high_diam_rec_indx \
high_diam_ratio input_ratio
# Near records on length only
} elseif { $near_length_low_rec_indx > -1 && $near_length_high_rec_indx > -1} \
{
ASC_interpolate_data near_length_low_rec_indx near_length_low_ratio near_length_high_rec_indx \
near_length_high_ratio input_ratio
# Near ratios on both sides of input tool
} elseif { $low_record_indx > -1 && $high_record_indx > -1 } \
{
ASC_interpolate_data low_record_indx low_ratio high_record_indx \
high_ratio input_ratio
# have a match on the high end, use it
} elseif { $low_record_indx == -1 && $high_record_indx > -1} \
{
ASC_get_machining_data high_record_indx dbc_depth_of_cut dbc_stepover \
dbc_feed_per_tooth dbc_surface_speed
ASC_get_feedrate_percentages high_record_indx dbc_approach_percent \
dbc_engage_percent dbc_first_cut_percent dbc_stepover_percent \
dbc_retract_percent dbc_return_percent dbc_departure_percent
ASC_set_engage_retract_to_rapid
# have a match on the low end, use it
} elseif { $high_record_indx == -1 && $low_record_indx > -1} \
{
set near_libref [ASC_ask_att_val LIBRF $low_record_indx "%s" "" flag]
ASC_get_machining_data low_record_indx dbc_depth_of_cut dbc_stepover \
dbc_feed_per_tooth dbc_surface_speed
ASC_get_feedrate_percentages low_record_indx dbc_approach_percent \
dbc_engage_percent dbc_first_cut_percent dbc_stepover_percent \
dbc_retract_percent dbc_return_percent dbc_departure_percent
ASC_set_engage_retract_to_rapid
# no matches found at all -- return error message
} else \
{
set dbc_event_error "No appropriate machining data found"
}
} else \
{
set dbc_event_error "No appropriate machining data found"
}
}
#------------------------------------------------------------------------
proc DBC_write { } {
#------------------------------------------------------------------------
global asc_database_name
set asc_database_name "machining_data.dat"
ASC_write
}
#------------------------------------------------------------------------
proc ASC_output_header { fileid } {
#------------------------------------------------------------------------
global dbc_attr_count
global dbc_attr_aliases
global dbc_attr_id
global dbc_logname
set daytime [clock seconds]
set out_daytime [clock format $daytime -format "%a %b %d %Y %I:%M %p"]
set headerMessage "# MACHINING_DATA.DAT
##########################################################################
#
# PURPOSE:
#
# This is the database file used for defining Machining Data in
# an operation.
#
#
# REVISED:
# $dbc_logname $out_daytime
#
##########################################################################
# The data is organized in the format separated by |
# The fields in the database are in the following order:
#
# LIBRF - Unique record identifier
# (Library Reference)
# OPERTYPE - cutmthd_libref Cut Method Library Reference
# PARTMAT - part_material_libref Part Part Material Library Reference
# TOOLMAT - tool_material_libref Tool Material Library Reference
# DIAM_IN - cutter diameter - inch
# DIAM_MM - cutter diameter - mm
# LENGTH_IN - cutter length - inch
# LENGTH_MM - cutter length - mm
# DPT_CUT_IN - dpth_of_cut Depth_of_cut(inch)
# DPT_CUT_MM - dpth_of_cut Depth_of_cut(mm)
# STEPOVER_IN - stepover distance (inch)
# STEPOVER_MM - stepover distance (mm)
# SURF_SPEED_FPM - surface_speed Suface Speed(FPM)
# SURF_SPEED_MPM - surface_speed Suface Speed(MPM)
# FEED_IPT - feed_per_tooth Feed per Tooth(IPT)
# FEED_MMPT - feed_per_tooth Feed per Tooth(MMPT)
# APPROACH_PCT - approach feedrate percentage of cut feedrate
# ENGAGE_PCT - engage feedrate percentage of cut feedrate
# FRSTCUT_PCT - first cut feedrate percentage of cut feedrate
# STEPOVER_PCT - stepover feedrate percentage of cut feedrate
# RETRACT_PCT - retract feedrate percentage of cut feedrate
# RETURN_PCT - return feedrate percentage of cut feedrate
# DEPART_PCT - departure feedrate percentage of cut feedrate
#--------------------------------------------------------------------------------"
puts $fileid "$headerMessage"
# load the database structure
DBC_load_rset_data
# output FORMAT line
set format_line "FORMAT"
for {set i 0} {$i < $dbc_attr_count} {incr i} \
{
DBC_ask_attr_id $dbc_attr_aliases($i)
set format_line "$format_line $dbc_attr_id"
}
puts $fileid $format_line
puts $fileid "#--------------------------------------------------------------------------------"
}
proc ASC_check_closeness { DB_ROW BASE_VALUE TEST_VALUE TEST_RATIO LOW_REC_INDX LOW_REC_DELTA \
LOW_REC_RATIO HIGH_REC_INDX HIGH_REC_DELTA HIGH_REC_RATIO } {
upvar $DB_ROW db_row
upvar $BASE_VALUE base_value
upvar $TEST_VALUE test_value
upvar $TEST_RATIO test_ratio
upvar $LOW_REC_INDX low_record_indx
upvar $LOW_REC_RATIO low_ratio
upvar $LOW_REC_DELTA low_delta
upvar $HIGH_REC_DELTA high_delta
upvar $HIGH_REC_INDX high_record_indx
upvar $HIGH_REC_RATIO high_ratio
if { $base_value > $test_value } \
{
set test_delta [expr ($base_value - $test_value)]
if { $test_delta < $low_delta } \
{
set low_delta $test_delta
set low_record_indx $db_row
set low_ratio $test_ratio
}
} elseif { $base_value < $test_value } \
{
set test_delta [expr ($test_value - $base_value)]
if { $test_delta < $high_delta } \
{
set high_delta $test_delta
set high_record_indx $db_row
set high_ratio $test_ratio
}
}
}
proc ASC_check_ratio_closeness { DB_ROW BASE_VALUE TEST_VALUE LOW_REC_INDX LOW_REC_DELTA \
LOW_REC_RATIO HIGH_REC_INDX HIGH_REC_DELTA HIGH_REC_RATIO } {
upvar $DB_ROW db_row
upvar $BASE_VALUE base_value
upvar $TEST_VALUE test_value
upvar $LOW_REC_INDX low_record_indx
upvar $LOW_REC_RATIO low_ratio
upvar $LOW_REC_DELTA low_delta
upvar $HIGH_REC_DELTA high_delta
upvar $HIGH_REC_INDX high_record_indx
upvar $HIGH_REC_RATIO high_ratio
if { $base_value > $test_value } \
{
set test_delta [expr ($base_value - $test_value)]
if { $test_delta < $low_delta } \
{
set low_delta $test_delta
set low_record_indx $db_row
set low_ratio $test_value
}
} elseif { $base_value < $test_value } \
{
set test_delta [expr ($test_value - $base_value)]
if { $test_delta < $high_delta } \
{
set high_delta $test_delta
set high_record_indx $db_row
set high_ratio $test_value
}
}
}
proc ASC_interpolate_data { LOW_REC_INDX LOW_RATIO HIGH_REC_INDX HIGH_RATIO INPUT_RATIO } {
upvar $LOW_REC_INDX low_record_indx
upvar $LOW_RATIO low_ratio
upvar $HIGH_REC_INDX high_record_indx
upvar $HIGH_RATIO high_ratio
upvar $INPUT_RATIO input_ratio
global dbc_surface_speed
global dbc_feed_per_tooth
global dbc_depth_of_cut
global dbc_stepover
global dbc_approach_percent
global dbc_engage_percent
global dbc_first_cut_percent
global dbc_stepover_percent
global dbc_retract_percent
global dbc_return_percent
global dbc_departure_percent
ASC_get_machining_data low_record_indx low_depth_of_cut low_stepover \
low_feed_per_tooth low_surface_speed
ASC_get_feedrate_percentages low_record_indx low_approach_percent \
low_engage_percent low_first_cut_percent low_stepover_percent \
low_retract_percent low_return_percent low_departure_percent
ASC_get_machining_data high_record_indx high_depth_of_cut high_stepover \
high_feed_per_tooth high_surface_speed
ASC_get_feedrate_percentages high_record_indx high_approach_percent \
high_engage_percent high_first_cut_percent high_stepover_percent \
high_retract_percent high_return_percent high_departure_percent
set step [expr ($input_ratio - $low_ratio) / ($high_ratio - $low_ratio)]
set dbc_depth_of_cut [expr $low_depth_of_cut + $step * ($high_depth_of_cut - $low_depth_of_cut)]
set dbc_stepover [expr $low_stepover+ $step * ($high_stepover - $low_stepover)]
set dbc_feed_per_tooth [expr $low_feed_per_tooth + $step * ($high_feed_per_tooth - $low_feed_per_tooth)]
set dbc_surface_speed [expr $low_surface_speed + $step * ($high_surface_speed - $low_surface_speed)]
set dbc_approach_percent [expr int ([expr $low_approach_percent + \
$step * ($high_approach_percent - $low_approach_percent)])]
set dbc_engage_percent [expr int ([expr $low_engage_percent + \
$step * ($high_engage_percent - $low_engage_percent)])]
set dbc_first_cut_percent [expr int ([expr $low_first_cut_percent + \
$step * ($high_first_cut_percent - $low_first_cut_percent)])]
set dbc_stepover_percent [expr int ([expr $low_stepover_percent + \
$step * ($high_stepover_percent - $low_stepover_percent)])]
set dbc_retract_percent [expr int ([expr $low_retract_percent + \
$step * ($high_retract_percent - $low_retract_percent)])]
set dbc_return_percent [expr int ([expr $low_return_percent + \
$step * ($high_return_percent - $low_return_percent)])]
set dbc_departure_percent [expr int ([expr $low_departure_percent + \
$step * ($high_departure_percent - $low_departure_percent)])]
ASC_set_engage_retract_to_rapid
}
proc ASC_get_tool_projection_length {} {
global dbc_tool_length
global dbc_tool_diameter
global dbc_tool_holder_offset
global dbc_tool_tapered_shank_length
global dbc_tool_tapered_shank_diameter
# In general the projected tool length is calculated from the tip of the tool to the first holder segment
# Except when shank diameter is greater than tool diameter, the projected tool length is from the tool tip to the start of the shank
if {[info exists dbc_tool_tapered_shank_length] && $dbc_tool_tapered_shank_length > 0.0} {
if {$dbc_tool_tapered_shank_diameter > $dbc_tool_diameter} {
return $dbc_tool_length
} else {
if {[info exists dbc_tool_holder_offset]} {
return [expr $dbc_tool_length + $dbc_tool_tapered_shank_length - $dbc_tool_holder_offset]
} else {
return [expr $dbc_tool_length + $dbc_tool_tapered_shank_length]
}
}
} elseif {[info exists dbc_tool_holder_offset]} {
return [expr $dbc_tool_length - $dbc_tool_holder_offset]
} else {
return $dbc_tool_length
}
}
# To enable the new customization mechanism.
# This should ALWAYS be the last line in the file.
MOM_extend_for_customization UGII_CAM_CUSTOM_LIBRARY_FEEDS_SPEEDS_ASCII_DIR dbc_custom_ascii_machining_data.tcl

View File

@@ -0,0 +1,57 @@
# PART_MATERIALS.DAT
##########################################################################
#
# PURPOSE:
#
# This is the database file used for defining Part Material.
#
# REVISIONS:
# Sl.No. Date Name Reason
# 01 06/15/99 Subhash Initial
# 02 07/31/99 Subhash Include Format statement
# 03 10/29/99 Murthy Changes to data and file description
# 04 29-jun-2004 Mark Rief Add P20 for HSM, reordered fields
# 05 11-Oct-2005 rlm Add more HSM data
# 06 18-Apr-2019 Reinier Capele Change text MAT0_00464 and MAT0_00153
##########################################################################
##########################################################################
##
## The following key words for Attribute ids are defined
##
## LIBREF partmaterial_libref - Unique record identifier
## (Library Reference)
## MATCODE material_code - Material Code
## MATNAME material_name - Material Name (appears on the label)
## HARDNESS material_hardness - Material Hardness
## PARTMAT material_description - Material Description
#########################################################################
#-----------------+--------------------------------------------+----------------
FORMAT LIBRF MATCODE MATNAME HARDNESS PARTMAT
#--------------------------------------------------------------------------------
#DATA|MAT0_00001|1116|CARBON STEEL|100-150|FREE MACHINING CARBON STEELS,WROUGHT- Low Carbon Resulfurized
#DATA|MAT0_00002|1116|CARBON STEEL|150-200|FREE MACHINING CARBON STEELS,WROUGHT - Low Carbon Resulfurized
#DATA|MAT0_00059|4140SE|ALLOY STEEL|200-250|FREE MACHINING ALLOY STEELS, WROUGHT - Medium Carbon Resulfurized
#DATA|MAT0_00103|4140|ALLOY STEEL|54-56|ALLOY STEELS,WROUGHT - Medium Carbon
#DATA|MAT0_00104|4150|ALLOY STEEL|175-225|ALLOY STEELS, WROUGHT - Medium Carbon
#DATA|MAT0_00105|4150|ALLOY STEEL|225-275|ALLOY STEELS, WROUGHT - Medium Carbon
#DATA|MAT0_00106|4150|ALLOY STEEL|275-325|ALLOY STEELS, WROUGHT - Medium Carbon
#DATA|MAT0_00108|4150|ALLOY STEEL|375-425|ALLOY STEELS, WROUGHT - Medium Carbon
DATA|MAT0_00153|440C|STAINLESS STEEL|225-275 HB|STAINLESS STEELS, WROUGHT - Martensitic with Catalogue Machining Data
#DATA|MAT0_00155|440A|STAINLESS STEEL|375-425 HB|STAINLESS STEELS, WROUGHT - Martensitic
#DATA|MAT0_00174|4340|HS STEEL|225-300|HIGH STRENGTH STEELS, WROUGHT -
#DATA|MAT0_00175|4340|HS STEEL|300-350|HIGH STRENGTH STEELS, WROUGHT -
#DATA|MAT0_00176|4340|HS STEEL|350-400|HIGH STRENGTH STEELS, WROUGHT -
#DATA|MAT0_00194|H13|TOOL STEEL|150-200 HB|TOOL STEELS, WROUGHT - Hot Work
#DATA|MAT0_00266|7050|ALUMINUM|75-150 HB|ALUMINUM ALLOYS, WROUGHT -
#DATA|MAT0_00281|210|COPPER|10-70 HRB|COPPER ALLOYS
#DATA|MAT0_00464|P20|P20 TOOL STEEL|28-37 HRc|Mold Steel with Catalogue Machining Data
DATA|MAT0_00600|P20|HSM P20 Prehardened|30-33 HRc|HSM With Proven Machining Data
DATA|MAT0_00700|M416|HSM M416 Prehardened|40-44 HRc|HSM With Proven Machining Data
DATA|MAT0_01100|H13|HSM H13 Prehardened|50-54 HRc|HSM with Proven Machining Data
#DATA|MAT0_01200|A2 Calmax|HSM A2 Calmax|58 HRc|HSM With Proven Machining Data
#DATA|MAT0_01300|D2|HSM D2|58-61 HRc|HSM With Proven Machining Data
DATA|MAT0_02100|7079|HSM Aluminum 7079 High tensile||HSM With Proven Machining Data
DATA|MAT0_02200|Copper|HSM Copper||HSM With Proven Machining Data

View File

@@ -0,0 +1,84 @@
##########################################################################
#
# PURPOSE:
#
# This is the database file used for defining "Cut Method" in
# Machining method.
#
# REVISIONS:
#
# 00 23Mar99 Murthy R Mandaleeka Initial Version
# 01 26JUL99 Subhash Changed order of attributes
# presented
# 02 29OCT99 Murthy Changed RSET names
##########################################################################
DB_PREFIX "DB("
DB_SUFFIX ")"
ESS_PREFIX "ESS("
ESS_SUFFIX ")"
#############################################################################
# The list of DB_ALIAS
#
# DB_ALIAS <alias>
# {
# DB_ID < identifier of the cutter parameter in a UG part file >
# DB_ID_TYPE < Type of the identifier >
# d _ double
# i _ integer
# s _ string
# }
#
##############################################################################
DB_ALIAS matcode
{
DB_ID MATCODE
DB_ID_TYPE s
DIALOG_NAME "matcode"
RSET_NAME "Code"
}
DB_ALIAS matname
{
DB_ID MATNAME
DB_ID_TYPE s
DIALOG_NAME "matname"
RSET_NAME "Name"
}
DB_ALIAS partmat
{
DB_ID PARTMAT
DB_ID_TYPE s
DIALOG_NAME "partmat"
RSET_NAME "Description"
}
DB_ALIAS hardness
{
DB_ID HARDNESS
DB_ID_TYPE s
DIALOG_NAME "hardness"
RSET_NAME "Hardness"
}
DB_ALIAS libref
{
DB_ID LIBRF
DB_ID_TYPE s
DIALOG_NAME "libref"
RSET_NAME "Library Reference"
}
LIBREF libref
CLASS PART_MATERIAL
{
TYPE PART_MATERIAL
QUERY "[1] == [1]"
DIALOG libref matcode matname hardness partmat
RSET libref matcode matname hardness partmat
UI_NAME "Part Material"
}

View File

@@ -0,0 +1,473 @@
##############################################################################
# REVISIONS
# Date Who Reason
# 03/24/99 mrm Initial
# 05/19/99 mrm New Environment Variable
# 07/21/99 Subhash Included dbc_general_ascii.tcl file
# 07/21/99 Subhash Used general functions for
# opening and reading dat files.
# 08/06/99 Subhash Changed some functions to improve performance
# 11/11/2003 rlm Add ASC_output_header
# 01/30/2004 rlm Move ASC_write to dbc_ascii_general
# 02/12/2004 rlm Add library revision information
# 07/01/2004 rlm 1339644 Add proc DBC_ask_library_values
# 12/06/2004 rlm 1369488 Add proc DBC_execute_query_for_count
# 08/25/2005 rlm 5302379 Add proc DBC_translate_att_alias
##############################################################################
#
# The format of each line in the text file is:
#
# libref Type Manufacturer Designation Control config_file
#
# partmat is a string
# matcode is a string
# matname is a string
# description is a string
# hardness is a string
# libref is a string
#
# The DB_ID of a DB_ALIAS is its field number in the line (0-based)
###############################################################################
#---------------------------------------------
# Non DBC Global Variables
#---------------------------------------------
#MOM_set_debug_mode ON
#set dbFileName "[MOM_ask_env_var UGII_CAM_LIBRARY_FEEDS_SPEEDS_DATA_DIR]part_materials.dat"
set DEBUG 0
set fPointer ""
#---------------------------------------------
# Global variables set by DBC for Input/Output
#---------------------------------------------
set dbc_lhs_exp ""
set dbc_rhs_exp ""
set dbc_relop ""
set dbc_query ""
set dbc_subqry1 ""
set dbc_subqry2 ""
set dbc_boolop ""
set dbc_class_name ""
set dbc_attr_count 0
set dbc_attr_id ""
set dbc_query_count 0
set dbc_libref ""
set dbc_var_list ""
set asc_debug 0
#---------------------------------------------
proc ASC_t_create_filename {env_var_name filename} \
{
#
# Creates a complete filename by evaluating an environment variable
# for the directory information
#
set env_var [MOM_ask_env_var $env_var_name]
if { $env_var == "" } \
{
set message "Can't read environment variable $env_var_name"
MOM_abort "\n $message"
}
set fname ""
set fname [append fname $env_var $filename]
return $fname
}
#---------------------------------------------
proc MOM__boot {} {
#---------------------------------------------
# source some general procedures
#
# dbc_ascii_general.tcl
#
set filename \
[ASC_t_create_filename "UGII_UG_LIBRARY_DIR" "dbc_ascii_general.tcl"]
if { [catch {source $filename}] == "1" } \
{
set message "Can't load .tcl file: $filename"
MOM_abort "\n $message"
}
}
proc MOM__halt {} \
{
}
#------------------------------------------------------------
proc DBC_init_db { } \
{
global DEBUG
global dataBase
global lastRowNumber
global dbFileName
global fPointer
set asc_file_name ""
set asc_part_units ""
set data_unit 0
set mode 0
set env_var UGII_CAM_LIBRARY_FEEDS_SPEEDS_DATA_DIR
set data_file_name [ASC_t_create_filename "$env_var" "part_materials.dat"]
#
# Set the filename for ASCII Data File
#
ASC_set_data_file_name
#
# And load the file into memory
#
ASC_load_data_file $data_file_name $data_unit $mode
}
#---------------------------------------------
proc ASC_set_data_file_name {} {
#---------------------------------------------
global dbc_part_units
global asc_file_name
global asc_part_units
MOM_ask_part_units ;# writes to dbc_part_units
set env_var UGII_CAM_LIBRARY_FEEDS_SPEEDS_DATA_DIR
set asc_file_name [ASC_t_create_filename "$env_var" "part_materials.dat"]
set asc_part_units $dbc_part_units
}
#---------------------------------------------
proc ExtractExpression {DBC_EXP} {
#---------------------------------------------
upvar $DBC_EXP dbc_exp
global dbc_db_prefix
global dbc_db_suffix
global dbc_ess_prefix
global dbc_ess_suffix
DBC_ask_db_ess_prefix_suffix
#Removing DB Prefix and Suffix
set pref_flag 0
RemovePrefixSuffix dbc_exp dbc_db_prefix dbc_db_suffix pref_flag
#Removing ESS Prefix and Suffix
set pref_flag 1
RemovePrefixSuffix dbc_exp dbc_ess_prefix dbc_ess_suffix pref_flag
}
#---------------------------------------------
proc RemovePrefixSuffix {DBC_EXP PREFIX SUFFIX PREF_FLAG} {
#---------------------------------------------
upvar $DBC_EXP dbc_exp
upvar $PREFIX prefix
upvar $SUFFIX suffix
upvar $PREF_FLAG pref_flag
set pref_len [string length $prefix]
set ind 0
set prefix_test [string first $prefix $dbc_exp]
while {$prefix_test != -1}\
{
if {$prefix_test > 0}\
{
append temp_var [string range $dbc_exp 0 [expr $prefix_test - 1]]
set dbc_exp [string range $dbc_exp $prefix_test end]
set prefix_test [string first $prefix $dbc_exp]
}
set end_val [string first $suffix $dbc_exp]
set strt_len [expr $prefix_test + $pref_len]
set end_len $end_val
if {$pref_flag}\
{
append temp_var [string range $dbc_exp $strt_len [expr $end_len - 1]]
set dbc_exp [string range $dbc_exp [expr $end_val + 1] end]
} else\
{
append temp_var [string range $dbc_exp $strt_len $end_len]
set dbc_exp [string range $dbc_exp [expr $end_val + 2] end]
}
set prefix_test [string first $prefix $dbc_exp]
if {$prefix_test != -1}\
{
append temp_var [string range $dbc_exp 0 [expr $prefix_test - 1]]
set dbc_exp [string range $dbc_exp $prefix_test end]
set prefix_test [string first $prefix $dbc_exp]
} else\
{
if {[string length $dbc_exp] > 0}\
{
append temp_var $dbc_exp
}
}
}
if {[info exists temp_var]}\
{
set dbc_exp $temp_var
unset temp_var
}
}
#------------------------------------------------------------
proc DBC_translate_att_alias { } {
#------------------------------------------------------------
ASC_translate_att_alias
}
#------------------------------------------------------------
proc DBC_create_criterion { } {
#------------------------------------------------------------
global DEBUG
global dbc_lhs_exp
global dbc_rhs_exp
global dbc_relop
global dbc_query
if { "$DEBUG" == "1" } {
}
# set dbc_query "\[$dbc_lhs_exp\] $dbc_relop \[$dbc_rhs_exp\]"
ASC_create_criterion
}
#------------------------------------------------------------------------
proc DBC_create_query { } {
#------------------------------------------------------------------------
global DEBUG
global dbc_query
global dbc_subqry1
global dbc_subqry2
global dbc_boolop
# set dbc_query "$dbc_subqry1 $dbc_boolop $dbc_subqry2"
ASC_create_query
}
#------------------------------------------------------------------------
proc DBC_execute_query { } {
#------------------------------------------------------------------------
global asc_database_count
ASC_execute_query
}
#------------------------------------------------------------------------
proc DBC_execute_query_for_count { } {
#------------------------------------------------------------------------
global asc_database_count
ASC_execute_query_for_count
}
#---------------------------------------------------------------------
proc DBC_retrieve { } {
#---------------------------------------------------------------------
global DEBUG
global dbc_libref
global dbc_retrieve_var_list
global dataBase
global dbc_material_code
global dbc_material_name
global dbc_material_description
global dbc_material_hardness
global fPointer
global asc_debug
global asc_database_count
global asc_file_name
if { $asc_debug == "1" } \
{
puts " =========================================="
puts " procedure DBC_retrieve for cut methods"
puts " libref -> $dbc_libref"
}
#
# Look for the desired libref
#
for {set db_row 0} {$db_row < $asc_database_count} {incr db_row 1} \
{
# Find the row for the desired LibRef
set partmaterial_libref [ASC_ask_att_val LIBRF $db_row \
"" 0 flag]
if { $dbc_libref == $partmaterial_libref } \
{
break
}
}
if { $db_row >= $asc_database_count } \
{
set message "Error retrieving Part material from external library."
set message "$message \n Cut Method with the library reference $dbc_libref"
set message "$message \n does not exist in the"
set message "$message \n ASCII Data File: $asc_file_name"
MOM_abort "\n $message"
}
#
# Get the part material code
#
set dbc_material_code [ASC_ask_att_val MATCODE $db_row "%s" "" flag]
#
# Get the Part Material Name
#
set dbc_material_name [ASC_ask_att_val MATNAME $db_row "%s" "" flag]
#
# Get Part material Description
#
set dbc_material_description [ASC_ask_att_val PARTMAT $db_row "%s" "" flag]
#
# Get Part Material Hardness
#
set dbc_material_hardness [ASC_ask_att_val HARDNESS $db_row "%s" "" flag]
}
#------------------------------------------------------------------------
proc DBC_write { } {
#------------------------------------------------------------------------
global asc_database_name
set asc_database_name "part_materials.dat"
ASC_write
}
#---------------------------------------------------------------------
proc ASC_output_header { fileid } {
#---------------------------------------------------------------------
global dbc_attr_count
global dbc_attr_aliases
global dbc_attr_id
global dbc_logname
set daytime [clock seconds]
set out_daytime [clock format $daytime -format "%a %b %d %Y %I:%M %p"]
set headerMessage "# PART_MATERIALS.DAT
##########################################################################
#
# PURPOSE:
#
# This is the database file used for defining Part Material.
#
# REVISED:
# $dbc_logname $out_daytime
#
##########################################################################
##########################################################################
##
## The following key words for Attribute ids are defined
##
## MATCODE material_code - Material Code
## MATNAME material_name - Material Name (appears on the label)
## PARTMAT material_description - Material Description
## HARDNESS material_hardness - Material Hardness
## LIBREF partmaterial_libref - Unique record identifier
## (Library Reference)
#########################################################################
#-----------------+--------------------------------------------+----------------"
puts $fileid "$headerMessage"
# load the database structure
DBC_load_rset_data
# output FORMAT line
set format_line "FORMAT"
for {set i 0} {$i < $dbc_attr_count} {incr i} \
{
DBC_ask_attr_id $dbc_attr_aliases($i)
set format_line "$format_line $dbc_attr_id"
}
puts $fileid $format_line
puts $fileid "#--------------------------------------------------------------------------------"
}
proc DBC_ask_library_values {} \
{
#
# global input
global dbc_libref
global dbc_db_ids_count
global dbc_db_ids
global dbc_event_error
global asc_database_count
#
# global output
global dbc_return_status
global dbc_db_ids_value
# Do not change this string
set NO_MATCH "No matching record found for $dbc_libref"
set dbc_return_status 0
#
# Look for the desired libref
#
for {set db_row 0} {$db_row < $asc_database_count} {incr db_row 1} \
{
set partmaterial_libref [ASC_ask_att_val LIBRF $db_row \
"" 0 flag]
if { $dbc_libref == $partmaterial_libref } \
{
break
}
}
#
# and set the desired values
#
if { $db_row < $asc_database_count } \
{
for { set inx 0 } { $inx < $dbc_db_ids_count } { incr inx } \
{
set dbc_db_ids_value($dbc_db_ids($inx)) \
[ASC_ask_att_val $dbc_db_ids($inx) $db_row "" "" flag]
}
} else \
{
set dbc_event_error $NO_MATCH
set dbc_return_status 1
}
}

View File

@@ -0,0 +1,32 @@
# PROCESS_FORCE_PARAMETERS.DAT
##########################################################################
#
# PURPOSE:
#
# This is the database file used for defining Process Force Data in
# an operation.
#
#
# REVISIONS:
# Date Name Reason
# 11-Sep-2019 Gopal Srinath Initial Version
#
##########################################################################
# The data is organized in the format separated by |
# The fields in the database are in the following order:
#
# LIBRF - Unique record identifier(Library Reference)
# PARTMAT - part_material_libref Part Part Material Library Reference
# TOOLMAT - tool_material_libref Tool Material Library Reference
# TEC - Tangential Edge Coefficient
# TCC - Tangential Cutting Coefficient
# NEC - Normal Edge Coefficient
# NCC - Normal Cutting Coefficient
# DEC - Distal Edge Coefficient
# DCC - Distal Cutting Coefficient
# ECT - Exponent for chip thickness
#--------------------------------------------------------------------------------
FORMAT LIBRF PARTMAT TOOLMAT TEC TCC NEC NCC DEC DCC ECT
#--------------------------------------------------------------------------------
DATA|PFD_10001|MAT0_00600|TMC0_00007|57.500541|-76.483117|-672.188980|4.626404|-11.790115|-10.980619|0.0
DATA|PFD_10002|MAT0_00700|TMC0_00007|75.500541|-46.483117|-762.188980|8.626404|-22.790115|-5.980619|0.0

View File

@@ -0,0 +1,117 @@
# *PROCESS_FORCE_PARAMETERS.DEF
###############################################################################
# Definitions File for Machining Data Database implemented in an ASCII text file
###############################################################################
# REVISIONS:
#
# 11-Sep-2019 Gopal Srinath Initial Version
##########################################################################
DB_PREFIX "db("
DB_SUFFIX ")"
ESS_PREFIX "ess("
ESS_SUFFIX ")"
################################################################################
# The list of DB_ALIAS
#
# DB_ALIAS <alias>
# {
# DB_ID < identifier of parameter in a UG part file >
# DB_ID_TYPE < Type of the identifier >
# d _ double
# i _ integer
# s _ string
# }
#
###############################################################################
DB_ALIAS libref
{
DB_ID LIBRF
DB_ID_TYPE s
DIALOG_NAME "Force Key"
}
DB_ALIAS ptmtl
{
DB_ID PARTMAT
DB_ID_TYPE s
DIALOG_NAME "Part Material"
RSET_NAME "Part Material"
}
DB_ALIAS tlmtl
{
DB_ID TOOLMAT
DB_ID_TYPE s
DIALOG_NAME "Tool Material"
RSET_NAME "Tool Material"
}
DB_ALIAS tec
{
DB_ID TEC
DB_ID_TYPE d
DIALOG_NAME "Tangential Edge Coefficient"
RSET_NAME "Tangential Edge Coefficient"
}
DB_ALIAS tcc
{
DB_ID TCC
DB_ID_TYPE d
DIALOG_NAME "Tangential Cutting Coefficient"
RSET_NAME "Tangential Cutting Coefficient"
}
DB_ALIAS nec
{
DB_ID NEC
DB_ID_TYPE d
DIALOG_NAME "Normal Edge Coefficient"
RSET_NAME "Normal Edge Coefficient"
}
DB_ALIAS ncc
{
DB_ID NCC
DB_ID_TYPE d
DIALOG_NAME "Normal Cutting Coefficient"
RSET_NAME "Normal Cutting Coefficient"
}
DB_ALIAS dec
{
DB_ID DEC
DB_ID_TYPE d
DIALOG_NAME "Distal Edge Coefficient"
RSET_NAME "Distal Edge Coefficient"
}
DB_ALIAS dcc
{
DB_ID DCC
DB_ID_TYPE d
DIALOG_NAME "Distal Cutting Coefficient"
RSET_NAME "Distal Cutting Coefficient"
}
DB_ALIAS ect
{
DB_ID ECT
DB_ID_TYPE d
DIALOG_NAME "Exponent for chip thickness"
RSET_NAME "Exponent for chip thickness"
}
LIBREF libref
CLASS FORCE_SETTINGS
{
TYPE FORCE_SETTINGS
QUERY "[1] == [1]"
DIALOG libref ptmtl tlmtl tec tcc nec ncc dec dcc ect
RSET libref ptmtl tlmtl tec tcc nec ncc dec dcc ect
UI_NAME "CAM Force Data Library"
}

View File

@@ -0,0 +1,204 @@
# PROCESS_FORCE_PARAMETERS.TCL
###############################################################################
# DBC Event Handler for database stored as ascii file
###############################################################################
# Revisions
# Date Who Reason
# 11-Sep-2019 Gopal Srinath Initial Version
################################################################################
#
# The format of each line in the text file is:
#
# libref ptmtl tlmtl
# libref is a string
# ptmtl is code number for now
# tlmtl is "HSS" "Carbide" "CBN"
#
# The DB_ID of a DB_ALIAS is its field number in the line (0-based)
###############################################################################
#MOM_set_debug_mode ON
#---------------------------------------------
# Non DBC Global Variables
#---------------------------------------------
#set dbFileName "[MOM_ask_env_var UGII_CAM_LIBRARY_FEEDS_SPEEDS_ASCII_DIR]process_force_parameters.dat" ; # The ASCII Database File
set DEBUG 1
set fPointer ""
#---------------------------------------------
# Global variables set by DBC for Input/Output
#---------------------------------------------
set dbc_lhs_exp ""
set dbc_rhs_exp ""
set dbc_relop ""
set dbc_query ""
set dbc_subqry1 ""
set dbc_subqry2 ""
set dbc_boolop ""
set dbc_class_name ""
set dbc_attr_count 0
set dbc_attr_id ""
set dbc_query_count 0
set dbc_libref ""
set dbc_var_list ""
set dbc_part_units "metric" ; # ( english : 0 , metric : 1)
set dbc_part_material_libref ""
set dbc_tool_material_libref ""
# Default double precision value format.
set double_precision_format "g"
set asc_debug 0
proc ASC_t_create_filename {env_var_name filename} \
{
#
# Creates a complete filename by evaluating an environment variable
# for the directory information
#
set env_var [MOM_ask_env_var $env_var_name]
if { $env_var == "" } \
{
set message "Can't read environment variable $env_var_name"
MOM_abort "\n $message"
}
set fname ""
set fname [append fname $env_var $filename]
return $fname
}
#---------------------------------------------
proc MOM__boot {} {
#---------------------------------------------
# source some general procedures
#
# dbc_ascii_general.tcl
#
set filename \
[ASC_t_create_filename "UGII_UG_LIBRARY_DIR" "dbc_ascii_general.tcl"]
if { [catch {source $filename}] == "1" } \
{
set message "Can't load .tcl file: $filename"
MOM_abort "\n $message"
}
}
proc MOM__halt {} \
{
}
#---------------------------------------------
proc DBC_init_db {} {
#---------------------------------------------
global DEBUG
global dataBase
global dbFileName
global fPointer
global asc_file_name
global asc_database_count
global dbc_dat_file_override
global dbc_dat_file_name
set asc_file_name ""
set asc_part_units ""
set data_unit 0
set mode 0
#
# Set the filename for ASCII Data File
#
if {[info exists dbc_dat_file_override] } \
{
if {$dbc_dat_file_override == 1} \
{
set asc_file_name $dbc_dat_file_name
} else \
{
ASC_set_data_file_name
}
} else \
{
ASC_set_data_file_name
}
# Changed to improve performance
# And load the file into memory
#
ASC_load_data_file $asc_file_name $data_unit $mode
}
#---------------------------------------------
proc ASC_set_data_file_name {} {
#---------------------------------------------
global dbc_part_units
global asc_file_name
global asc_part_units
MOM_ask_part_units ;# writes to dbc_part_units
set env_var UGII_CAM_LIBRARY_FEEDS_SPEEDS_ASCII_DIR
set asc_file_name [ASC_t_create_filename "$env_var" "process_force_parameters.dat"]
set asc_part_units $dbc_part_units
}
#---------------------------------------------
proc DBC_retrieve {} {
#---------------------------------------------
global DEBUG
global fPointer
global dbFileName
global asc_database_count
global asc_database
global asc_units
global asc_next_line
global dbc_libref
set initialize_flag 1
set asc_data_file_name $::asc_file_name
set asc_next_line ""
#
# Loop over all the DATA records
#
# The db_row variable has to be initialized (see also ASC_translate_att_alias)
set db_row 0
while { $db_row < $asc_database_count } \
{
set ascii_part_material_libref [ASC_ask_att_val PARTMAT $db_row "" 0 flag]
set ascii_tool_material_libref [ASC_ask_att_val TOOLMAT $db_row "" 0 flag]
set ::dbc_tec 0.0
set ::dbc_tcc 0.0
set ::dbc_nec 0.0
set ::dbc_ncc 0.0
set ::dbc_dec 0.0
set ::dbc_dcc 0.0
set ::dbc_ect 0.0
# See if row matches primary selection criteria
if { $::dbc_part_material_libref == $ascii_part_material_libref && \
$::dbc_tool_material_libref == $ascii_tool_material_libref } \
{
set ::dbc_tec [ASC_ask_att_val TEC $db_row "%$::double_precision_format" 0 flag]
set ::dbc_tcc [ASC_ask_att_val TCC $db_row "%$::double_precision_format" 0 flag]
set ::dbc_nec [ASC_ask_att_val NEC $db_row "%$::double_precision_format" 0 flag]
set ::dbc_ncc [ASC_ask_att_val NCC $db_row "%$::double_precision_format" 0 flag]
set ::dbc_dec [ASC_ask_att_val DEC $db_row "%$::double_precision_format" 0 flag]
set ::dbc_dcc [ASC_ask_att_val DCC $db_row "%$::double_precision_format" 0 flag]
set ::dbc_ect [ASC_ask_att_val ECT $db_row "%$::double_precision_format" 0 flag]
return 0
}
incr db_row
}
# If we got here then there is no match
set ::dbc_event_error "No appropriate machining data found"
}

View File

@@ -0,0 +1,33 @@
# The data is organized in the format separated by
# The fields in the database are in the following order:
#
# LIBRF - Unique record identifier
# (Desired Library Reference or empty cell and the system will determine a unique reference)
# OPERTYPE - cutmthd_libref Cut Method Library Reference
# PARTMAT - part_material_libref Part Material Library Reference
# TOOLMAT - tool_material_libref Tool Material Library Reference
# DIAM_IN - cutter diameter - inch
# DIAM_MM - cutter diameter - mm
# LENGTH_IN - cutter length - inch
# LENGTH_MM - cutter length - mm
# DPT_CUT_IN - dpth_of_cut Depth_of_cut(inch)
# DPT_CUT_MM - dpth_of_cut Depth_of_cut(mm)
# STEPOVER_IN - stepover distance (inch)
# STEPOVER_MM - stepover distance (mm)
# SURF_SPEED_FPM - surface_speed Suface Speed(FPM),,,,,,,,,,,,,,,,,,,,,,
# SURF_SPEED_MPM - surface_speed Suface Speed(MPM),,,,,,,,,,,,,,,,,,,,,,
# FEED_IPT - feed_per_tooth Feed per Tooth(IPT),,,,,,,,,,,,,,,,,,,,,,
# FEED_MMPT - feed_per_tooth Feed per Tooth(MMPT),,,,,,,,,,,,,,,,,,,,,,
# APPROACH_PCT - approach feedrate percentage of cut feedrate,,,,,,,,,,,,,,,,,,,,,,
# ENGAGE_PCT - engage feedrate percentage of cut feedrate,,,,,,,,,,,,,,,,,,,,,,
# FRSTCUT_PCT - first cut feedrate percentage of cut feedrate,,,,,,,,,,,,,,,,,,,,,,
# STEPOVER_PCT - stepover feedrate percentage of cut feedrate,,,,,,,,,,,,,,,,,,,,,,
# RETRACT_PCT - retract feedrate percentage of cut feedrate,,,,,,,,,,,,,,,,,,,,,,
# RETURN_PCT - return feedrate percentage of cut feedrate,,,,,,,,,,,,,,,,,,,,,,
# DEPART_PCT - departure feedrate percentage of cut feedrate,,,,,,,,,,,,,,,,,,,,,,
#--------------------------------------------------------------------------------,,,,,,,,,,,,,,,,,,,,,,
#LIBRF,OPERTYPE,PARTMAT,TOOLMAT,DIAM_IN,DIAM_MM,LENGTH_IN,LENGTH_MM,DPT_CUT_IN,DPT_CUT_MM,STEPOVER_IN,STEPOVER_MM,SURF_SPEED_FPM,SURF_SPEED_MPM,FEED_IPT,FEED_MMPT,APPROACH_PCT,ENGAGE_PCT,FRSTCUT_PCT,STEPOVER_PCT,RETRACT-PCT,RETRUN_PCT,DEPART_PCT
THSO_00285,OPD0_00002,MAT0_00001,TMC0_00001,0.5,0,3,0,0.01,0.25,0,0,240,72.96,0.003,0.0762,0,90,60,0,0,0,0
THSO_00286,OPD0_00002,MAT0_00001,TMC0_00001,0.25,0,2,0,0.05,1.25,0,0,160,48.64,0.005,0.127,0,90,60,0,0,0,0
THSO_00287,OPD0_00002,MAT0_00001,TMC0_00001,0.75,0,4,0,0.1,2.5,0,0,125,38,0.01,0.254,0,90,60,0,0,0,0
,OPD0_00002,MAT0_00001,TMC0_00001,0.125,0,1,0,0.1,2.5,0,0,125,38,0.01,0.254,0,90,60,0,0,0,0
1 # The data is organized in the format separated by
2 # The fields in the database are in the following order:
3 #
4 # LIBRF - Unique record identifier
5 # (Desired Library Reference or empty cell and the system will determine a unique reference)
6 # OPERTYPE - cutmthd_libref Cut Method Library Reference
7 # PARTMAT - part_material_libref Part Material Library Reference
8 # TOOLMAT - tool_material_libref Tool Material Library Reference
9 # DIAM_IN - cutter diameter - inch
10 # DIAM_MM - cutter diameter - mm
11 # LENGTH_IN - cutter length - inch
12 # LENGTH_MM - cutter length - mm
13 # DPT_CUT_IN - dpth_of_cut Depth_of_cut(inch)
14 # DPT_CUT_MM - dpth_of_cut Depth_of_cut(mm)
15 # STEPOVER_IN - stepover distance (inch)
16 # STEPOVER_MM - stepover distance (mm)
17 # SURF_SPEED_FPM - surface_speed Suface Speed(FPM)
18 # SURF_SPEED_MPM - surface_speed Suface Speed(MPM)
19 # FEED_IPT - feed_per_tooth Feed per Tooth(IPT)
20 # FEED_MMPT - feed_per_tooth Feed per Tooth(MMPT)
21 # APPROACH_PCT - approach feedrate percentage of cut feedrate
22 # ENGAGE_PCT - engage feedrate percentage of cut feedrate
23 # FRSTCUT_PCT - first cut feedrate percentage of cut feedrate
24 # STEPOVER_PCT - stepover feedrate percentage of cut feedrate
25 # RETRACT_PCT - retract feedrate percentage of cut feedrate
26 # RETURN_PCT - return feedrate percentage of cut feedrate
27 # DEPART_PCT - departure feedrate percentage of cut feedrate
28 #--------------------------------------------------------------------------------
29 #LIBRF OPERTYPE PARTMAT TOOLMAT DIAM_IN DIAM_MM LENGTH_IN LENGTH_MM DPT_CUT_IN DPT_CUT_MM STEPOVER_IN STEPOVER_MM SURF_SPEED_FPM SURF_SPEED_MPM FEED_IPT FEED_MMPT APPROACH_PCT ENGAGE_PCT FRSTCUT_PCT STEPOVER_PCT RETRACT-PCT RETRUN_PCT DEPART_PCT
30 THSO_00285 OPD0_00002 MAT0_00001 TMC0_00001 0.5 0 3 0 0.01 0.25 0 0 240 72.96 0.003 0.0762 0 90 60 0 0 0 0
31 THSO_00286 OPD0_00002 MAT0_00001 TMC0_00001 0.25 0 2 0 0.05 1.25 0 0 160 48.64 0.005 0.127 0 90 60 0 0 0 0
32 THSO_00287 OPD0_00002 MAT0_00001 TMC0_00001 0.75 0 4 0 0.1 2.5 0 0 125 38 0.01 0.254 0 90 60 0 0 0 0
33 OPD0_00002 MAT0_00001 TMC0_00001 0.125 0 1 0 0.1 2.5 0 0 125 38 0.01 0.254 0 90 60 0 0 0 0

View File

@@ -0,0 +1,52 @@
# TOOL_MACHINING_DATA.DAT
##########################################################################
#
# PURPOSE:
#
# This is the database file used for defining Machining Data in
# an operation based only on the selected tool.
#
# REVISED:
# M.Heisig Sun Feb 22 2026 02:11 PM
#
##########################################################################
# The data is organized in the following format separated by |
# The fields in the database are in the following order:
#
# LIBRF - library reference of cutter
# DPT_CUT_IN - dpth_of_cut Depth_of_cut(inch)
# DPT_CUT_MM - dpth_of_cut Depth_of_cut(mm)
# STEPOVER_IN - stepover distance (inch)
# STEPOVER_MM - stepover distance (mm)
# SURF_SPEED_FPM - surface_speed Suface Speed(FPM)
# SURF_SPEED_MPM - surface_speed Suface Speed(MPM)
# FEED_IPT - feed_per_tooth Feed per Tooth(IPT)
# FEED_MMPT - feed_per_tooth Feed per Tooth(MMPT)
# APPROACH_PCT - approach feedrate percentage of cut feedrate
# ENGAGE_PCT - engage feedrate percentage of cut feedrate
# FRSTCUT_PCT - first cut feedrate percentage of cut feedrate
# STEPOVER_PCT - stepover feedrate percentage of cut feedrate
# RETRACT_PCT - retract feedrate percentage of cut feedrate
# RETURN_PCT - return feedrate percentage of cut feedrate
# DEPART_PCT - departure feedrate percentage of cut feedrate
# NAME - unique record identifier
# DESCR - description
# PARTMAT - library reference of part material
# CUTMTD - library reference of cut method
# ENGAGE_SPEED_MPM - engage surface speeed Engage Suface Speed(MPM)
# ENGAGE_SPEED_FPM - engage surface speeed Engage Suface Speed(IPM)
# ENGAGE_FEED_MMPT - engage feed per tooth Engage Feed per Tooth(MPT)
# ENGAGE_FEED_IPT - engage feed per tooth Engage Feed per Tooth(IPT)
# ENGAGE_DIA_MM - engage diameter Engage Diameter (mm)
# ENGAGE_DIA_IN - engage diameter Engage Diameter (inch)
# ENGAGE_ANG - engage ramp angle
# PRESET - preset record
#--------------------------------------------------------------------------------
FORMAT LIBRF DPT_CUT_IN DPT_CUT_MM STEPOVER_IN STEPOVER_MM SURF_SPEED_FPM SURF_SPEED_MPM FEED_IPT FEED_MMPT APPROACH_PCT ENGAGE_PCT FRSTCUT_PCT STEPOVER_PCT RETRACT_PCT RETURN_PCT DEPART_PCT NAME DESCR PARTMAT CUTMTD ENGAGE_SPEED_MPM ENGAGE_SPEED_FPM ENGAGE_FEED_MMPT ENGAGE_FEED_IPT ENGAGE_DIA_MM ENGAGE_DIA_IN ENGAGE_ANG PRESET
#--------------------------------------------------------------------------------
DATA|SF_D12_Z4|0.118110|3.000000|0.236220|6.000000|8.267089|209.984050|0.002756|0.070000|0|90|60|0|100|0|0|TMD_00001||||0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0
DATA|NCA_D8_Z1_W142|0.000000|0.000000|0.000000|0.000000|2.519211|63.987960|0.000591|0.015000|0|90|60|0|100|0|0|TMD_00001||||0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0
DATA|B_D8.8_Z2_W140|0.000000|0.000000|0.000000|0.000000|3.622281|92.005940|0.003937|0.100000|0|90|60|0|100|0|0|TMD_00001||||0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0
DATA|TA_B_D8.8_Z2_W140|0.000000|0.000000|0.000000|0.000000|3.621737|91.992120|0.003937|0.100000|0|90|60|0|100|0|0|TMD_00001||||0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|1
DATA|TA_NCA_D8_Z1_W142|0.000000|0.000000|0.000000|0.000000|2.519211|63.987960|0.000591|0.015000|0|90|60|0|100|0|0|TMD_00001||||0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|1
DATA|TA_SF_D12_Z4|0.118110|3.000000|0.236220|6.000000|8.267089|209.984050|0.002756|0.070000|0|90|60|0|100|0|0|TMD_00001||||0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|1

View File

@@ -0,0 +1,52 @@
# TOOL_MACHINING_DATA.DAT
##########################################################################
#
# PURPOSE:
#
# This is the database file used for defining Machining Data in
# an operation based only on the selected tool.
#
# REVISED:
# M.Heisig Sun Feb 22 2026 02:11 PM
#
##########################################################################
# The data is organized in the following format separated by |
# The fields in the database are in the following order:
#
# LIBRF - library reference of cutter
# DPT_CUT_IN - dpth_of_cut Depth_of_cut(inch)
# DPT_CUT_MM - dpth_of_cut Depth_of_cut(mm)
# STEPOVER_IN - stepover distance (inch)
# STEPOVER_MM - stepover distance (mm)
# SURF_SPEED_FPM - surface_speed Suface Speed(FPM)
# SURF_SPEED_MPM - surface_speed Suface Speed(MPM)
# FEED_IPT - feed_per_tooth Feed per Tooth(IPT)
# FEED_MMPT - feed_per_tooth Feed per Tooth(MMPT)
# APPROACH_PCT - approach feedrate percentage of cut feedrate
# ENGAGE_PCT - engage feedrate percentage of cut feedrate
# FRSTCUT_PCT - first cut feedrate percentage of cut feedrate
# STEPOVER_PCT - stepover feedrate percentage of cut feedrate
# RETRACT_PCT - retract feedrate percentage of cut feedrate
# RETURN_PCT - return feedrate percentage of cut feedrate
# DEPART_PCT - departure feedrate percentage of cut feedrate
# NAME - unique record identifier
# DESCR - description
# PARTMAT - library reference of part material
# CUTMTD - library reference of cut method
# ENGAGE_SPEED_MPM - engage surface speeed Engage Suface Speed(MPM)
# ENGAGE_SPEED_FPM - engage surface speeed Engage Suface Speed(IPM)
# ENGAGE_FEED_MMPT - engage feed per tooth Engage Feed per Tooth(MPT)
# ENGAGE_FEED_IPT - engage feed per tooth Engage Feed per Tooth(IPT)
# ENGAGE_DIA_MM - engage diameter Engage Diameter (mm)
# ENGAGE_DIA_IN - engage diameter Engage Diameter (inch)
# ENGAGE_ANG - engage ramp angle
# PRESET - preset record
#--------------------------------------------------------------------------------
FORMAT LIBRF DPT_CUT_IN DPT_CUT_MM STEPOVER_IN STEPOVER_MM SURF_SPEED_FPM SURF_SPEED_MPM FEED_IPT FEED_MMPT APPROACH_PCT ENGAGE_PCT FRSTCUT_PCT STEPOVER_PCT RETRACT_PCT RETURN_PCT DEPART_PCT NAME DESCR PARTMAT CUTMTD ENGAGE_SPEED_MPM ENGAGE_SPEED_FPM ENGAGE_FEED_MMPT ENGAGE_FEED_IPT ENGAGE_DIA_MM ENGAGE_DIA_IN ENGAGE_ANG PRESET
#--------------------------------------------------------------------------------
DATA|SF_D12_Z4|0.118110|3.000000|0.236220|6.000000|8.267089|209.984050|0.002756|0.070000|0|90|60|0|100|0|0|TMD_00001||||0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0
DATA|TA_SF_D12_Z4|0.118110|3.000000|0.236220|6.000000|8.267089|209.984050|0.002756|0.070000|0|90|60|0|100|0|0|TMD_00001||||0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0
DATA|NCA_D8_Z1_W142|0.000000|0.000000|0.000000|0.000000|2.519211|63.987960|0.000591|0.015000|0|90|60|0|100|0|0|TMD_00001||||0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0
DATA|B_D8.8_Z2_W140|0.000000|0.000000|0.000000|0.000000|3.622281|92.005940|0.003937|0.100000|0|90|60|0|100|0|0|TMD_00001||||0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0
DATA|TA_B_D8.8_Z2_W140|0.000000|0.000000|0.000000|0.000000|3.621737|91.992120|0.003937|0.100000|0|90|60|0|100|0|0|TMD_00001||||0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|1
DATA|TA_NCA_D8_Z1_W142|0.000000|0.000000|0.000000|0.000000|2.519211|63.987960|0.000591|0.015000|0|90|60|0|100|0|0|TMD_00001||||0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|1

View File

@@ -0,0 +1,264 @@
# *TOOL_MACHINING_DATA.DEF
###############################################################################
# Definitions File for Tool Machining Data Database implemented in an ASCII text file
###############################################################################
# REVISIONS:
#
# 00 12Dec2003 rlm Initial Version
# 01 22Aug2023 Jenny Zhang Add new attributes
# 02 27Sep2023 Jenny Zhang Add attribute - preset
# 03 04Dec2023 Romy Shi Adjust several attributes name
##########################################################################
DB_PREFIX "db("
DB_SUFFIX ")"
ESS_PREFIX "ess("
ESS_SUFFIX ")"
################################################################################
# The list of DB_ALIAS
#
# DB_ALIAS <alias>
# {
# DB_ID < identifier of parameter in a UG part file >
# DB_ID_TYPE < Type of the identifier >
# d _ double
# i _ integer
# s _ string
# }
#
###############################################################################
DB_ALIAS libref
{
DB_ID LIBRF
DB_ID_TYPE s
DIALOG_NAME "Tool Key"
}
DB_ALIAS depthinch
{
DB_ID DPT_CUT_IN
DB_ID_TYPE d
DIALOG_NAME "Depth"
RSET_NAME "Depth - Inch"
}
DB_ALIAS depthmm
{
DB_ID DPT_CUT_MM
DB_ID_TYPE d
DIALOG_NAME "Depth"
RSET_NAME "Depth - mm"
}
DB_ALIAS stepover_in
{
DB_ID STEPOVER_IN
DB_ID_TYPE d
DIALOG_NAME "Stepover"
RSET_NAME "Stepover - Inch"
}
DB_ALIAS stepover_mm
{
DB_ID STEPOVER_MM
DB_ID_TYPE d
DIALOG_NAME "Stepover"
RSET_NAME "stepover - mm"
}
DB_ALIAS speedinch
{
DB_ID SURF_SPEED_FPM
DB_ID_TYPE d
DIALOG_NAME "Surface Speed"
RSET_NAME "Surface Speed - Inch"
}
DB_ALIAS speedmm
{
DB_ID SURF_SPEED_MPM
DB_ID_TYPE d
DIALOG_NAME "Surface Speed"
RSET_NAME "Surface Speed - mm"
}
DB_ALIAS feedinch
{
DB_ID FEED_IPT
DB_ID_TYPE d
DIALOG_NAME "Feed per Tooth"
RSET_NAME "Feed per Tooth - Inch"
}
DB_ALIAS feedmm
{
DB_ID FEED_MMPT
DB_ID_TYPE d
DIALOG_NAME "Feed per Tooth"
RSET_NAME "Feed per Tooth - mm"
}
DB_ALIAS approach_pct
{
DB_ID APPROACH_PCT
DB_ID_TYPE i
DIALOG_NAME "Approach"
RSET_NAME "Approach"
}
DB_ALIAS engage_pct
{
DB_ID ENGAGE_PCT
DB_ID_TYPE i
DIALOG_NAME "Engage"
RSET_NAME "Engage"
}
DB_ALIAS frstcut_pct
{
DB_ID FRSTCUT_PCT
DB_ID_TYPE i
DIALOG_NAME "First Cut"
RSET_NAME "First Cut"
}
DB_ALIAS stepover_pct
{
DB_ID STEPOVER_PCT
DB_ID_TYPE i
DIALOG_NAME "Stepover"
RSET_NAME "Stepover"
}
DB_ALIAS retract_pct
{
DB_ID RETRACT_PCT
DB_ID_TYPE i
DIALOG_NAME "Retract"
RSET_NAME "Retract"
}
DB_ALIAS return_pct
{
DB_ID RETURN_PCT
DB_ID_TYPE i
DIALOG_NAME "Return"
RSET_NAME "Return"
}
DB_ALIAS depart_pct
{
DB_ID DEPART_PCT
DB_ID_TYPE i
DIALOG_NAME "Depart"
RSET_NAME "Depart"
}
DB_ALIAS name
{
DB_ID NAME
DB_ID_TYPE s
DIALOG_NAME "Name"
RSET_NAME "Name"
}
DB_ALIAS descr
{
DB_ID DESCR
DB_ID_TYPE s
DIALOG_NAME "Description"
RSET_NAME "Description"
}
DB_ALIAS part_mat
{
DB_ID PARTMAT
DB_ID_TYPE s
DIALOG_NAME "Part Material"
RSET_NAME "Part Material"
}
DB_ALIAS cut_method
{
DB_ID CUTMTD
DB_ID_TYPE s
DIALOG_NAME "Cut Method"
RSET_NAME "Cut Method"
}
DB_ALIAS engage_speed_mm
{
DB_ID ENGAGE_SPEED_MPM
DB_ID_TYPE d
DIALOG_NAME "Engage Surface Speed"
RSET_NAME "Engage Surface Speed - mm"
}
DB_ALIAS engage_speed_in
{
DB_ID ENGAGE_SPEED_FPM
DB_ID_TYPE d
DIALOG_NAME "Engage Surface Speed"
RSET_NAME "Engage Surface Speed - Inch"
}
DB_ALIAS engage_feed_mm
{
DB_ID ENGAGE_FEED_MMPT
DB_ID_TYPE d
DIALOG_NAME "Engage Feed per Tooth"
RSET_NAME "Engage Feed per Tooth - mm"
}
DB_ALIAS engage_feed_in
{
DB_ID ENGAGE_FEED_IPT
DB_ID_TYPE d
DIALOG_NAME "Engage Feed per Tooth"
RSET_NAME "Engage Feed per Tooth - Inch"
}
DB_ALIAS engage_dia_mm
{
DB_ID ENGAGE_DIA_MM
DB_ID_TYPE d
DIALOG_NAME "Engage Diameter"
RSET_NAME "Engage Diameter - mm"
}
DB_ALIAS engage_dia_in
{
DB_ID ENGAGE_DIA_IN
DB_ID_TYPE d
DIALOG_NAME "Engage Diameter"
RSET_NAME "Engage Diameter - Inch"
}
DB_ALIAS engage_ang
{
DB_ID ENGAGE_ANG
DB_ID_TYPE d
DIALOG_NAME "Engage Ramp Angle"
RSET_NAME "Engage Ramp Angle"
}
DB_ALIAS preset
{
DB_ID PRESET
DB_ID_TYPE i
DIALOG_NAME "Preset"
RSET_NAME "Preset"
}
LIBREF libref
CLASS TOOL_MACH_DATA
{
TYPE TOOL_MACH_DATA
QUERY "[1] == [1]"
DIALOG libref depthinch speedinch feedinch
RSET libref depthinch depthmm stepover_in stepover_mm speedinch speedmm feedinch feedmm approach_pct engage_pct frstcut_pct stepover_pct retract_pct return_pct depart_pct name descr part_mat cut_method engage_speed_mm engage_speed_in engage_feed_mm engage_feed_in engage_dia_mm engage_dia_in engage_ang preset
UI_NAME "CAM Tool Machining Data Library"
}

View File

@@ -0,0 +1,677 @@
# *TOOL_MACHINING_DATA.TCL
###############################################################################
# tool_machining_data.tcl - DBC Event Handler for database stored as ascii file
###############################################################################
# Revisions
# Date Who Reason
# 12Dec2003 rlm Initial
# 30Jan2004 rlm Move ASC_write to dbc_ascii_general
# 12Feb2004 rlm Add library revision information
# 26Oct2018 Shorbojeet Das PR8340732: Add customization support for double precision control.
# 08Nov2018 Updates
# 22Aug2023 Jenny Zhang Add new attributes
# 13Sep2023 Romy Shi MFEC-42148: Modify DBC_retrieve for support retrieve enhanced machining data
# 26Oct2023 Romy Shi MFEC-45967: Adjust wrong paramters
# 31Oct2023 Romy Shi MFEC-45968: Refactor logic for retrieve enhanced machining data
# 02Nov2023 Xi Wang MFEC-45912: Change format after output new header
# 09Nov2023 Jingzhao Zhang MFEC-46854: Return name when auto set preset record
# 09Nov2023 Xi Wang MFEC-46624: Add DBC_find_select
# 28Nov2023 Romy Shi MFEC-47510: Modify logic for retrieve enhanced machining data
# 04Feb2024 Jingzhao Zhang MFEC-48916: Remove EnhancedToolMachiningData
# 01Mar2024 Xi Wang MFEC-50674: Support old dat with no preset in mach data
# 29Mar2024 XI Wang MFEC-52010: In retrieve, return error if no machining data in library
# 18Jun2024 Jingzhao Zhang MFEC-54164: Correct comments
################################################################################
#
# The format of each line in the text file is:
#
# libref depth_in depth_mm stepover_in stepover_mm speed_in speed_mm
# feed_in feed_mm approach_pct engage_pct frstcut_pct
# stepover_pct retract_pct return_pct depart_pct
#
# libref is a string
# depth_in is a double
# depth_mm is a double
# stepover_in is a double
# stepover_mm is a double
# speed_in is a double
# speed_mm is a double
# feed_in is a double
# feed_mm is a double
# approach_pct is an integer
# engage_pct is an integer
# frstcut_pct is an integer
# stepover_pct is an integer
# retract_pct is an integer
# return_pct is an integer
# depart_pct is an integer
#
# The DB_ID of a DB_ALIAS is its field number in the line (0-based)
###############################################################################
#MOM_set_debug_mode ON
#---------------------------------------------
# Non DBC Global Variables
#---------------------------------------------
#set dbFileName "[MOM_ask_env_var UGII_CAM_LIBRARY_FEEDS_SPEEDS_DATA_DIR]tool_machining_data.dat" ; # The ASCII Database File
set DEBUG 1
set fPointer ""
#---------------------------------------------
# Global variables set by DBC for Input/Output
#---------------------------------------------
set dbc_lhs_exp ""
set dbc_rhs_exp ""
set dbc_relop ""
set dbc_query ""
set dbc_subqry1 ""
set dbc_subqry2 ""
set dbc_boolop ""
set dbc_class_name ""
set dbc_attr_count 0
set dbc_attr_id ""
set dbc_query_count 0
set dbc_libref ""
set dbc_var_list ""
set dbc_tool_diameter ""
set dbc_tool_height ""
set dbc_name ""
set dbc_part_units "english" ; # ( english : 0 , metric : 1)
# Default double precision value format.
set double_precision_format "g"
#
# Express feedrates for the following feed types
# as percentages of Cut feedrate.
# A value of 0 indicates no relation to Cut feedrate.
#
set dbc_engage_percent 90
set dbc_first_cut_percent 60
set dbc_approach_percent 0
set dbc_stepover_percent 0
set dbc_retract_percent 0
set dbc_departure_percent 0
set dbc_return_percent 0
set asc_debug 0
proc ASC_t_create_filename {env_var_name filename} \
{
#
# Creates a complete filename by evaluating an environment variable
# for the directory information
#
set env_var [MOM_ask_env_var $env_var_name]
if { $env_var == "" } \
{
set message "Can't read environment variable $env_var_name"
MOM_abort "\n $message"
}
set fname ""
set fname [append fname $env_var $filename]
return $fname
}
#---------------------------------------------
proc MOM__boot {} {
#---------------------------------------------
# source some general procedures
#
# dbc_ascii_general.tcl
#
set filename \
[ASC_t_create_filename "UGII_UG_LIBRARY_DIR" "dbc_ascii_general.tcl"]
if { [catch {source $filename}] == "1" } \
{
set message "Can't load .tcl file: $filename"
MOM_abort "\n $message"
}
}
proc MOM__halt {} \
{
}
#---------------------------------------------
proc DBC_init_db {} {
#---------------------------------------------
global DEBUG
global dataBase
global dbFileName
global fPointer
global asc_file_name
global asc_database_count
set asc_file_name ""
set asc_part_units ""
set data_unit 0
set mode 0
#
# Set the filename for ASCII Data File
#
ASC_set_data_file_name
# Changed to improve performance
# And load the file into memory
#
ASC_load_data_file $asc_file_name $data_unit $mode
}
#---------------------------------------------
proc ASC_set_data_file_name {} {
#---------------------------------------------
global dbc_part_units
global asc_file_name
global asc_part_units
MOM_ask_part_units ;# writes to dbc_part_units
set env_var UGII_CAM_LIBRARY_FEEDS_SPEEDS_DATA_DIR
set asc_file_name [ASC_t_create_filename "$env_var" "tool_machining_data.dat"]
set asc_part_units $dbc_part_units
}
#---------------------------------------------
proc ASC_get_machining_data { DB_ROW CUT_DEPTH STEPOVER FEED_VALUE SPEED_VALUE } {
#---------------------------------------------
upvar $DB_ROW db_row
upvar $CUT_DEPTH asc_cut_value
upvar $STEPOVER asc_stepover
upvar $FEED_VALUE asc_feed_value
upvar $SPEED_VALUE asc_speed_value
global dbc_part_units
if { $dbc_part_units == "english"} \
{
set asc_cut_value [ASC_ask_att_val DPT_CUT_IN $db_row \
"%$::double_precision_format" 0 flag]
set asc_stepover [ASC_ask_att_val STEPOVER_IN $db_row \
"%$::double_precision_format" 0 flag]
set asc_speed_value [ASC_ask_att_val SURF_SPEED_FPM $db_row \
"%$::double_precision_format" 0 flag]
set asc_feed_value [ASC_ask_att_val FEED_IPT $db_row \
"%$::double_precision_format" 0 flag]
} else \
{
set asc_cut_value [ASC_ask_att_val DPT_CUT_MM $db_row \
"%$::double_precision_format" 0 flag]
set asc_stepover [ASC_ask_att_val STEPOVER_MM $db_row \
"%$::double_precision_format" 0 flag]
set asc_speed_value [ASC_ask_att_val SURF_SPEED_MPM $db_row \
"%$::double_precision_format" 0 flag]
set asc_feed_value [ASC_ask_att_val FEED_MMPT $db_row \
"%$::double_precision_format" 0 flag]
}
}
#---------------------------------------------
proc ASC_get_feedrate_percentages { DB_ROW APPROACH_PERCENT ENGAGE_PERCENT \
FIRSTCUT_PERCENT STEPOVER_PERCENT RETRACT_PERCENT RETURN_PERCENT DEPART_PERCENT } {
#---------------------------------------------
upvar $DB_ROW db_row
upvar $APPROACH_PERCENT asc_approach_pct
upvar $ENGAGE_PERCENT asc_engage_pct
upvar $FIRSTCUT_PERCENT asc_firstcut_pct
upvar $STEPOVER_PERCENT asc_stepover_pct
upvar $RETRACT_PERCENT asc_retract_pct
upvar $RETURN_PERCENT asc_return_pct
upvar $DEPART_PERCENT asc_depart_pct
set asc_approach_pct [ASC_ask_att_val APPROACH_PCT $db_row \
"%d" 0 flag]
set asc_engage_pct [ASC_ask_att_val ENGAGE_PCT $db_row \
"%d" 0 flag]
set asc_firstcut_pct [ASC_ask_att_val FRSTCUT_PCT $db_row \
"%d" 0 flag]
set asc_stepover_pct [ASC_ask_att_val STEPOVER_PCT $db_row \
"%d" 0 flag]
set asc_retract_pct [ASC_ask_att_val RETRACT_PCT $db_row \
"%d" 0 flag]
set asc_return_pct [ASC_ask_att_val RETURN_PCT $db_row \
"%d" 0 flag]
set asc_depart_pct [ASC_ask_att_val DEPART_PCT $db_row \
"%d" 0 flag]
if { $asc_engage_pct == 0 } \
{
set asc_engage_pct "RAPID"
}
if { $asc_retract_pct == 0 } \
{
set asc_retract_pct "RAPID"
}
}
proc ASC_get_engage_data { DB_ROW ENGAGE_SPEED ENGAGE_FEED ENGAGE_DIA ENGAGE_ANG } {
#---------------------------------------------
upvar $DB_ROW db_row
upvar $ENGAGE_SPEED asc_engage_speed
upvar $ENGAGE_FEED asc_engage_feed
upvar $ENGAGE_DIA asc_engage_dia
upvar $ENGAGE_ANG asc_engage_ang
global dbc_part_units
if { $dbc_part_units == "english"} \
{
set asc_engage_speed [ASC_ask_att_val ENGAGE_SPEED_FPM $db_row \
"%$::double_precision_format" 0 flag]
set asc_engage_feed [ASC_ask_att_val ENGAGE_FEED_IPT $db_row \
"%$::double_precision_format" 0 flag]
set asc_engage_dia [ASC_ask_att_val ENGAGE_DIA_IN $db_row \
"%$::double_precision_format" 0 flag]
} else \
{
set asc_engage_speed [ASC_ask_att_val ENGAGE_SPEED_MPM $db_row \
"%$::double_precision_format" 0 flag]
set asc_engage_feed [ASC_ask_att_val ENGAGE_FEED_MMPT $db_row \
"%$::double_precision_format" 0 flag]
set asc_engage_dia [ASC_ask_att_val ENGAGE_DIA_MM $db_row \
"%$::double_precision_format" 0 flag]
}
set asc_engage_ang [ASC_ask_att_val ENGAGE_ANG $db_row \
"%$::double_precision_format" 0 flag]
}
#------------------------------------------------------------------------
proc DBC_create_query { } {
#------------------------------------------------------------------------
global DEBUG
global dbc_query
global dbc_subqry1
global dbc_subqry2
global dbc_boolop
# set dbc_query "$dbc_subqry1 $dbc_boolop $dbc_subqry2"
ASC_create_query
}
#------------------------------------------------------------------------
proc DBC_execute_query { } {
#------------------------------------------------------------------------
global asc_database_count
ASC_execute_query
}
proc DBC_find_select {} {
global DEBUG
global dbc_event_error
global dbc_part_units
global dbc_surface_speed
global dbc_feed_per_tooth
global dbc_depth_of_cut
global dbc_stepover
global dbc_approach_percent
global dbc_engage_percent
global dbc_first_cut_percent
global dbc_stepover_percent
global dbc_retract_percent
global dbc_return_percent
global dbc_departure_percent
global fPointer
global dbFileName
global asc_database_count
global asc_database
global asc_file_name
global file_unit
global asc_units
global asc_next_line
global dbc_libref
global dbc_engage_speed
global dbc_engage_feed
global dbc_engage_dia
global dbc_engage_ang
global dbc_cutmthd_libref
global dbc_part_material_libref
global dbc_selected_name
set index 0
set initialize_flag 1
set asc_data_file_name $asc_file_name
set asc_next_line ""
if { $dbc_part_units == "english" } \
{
set file_unit $asc_units(inch)
} else \
{
set file_unit $asc_units(mm)
}
if { [info exists dbc_selected_name] && $dbc_selected_name != "" } \
{
set db_row 0
while { $db_row < $asc_database_count } \
{
set ascii_libref [ ASC_ask_att_val LIBRF $db_row "" 0 flag]
set ascii_name [ ASC_ask_att_val NAME $db_row "" 0 flag]
# See if row matches requested conditions
if {$dbc_libref == $ascii_libref && $dbc_selected_name == $ascii_name} \
{
# Got a matching record, get remaining data and return
ASC_get_machining_data db_row dbc_depth_of_cut dbc_stepover \
dbc_feed_per_tooth dbc_surface_speed
ASC_get_feedrate_percentages db_row dbc_approach_percent \
dbc_engage_percent dbc_first_cut_percent dbc_stepover_percent \
dbc_retract_percent dbc_return_percent dbc_departure_percent
ASC_get_engage_data db_row dbc_engage_speed dbc_engage_feed \
dbc_engage_dia dbc_engage_ang
return 0
}
incr db_row
}
}
set dbc_event_error "No appropriate machining data found"
}
#---------------------------------------------
proc DBC_retrieve {} {
#---------------------------------------------
global DEBUG
global dbc_event_error
global dbc_part_units
global dbc_surface_speed
global dbc_feed_per_tooth
global dbc_depth_of_cut
global dbc_stepover
global dbc_approach_percent
global dbc_engage_percent
global dbc_first_cut_percent
global dbc_stepover_percent
global dbc_retract_percent
global dbc_return_percent
global dbc_departure_percent
global fPointer
global dbFileName
global asc_database_count
global asc_database
global asc_file_name
global file_unit
global asc_units
global asc_next_line
global dbc_libref
global dbc_engage_speed
global dbc_engage_feed
global dbc_engage_dia
global dbc_engage_ang
global dbc_cutmthd_libref
global dbc_part_material_libref
global dbc_name
set index 0
set initialize_flag 1
set asc_data_file_name $asc_file_name
set asc_next_line ""
set dbc_name ""
if { $dbc_part_units == "english" } \
{
set file_unit $asc_units(inch)
} else \
{
set file_unit $asc_units(mm)
}
## Changed function to improve performance
# set ret_code [catch {open $asc_data_file_name "r"} fp]
# if { $ret_code } \
# {
# return 1
# }
# ASC_init_database
#
# Loop over all the DATA records
#
# The db_row variable has to be initialized (see also ASC_translate_att_alias
if { $asc_database_count == 0 } \
{
set dbc_event_error "No appropriate machining data found"
return 0;
}
set ascii_preset [ ASC_ask_att_val PRESET 0 "" -1 flag]
if { $ascii_preset == "-1" } \
{
set db_row 0
while { $db_row < $asc_database_count } \
{
set ascii_libref [ ASC_ask_att_val LIBRF $db_row "" 0 flag]
# See if row matches requested libref
if { $dbc_libref == $ascii_libref } \
{
# Got a matching record, get remaining data and return
ASC_get_machining_data db_row dbc_depth_of_cut dbc_stepover \
dbc_feed_per_tooth dbc_surface_speed
ASC_get_feedrate_percentages db_row dbc_approach_percent \
dbc_engage_percent dbc_first_cut_percent dbc_stepover_percent \
dbc_retract_percent dbc_return_percent dbc_departure_percent
return 0
}
incr db_row
}
} else \
{
#First check part material and cut method
if { [info exists dbc_part_material_libref] && [info exists dbc_cutmthd_libref]} \
{
set db_row 0
while { $db_row < $asc_database_count } \
{
set ascii_libref [ ASC_ask_att_val LIBRF $db_row "" 0 flag]
set ascii_part_material_libref [ ASC_ask_att_val PARTMAT $db_row "" 0 flag]
set ascii_cut_method_libref [ ASC_ask_att_val CUTMTD $db_row "" 0 flag]
# See if row matches requested conditions
if {$dbc_libref == $ascii_libref && \
$dbc_part_material_libref == $ascii_part_material_libref && \
$dbc_cutmthd_libref == $ascii_cut_method_libref } \
{
# Got a matching record, get remaining data and return
ASC_get_machining_data db_row dbc_depth_of_cut dbc_stepover \
dbc_feed_per_tooth dbc_surface_speed
ASC_get_feedrate_percentages db_row dbc_approach_percent \
dbc_engage_percent dbc_first_cut_percent dbc_stepover_percent \
dbc_retract_percent dbc_return_percent dbc_departure_percent
ASC_get_engage_data db_row dbc_engage_speed dbc_engage_feed \
dbc_engage_dia dbc_engage_ang
set dbc_name [ ASC_ask_att_val NAME $db_row "" 0 flag]
return 0
}
incr db_row
}
}
#If part material and cut method not matched then check preset
set db_row 0
while { $db_row < $asc_database_count } \
{
set ascii_libref [ ASC_ask_att_val LIBRF $db_row "" 0 flag]
set ascii_preset [ ASC_ask_att_val PRESET $db_row "" 0 flag]
# See if row matches requested conditions
if { $dbc_libref == $ascii_libref && $ascii_preset == "1"} \
{
# Got a matching record, get remaining data and return
ASC_get_machining_data db_row dbc_depth_of_cut dbc_stepover \
dbc_feed_per_tooth dbc_surface_speed
ASC_get_feedrate_percentages db_row dbc_approach_percent \
dbc_engage_percent dbc_first_cut_percent dbc_stepover_percent \
dbc_retract_percent dbc_return_percent dbc_departure_percent
ASC_get_engage_data db_row dbc_engage_speed dbc_engage_feed \
dbc_engage_dia dbc_engage_ang
set dbc_name [ ASC_ask_att_val NAME $db_row "" 0 flag]
return 0
}
incr db_row
}
}
# no match found at all -- return error message
set dbc_event_error "No appropriate machining data found"
}
#------------------------------------------------------------------------
proc DBC_write { } {
#------------------------------------------------------------------------
global asc_database_name
set asc_database_name "tool_machining_data.dat"
ASC_write
}
#------------------------------------------------------------------------
proc ASC_output_header { fileid } {
#------------------------------------------------------------------------
global dbc_attr_count
global dbc_attr_aliases
global dbc_attr_id
global dbc_logname
global asc_database_fmt
set daytime [clock seconds]
set out_daytime [clock format $daytime -format "%a %b %d %Y %I:%M %p"]
set headerMessage "# TOOL_MACHINING_DATA.DAT
##########################################################################
#
# PURPOSE:
#
# This is the database file used for defining Machining Data in
# an operation based only on the selected tool.
#
# REVISED:
# $dbc_logname $out_daytime
#
##########################################################################
# The data is organized in the following format separated by |
# The fields in the database are in the following order:
#
# LIBRF - library reference of cutter
# DPT_CUT_IN - dpth_of_cut Depth_of_cut(inch)
# DPT_CUT_MM - dpth_of_cut Depth_of_cut(mm)
# STEPOVER_IN - stepover distance (inch)
# STEPOVER_MM - stepover distance (mm)
# SURF_SPEED_FPM - surface_speed Suface Speed(FPM)
# SURF_SPEED_MPM - surface_speed Suface Speed(MPM)
# FEED_IPT - feed_per_tooth Feed per Tooth(IPT)
# FEED_MMPT - feed_per_tooth Feed per Tooth(MMPT)
# APPROACH_PCT - approach feedrate percentage of cut feedrate
# ENGAGE_PCT - engage feedrate percentage of cut feedrate
# FRSTCUT_PCT - first cut feedrate percentage of cut feedrate
# STEPOVER_PCT - stepover feedrate percentage of cut feedrate
# RETRACT_PCT - retract feedrate percentage of cut feedrate
# RETURN_PCT - return feedrate percentage of cut feedrate
# DEPART_PCT - departure feedrate percentage of cut feedrate
# NAME - unique record identifier
# DESCR - description
# PARTMAT - library reference of part material
# CUTMTD - library reference of cut method
# ENGAGE_SPEED_MPM - engage surface speeed Engage Suface Speed(MPM)
# ENGAGE_SPEED_FPM - engage surface speeed Engage Suface Speed(IPM)
# ENGAGE_FEED_MMPT - engage feed per tooth Engage Feed per Tooth(MPT)
# ENGAGE_FEED_IPT - engage feed per tooth Engage Feed per Tooth(IPT)
# ENGAGE_DIA_MM - engage diameter Engage Diameter (mm)
# ENGAGE_DIA_IN - engage diameter Engage Diameter (inch)
# ENGAGE_ANG - engage ramp angle
# PRESET - preset record
#--------------------------------------------------------------------------------"
puts $fileid "$headerMessage"
# load the database structure
DBC_load_rset_data
# Xi Wang 6-Nov-2023
# Update asc_database_fmt, it is used in ASC_output_data to output data
#
set fmt {}
# output FORMAT line
set format_line "FORMAT"
for {set i 0} {$i < $dbc_attr_count} {incr i} \
{
DBC_ask_attr_id $dbc_attr_aliases($i)
set format_line "$format_line $dbc_attr_id"
lappend fmt $dbc_attr_id
}
set asc_database_fmt(0) $fmt
puts $fileid $format_line
puts $fileid "#--------------------------------------------------------------------------------"
}
# Xi Wang 6-Nov-2023
# Add following functions to support query,
#---------------------------------------------
proc DBC_translate_att_alias {} {
#---------------------------------------------
ASC_translate_att_alias
}
#---------------------------------------------
proc DBC_create_criterion {} {
#---------------------------------------------
ASC_create_criterion
}
#---------------------------------------------
proc DBC_create_query {} {
#---------------------------------------------
ASC_create_query
}
# To enable the new customization mechanism.
# This should ALWAYS be the last line in the file.
MOM_extend_for_customization UGII_CAM_CUSTOM_LIBRARY_FEEDS_SPEEDS_ASCII_DIR dbc_custom_ascii_tool_machining_data.tcl

View File

@@ -0,0 +1,52 @@
# TOOL_MATERIALS.DAT
##########################################################################
#
# PURPOSE:
#
# This is the database file used for defining Tool Material.
#
# REVISIONS:
# Sl.No. Date Name Reason
# 01 06/15/99 Subhash Initial
# 02 07/31/99 Subhash Include Format statement
# 03 10/29/99 Murthy Changes to data and file description
# 04 29-jun-2004 Mark Rief Add TiAlN for HSM
# 05 11-Oct-2005 rlm Add more HSM data
# 06 29-Nov-2006 rlm Add materials for probes
# 07 15-jul-2008 Mark Rief Change 00004 MATNAM to Carbide Coated PR4181848
# 08 27-jun-2013 Mark Rief Add materials for Wire EDM
# 09 18-apr-2019 Reinier Capelle Add Coated(Ti,Al)N libref TMC0_00007
#
##########################################################################
##########################################################################
##
## The following key words for Attribute ids are defined
##
## LIBREF material_code - Unique record identifier
## (Library Reference)
## MATNAM material_name - Material Name (appears on the label)
## MATDESC material_description - Material Description
#########################################################################
#----------------+-------------------------------+-------------
FORMAT LIBRF MATNAM MATDESC
#--------------------------------------------------------------------------------
#DATA|TMC0_00001|HSS|High Speed Steel
#DATA|TMC0_00002|Carbide|Carbide, Uncoated (Brazed and Solid)
#DATA|TMC0_00003|Carbide|Carbide, Uncoated (Indexable)
#DATA|TMC0_00004|Carbide Coated|Carbide, Coated (Indexable - TiN, TiC, and Aluminum Oxide)
#DATA|TMC0_00006|HSS Coated|High Speed Steel Coated
DATA|TMC0_00007|PVD (Ti,Al)N|Coated(Ti,Al)N
DATA|TMC0_00021|HSM Ball Mill TiAlN Coated|HSM Carbide Ball Mill
DATA|TMC0_00022|HSM End Mill TiAlN Coated|HSM Carbide End Mill, up to 5% Corner Radius
DATA|TMC0_00023|HSM Bull Nose Inserted|HSM Inserted Bull-nose Mill
DATA|TMC0_00025|HSM End Mill Inserted|HSM Inserted End Mill, up to 5% Corner Radius
DATA|TMC0_00026|HSM Ball Mill Inserted|HSM Inserted Ball Mill
DATA|TMC0_00027|HSM Bull Nose TiAlN Coated|HSM Carbide Bull-nose Mill
DATA|TMC0_00028|HSM End Mill Extra Long|HSM HardCut Inserted End Mill, Extra long
DATA|TMC0_00041|Ruby|Ruby
#DATA|TMC0_00042|Silicon Nitride|Silicon Nitride
#DATA|TMC0_00043|Zirconia|Zirconia
DATA|TMC0_00051|Brass Wire|Brass Wire
#DATA|TMC0_00052|Zinc Coated Brass Wire|Zinc Coated Brass Wire

View File

@@ -0,0 +1,62 @@
# *TOOL_MATERIALS.DEF
################################################################################
# REVISIONS:
#
# 00 23Mar99 Murthy R Mandaleeka Initial Version
# 01 26JUL99 Subhash Changed order of attributes
# presented
# 02 29OCT99 Murthy Changed RSET names
##########################################################################
DB_PREFIX "DB("
DB_SUFFIX ")"
ESS_PREFIX "ESS("
ESS_SUFFIX ")"
################################################################################
# The list of DB_ALIAS
#
# DB_ALIAS <alias>
# {
# DB_ID < identifier of the Tool Material parameter in a UG part file >
# DB_ID_TYPE < Type of the identifier >
# d _ double
# i _ integer
# s _ string
# }
#
###############################################################################
DB_ALIAS matno
{
DB_ID LIBRF
DB_ID_TYPE s
DIALOG_NAME "Serial"
RSET_NAME "Library Reference"
}
DB_ALIAS matnam
{
DB_ID MATNAM
DB_ID_TYPE s
DIALOG_NAME "Material Name"
RSET_NAME "Material Name"
}
DB_ALIAS matdesc
{
DB_ID MATDESC
DB_ID_TYPE s
DIALOG_NAME "Material Description"
RSET_NAME "Material Description"
}
LIBREF matno
CLASS TOOL_MATERIAL
{
TYPE TOOL_MATERIAL
QUERY "[1] == [1]"
DIALOG matno matnam matdesc
RSET matno matnam matdesc
UI_NAME "Tool Material"
}

View File

@@ -0,0 +1,373 @@
#############################################################################
# REVISIONS
# Date Who Reason
# 03/24/99 Murthy Mandaleeka Initial
# 05/19/99 Murthy Mandaleeka New Environment Variable
# 07/21/99 Subhash Included dbc_general_ascii.tcl file
# 07/21/99 Subhash Used general functions for
# opening and reading dat files.
# 08/06/99 Subhash Removed some unwanted comments
# 11/11/2003 rlm Add ASC_output_header
# 01/30/2004 rlm Move ASC_write to dbc_ascii_general
# 02/12/2004 rlm Add library revision information
# 07/01/2004 rlm 1339644 Add proc DBC_ask_library_values
# 12/06/2004 rlm 1369488 Fix DBC_execute_query_for_count and
# DBC_translate_att_alias
# 01/06/2005 gbs Added a comment to the line
# before
##############################################################################
#
# The format of each line in the text file is:
#
# material_code
# material_name
# material_description
#
# The DB_ID of a DB_ALIAS is its field number in the line (0-based)
###############################################################################
#---------------------------------------------
# Non DBC Global Variables
#---------------------------------------------
#MOM_set_debug_mode ON
#set dbFileName "[MOM_ask_env_var UGII_CAM_LIBRARY_FEEDS_SPEEDS_DATA_DIR]tool_materials.dat"
set DEBUG 0
set fPointer ""
#---------------------------------------------
# Global variables set by DBC for Input/Output
#---------------------------------------------
set dbc_lhs_exp ""
set dbc_rhs_exp ""
set dbc_relop ""
set dbc_query ""
set dbc_subqry1 ""
set dbc_subqry2 ""
set dbc_boolop ""
set dbc_class_name ""
set dbc_attr_count 0
set dbc_attr_id ""
set dbc_query_count 0
set dbc_libref ""
set dbc_var_list ""
set asc_debug 0
#---------------------------------------------
proc ASC_t_create_filename {env_var_name filename} \
{
#
# Creates a complete filename by evaluating an environment variable
# for the directory information
#
set env_var [MOM_ask_env_var $env_var_name]
if { $env_var == "" } \
{
set message "Can't read environment variable $env_var_name"
MOM_abort "\n $message"
}
set fname ""
set fname [append fname $env_var $filename]
return $fname
}
#---------------------------------------------
proc MOM__boot {} {
#---------------------------------------------
# source some general procedures
#
# dbc_ascii_general.tcl
#
set filename \
[ASC_t_create_filename "UGII_UG_LIBRARY_DIR" "dbc_ascii_general.tcl"]
if { [catch {source $filename}] == "1" } \
{
set message "Can't load .tcl file: $filename"
MOM_abort "\n $message"
}
}
proc MOM__halt {} \
{
}
#------------------------------------------------------------
proc DBC_init_db { } \
{
global DEBUG
global dataBase
global lastRowNumber
global dbFileName
global fPointer
global asc_file_name
set asc_part_units ""
set data_unit 0
set mode 0
#
# Set the filename for ASCII Data File
#
ASC_set_data_file_name
#
# And load the file into memory
#
ASC_load_data_file $asc_file_name $data_unit $mode
}
#---------------------------------------------
proc ASC_set_data_file_name {} {
#---------------------------------------------
global dbc_part_units
global asc_file_name
global asc_part_units
MOM_ask_part_units ;# writes to dbc_part_units
set env_var UGII_CAM_LIBRARY_FEEDS_SPEEDS_DATA_DIR
set asc_file_name [ASC_t_create_filename "$env_var" "tool_materials.dat"]
set asc_part_units $dbc_part_units
}
#---------------------------------------------
proc DBC_translate_att_alias {} {
#---------------------------------------------
global DEBUG
global dbc_alias
global dbc_id
ASC_translate_att_alias
}
#------------------------------------------------------------
proc DBC_create_criterion { } {
#------------------------------------------------------------
global DEBUG
global dbc_lhs_exp
global dbc_rhs_exp
global dbc_relop
global dbc_query
### set dbc_query "\[$dbc_lhs_exp\] $dbc_relop \[$dbc_rhs_exp\]"
ASC_create_criterion
}
#------------------------------------------------------------------------
proc DBC_create_query { } {
#------------------------------------------------------------------------
global DEBUG
global dbc_query
global dbc_subqry1
global dbc_subqry2
global dbc_boolop
#### set dbc_query "$dbc_subqry1 $dbc_boolop $dbc_subqry2"
ASC_create_query
}
#------------------------------------------------------------------------
proc DBC_execute_query { } {
#------------------------------------------------------------------------
global asc_database_count
ASC_execute_query
}
#---------------------------------------------
proc DBC_execute_query_for_count {} {
#---------------------------------------------
ASC_execute_query_for_count
}
#---------------------------------------------
proc DBC_retrieve { } {
#---------------------------------------------
global DEBUG
global dbc_libref
global dbc_retrieve_var_list
global dataBase
global dbc_material_code
global dbc_material_name
global dbc_material_description
global dbFileName
global fPointer
global asc_debug
global asc_file_name
global asc_database_count
if { $asc_debug == "1" } \
{
puts " =========================================="
puts " procedure DBC_retrieve for Tool Material"
puts " libref -> $dbc_libref"
}
#
# Look for the desired libref
#
for {set db_row 0} {$db_row < $asc_database_count} {incr db_row 1} \
{
# Find the row for the desired LibRef
set toolmaterial_libref [ASC_ask_att_val LIBRF $db_row \
"" 0 flag]
if { $dbc_libref == $toolmaterial_libref } \
{
break
}
}
if { $db_row >= $asc_database_count } \
{
set message "Error retrieving Tool Material from external library."
set message "$message \n Tool Material with the library reference $dbc_libref"
set message "$message \n does not exist in the"
set message "$message \n ASCII Data File: $asc_file_name"
MOM_abort "\n $message"
}
#
# Get the Material No.
#
set dbc_material_code [ASC_ask_att_val LIBRF $db_row "%s" "" flag]
#
# Get the Material Name
#
set dbc_material_name [ASC_ask_att_val MATNAM $db_row "%s" "" flag]
#
# Get the Material description
#
set dbc_material_description [ASC_ask_att_val MATDESC $db_row "%s" "" flag]
}
#------------------------------------------------------------------------
proc DBC_write { } {
#------------------------------------------------------------------------
global asc_database_name
set asc_database_name "tool_materials.dat"
ASC_write
}
#---------------------------------------------------------------------
proc ASC_output_header { fileid } {
#---------------------------------------------------------------------
global dbc_attr_count
global dbc_attr_aliases
global dbc_attr_id
global dbc_logname
set daytime [clock seconds]
set out_daytime [clock format $daytime -format "%a %b %d %Y %I:%M %p"]
set headerMessage "# TOOL_MATERIALS.DAT
##########################################################################
#
# PURPOSE:
#
# This is the database file used for defining Tool Material.
#
# REVISED:
# $dbc_logname $out_daytime
#
##########################################################################
##########################################################################
##
## The following key words for Attribute ids are defined
##
## LIBREF material_code - Unique record identifier
## (Library Reference)
## MATNAM material_name - Material Name (appears on the label)
## MATDESC material_description - Material Description
#########################################################################
#----------------+-------------------------------+-------------"
puts $fileid "$headerMessage"
# load the database structure
DBC_load_rset_data
# output FORMAT line
set format_line "FORMAT"
for {set i 0} {$i < $dbc_attr_count} {incr i} \
{
DBC_ask_attr_id $dbc_attr_aliases($i)
set format_line "$format_line $dbc_attr_id"
}
puts $fileid $format_line
puts $fileid "#--------------------------------------------------------------------------------"
}
proc DBC_ask_library_values {} \
{
#
# global input
global dbc_libref
global dbc_db_ids_count
global dbc_db_ids
global dbc_event_error
global asc_database_count
#
# global output
global dbc_return_status
global dbc_db_ids_value
# Do not change this string
set NO_MATCH "No matching record found for $dbc_libref"
set dbc_return_status 0
#
# Look for the desired libref
#
for {set db_row 0} {$db_row < $asc_database_count} {incr db_row 1} \
{
set toolmaterial_libref [ASC_ask_att_val LIBRF $db_row \
"" 0 flag]
if { $dbc_libref == $toolmaterial_libref } \
{
break
}
}
#
# and set the desired values
#
if { $db_row < $asc_database_count } \
{
for { set inx 0 } { $inx < $dbc_db_ids_count } { incr inx } \
{
set dbc_db_ids_value($dbc_db_ids($inx)) \
[ASC_ask_att_val $dbc_db_ids($inx) $db_row "" "" flag]
}
} else \
{
set dbc_event_error $NO_MATCH
set dbc_return_status 1
}
}