Follow

GCODE - How to add an attribute name and select it in CAMWorks EXAMPLE

Kevin Chen

If you want to add an Attribute that does not exist in CAMWORKS, you will need to open the Master.ATR file inside the EC Editor.  Once you have it opened, you will notice the number on the very top.  By default, it is at 17506.  You will want to change this to 17507 (each sequential number can be used for a new attribute), or if you want to add two, you will want to change it to 17508 etc.  Scroll to the very bottom of the file, and type the following below.  (all 5 lines not including the italicized text)

 ==========================================================

*------------------------------

:ATTRNAME= changing pallets   <-------Attrname 

:ATTRTYPE:SELECT

:ATTRID=17507   <---------------- New ID number

:ATTREND

========================================================== 

Once you add the following below, you can add the "OPERLIST= Example123" to your OPERID's.  It will look like the following below.  This is added in the .SRC file.

 ==========================================================

*-----------------------------------
:OPERID=MILL_DRILLING
:OPERSUB=REVERSE_TAPPING
:OPERLIST=abs inc
:OPERLIST=work coord
:OPERLIST=coolant
:OPERLIST=changing pallets
:OPEREND

 ==========================================================

The next thing you will need to add is the the ATTRNAME inside the .lib file you are using.  It will look like the following below.

 ==========================================================

*------------------------------------
:ATTRNAME=changing pallets
:ATTRTYPE=SELECT
:ATTREMARK=changing pallets
:ATTRSEL=N
:ATTRTITLE=changing pallets
:ATTRSELSTR=No
:ATTRSELSTR=Left
:ATTRSELSTR=Right
:ATTRDEFAULT=1
:ATTRUSED=1
:ATTREND

==========================================================

 Once you have added the three sections above, the attribute should now show up in CAMWorks.  If you want it to have the option to select different options, you will want to add the following section below in the .lib file.

==========================================================

*-----------------------------------
:ATTRNAME=P CHANGE
:ATTRTYPE=POST
:ATTRVTYPE=INTEGER
:ATTREMARK=Pallet Change
:CODETYPE=SELECT
:SELECT=2
:CODE=|M51
:SELECT=3
:CODE=|M52
:ATTREND

==========================================================

The next thing you want to do is add the following line below in the CALC_INIT_TOOL_CHANGE_MILL Section.

==========================================================

*-------------------------------------

:SECTION=CALC_INIT_TOOL_CHANGE_MILL
:C: IF SECTIONEXIST(DEBUG) THEN
:C: DEBUG=4 CALL(DEBUG)
:C: ENDIF
*
*:C: IF OPER_COUNT>1 THEN CALL(CALC_SUB_TOOL_CHANGE_MILL) RETURN ENDIF
:C: IF MACH(REG_T2)<>0 THEN CALL(CALC_SUB_TOOL_CHANGE_MILL) RETURN ENDIF
*
* If you are defining a macro then you stop here!
*
:C: P_MOVE_TYPE=TOOL_CHANGE
:C: IF DEFINING_MACRO=(YES) THEN CALL(CALC_CHECK_OPER_COMMENTS) RETURN ENDIF
:C: IF MACH(REG_T)<>0 AND MACH(REG_T)=TOOL THEN RETURN ENDIF
:C: CALC_CHANGE_TOOL=1
:C: TOOL_ARRAY(ARRAY_COUNT)=NC_TOOL
:C: TOOL_DIAM_ARRAY(ARRAY_COUNT)=NC_TOOL_DIAMETER
:C: IF NC_TOOL=(-1) THEN TOOL_DIAM_ARRAY(ARRAY_COUNT)=TOOL_DIAM_ARRAY(0) ENDIF
:C: NEXT_TOOL=TOOL_ARRAY(ARRAY_COUNT)
:C: POT_NUMBER=10
:C: IF TOOL_DIAMETER>LARGE_POT THEN POT_NUMBER=90 ENDIF
:C: NEXT_POT_NUMBER=10
:C: IF TOOL_DIAM_ARRAY(ARRAY_COUNT)>LARGE_POT THEN NEXT_POT_NUMBER=90 ENDIF
:C: ARRAY_COUNT=(ARRAY_COUNT+1)
:C: IF SECTIONEXIST(OUTPUT_ESTIMATED_TIME) THEN
:C: CALL(CALC_TOOL_CHANGE_TIME)
:C: ENDIF
:C: IF TOOL_COMMENT={} THEN
:C: SETOFF(<TOOL_COMMENT>) ELSE
:C: SETON(<TOOL_COMMENT>)
:C: ENDIF
:C: P_CHANGE=changing_pallets   <---------- add this line 
:C: IF SECTIONEXIST(INIT_PRELOAD_TOOL_CHANGE_MILL) THEN
:C: CALL(CALC_INIT_PRELOAD_TOOL_CHANGE)
:C: CALL(CALC_CHECK_OPER_COMMENTS)
:C: MACH(REG_T)=TOOL
:C: FIRST_TOOL=TOOL
:C: LAST_TOOL=TOOL
:C: RETURN
:C: ENDIF
:C: IF SECTIONEXIST(INIT_TOOL_CHANGE_MILL) THEN
:C: CALL(INIT_TOOL_CHANGE_MILL)
:C: ENDIF
:C: CALL(CALC_CHECK_OPER_COMMENTS)
:C: MACH(REG_T)=TOOL
:C: FIRST_TOOL=TOOL
:C: LAST_TOOL=TOOL

==========================================================

After this, you will need to add one more line in the CALC_SUB_TOOL_CHANGE_MILL

==========================================================

*----------------------------------
:SECTION=CALC_SUB_TOOL_CHANGE_MILL
:C: IF SECTIONEXIST(DEBUG) THEN
:C: DEBUG=5 CALL(DEBUG)
:C: ENDIF
*
* Startup Seton Codes
*
:C: CALL(CALC_BEF_SETON_CODES)
:C: G=GC(G_LEN_COMP) SETON(<G>)
:C: M=MC(M_COOL_OFF) SETON(<M>)
*
* If you are defining a macro then you stop here!
*
:C: P_MOVE_TYPE=TOOL_CHANGE
:C: IF DEFINING_MACRO=(YES) THEN CALL(CALC_CHECK_OPER_COMMENTS) RETURN ENDIF
:C: IF MACH(REG_T)<>0 AND MACH(REG_T)=TOOL THEN RETURN ENDIF
:C: CALC_CHANGE_TOOL=(CALC_CHANGE_TOOL+1)
:C: IF OFFSET_RESIDENT=YES THEN CALL(CALC_REMOVE_OFFSET) ENDIF
:C: IF TOOL=NC_TOOL THEN NC_TOOL=(-1) ENDIF
:C: TOOL_ARRAY(ARRAY_COUNT)=NC_TOOL
:C: TOOL_DIAM_ARRAY(ARRAY_COUNT)=NC_TOOL_DIAMETER
:C: IF NC_TOOL=(-1) THEN TOOL_DIAM_ARRAY(ARRAY_COUNT)=TOOL_DIAM_ARRAY(0) ENDIF
:C: NEXT_TOOL=TOOL_ARRAY(ARRAY_COUNT)
:C: POT_NUMBER=10
:C: IF TOOL_DIAMETER>LARGE_POT THEN POT_NUMBER=90 ENDIF
:C: NEXT_POT_NUMBER=10
:C: IF TOOL_DIAM_ARRAY(ARRAY_COUNT)>LARGE_POT THEN NEXT_POT_NUMBER=90 ENDIF
:C: ARRAY_COUNT=(ARRAY_COUNT+1)
:C: CALL(CALC_TOOL_CHANGE_TIME)
:C: IF TOOL_COMMENT={} THEN
:C: SETOFF(<TOOL_COMMENT>) ELSE
:C: SETON(<TOOL_COMMENT>)
:C: ENDIF
:C: P_CHANGE=changing_pallets <---------- Add this line
:C: IF SECTIONEXIST(SUB_PRELOAD_TOOL_CHANGE_MILL) THEN
:C: CALL(CALC_SUB_PRELOAD_TOOL_CHANGE)
:C: CALL(CALC_CHECK_OPER_COMMENTS)
:C: CALL(CALC_AFT_SETON_CODES)
:C: MACH(REG_T)=TOOL
:C: LAST_TOOL=TOOL
:C: MACH(REG_Z)=MILL_Z_HOME
:C: RETURN
:C: ENDIF
:C: IF SECTIONEXIST(SUB_TOOL_CHANGE_MILL) THEN
:C: CALL(SUB_TOOL_CHANGE_MILL)
:C: ENDIF
:C: CALL(CALC_CHECK_OPER_COMMENTS)
:C: CALL(CALC_AFT_SETON_CODES)
:C: MACH(REG_T)=TOOL
:C: LAST_TOOL=TOOL
:C: MACH(REG_Z)=MILL_Z_HOME

 

 

Once all of this is done, you will have the option to select No, Left, or Right under Posting Parameters as a Changing Pallet Option.

 

Changing_Pallet_Option_.png

 

Don't forget, you will have to recompile your post and choose it to see these options.

Was this article helpful?
2 out of 2 found this helpful
Have more questions? Submit a request

Comments