Manufacturing > Manufacturing > User-Defined NC Sequences > Example: Using a Manufacturing UDF with Pro/PROGRAM
Example: Using a Manufacturing UDF with Pro/PROGRAM
This example illustrates creation and use of a manufacturing UDF with embedded logic, which chooses a tool for drilling based on the diameter of the hole and decides between reaming and boring to finish the hole. It also includes the use of the Evaluate functionality to capture geometry from the reference part into the UDF.
1. Center Drilling
2. Deep Drilling
3. Reaming
4. Boring
5. Countersinking
The manufacturing model shown in the illustration above has five NC sequences defined:
Center drilling
Deep drilling
Reaming
Boring
Countersinking
It also has the following relations set up for the workpiece:

-----------------------------------------------------------------------------
RELATION PARAMETER NEW VALUE
/*** Relations for W_BASE:
/* USE EVALUATE FEATURE TO SET GEOMETRY LIMITS
HOLE_DIA = 2*HOLE_DIAM:FID_HOLE_DIMS HOLE_DIA 7.500000e-01
/* CHOOSE BORING OR REAMING TO FINISH HOLE
/* BASED ON FINAL HOLE DIAMETER
IF HOLE_DIA <= 1.25

BORE_REAM = "REAM" BORE_REAM REAM
ELSE

BORE_REAM = "BORE" BORE_REAM REAM
ENDIF
/* SET DRILL SIZE
IF HOLE_DIA >= .6 & HOLE_DIA < .75
TOOL_ID:FID_78 = "DR_19_32" TOOL_ID:FID_78 DR_47_64
ENDIF

IF HOLE_DIA >=.75 & HOLE_DIA <.90
TOOL_ID:FID_78 = "DR_47_64" TOOL_ID:FID_78 DR_47_64
ENDIF
IF HOLE_DIA >=.90 & HOLE_DIA <1.05
TOOL_ID:FID_78 = "DR_7_8" TOOL_ID:FID_78 DR_47_64
ENDIF
IF HOLE_DIA >= 1.05 & HOLE_DIA <1.2
TOOL_ID:FID_78 = "DR_1_1_32" TOOL_ID:FID_78 DR_47_64
ENDIF
IF HOLE_DIA >=1.2
TOOL_ID:FID_78 = "DR_1_3_16" TOOL_ID:FID_78 DR_47_64
ENDIF
----------------------------------------------------------------------------
These relations:
Set the diameter of the hole based on the results of Evaluate
Set the value of a user-defined parameterbore_ream based on the value of the hole diameter
Select a drill based on the value of the hole diameter
To utilize this logic, define a manufacturing UDF (group). Include the workcell and all the five NC sequences. Create the group using the Subordinate and Pro/Program options (using Subordinate ensures that model relations are carried into the UDF). Enter prompts required to place the NC sequences.
Note that both Bore and Ream NC sequences are included in the UDF. The system is going to determine which one to perform based on Pro/PROGRAM logic.
How to Set Up the Bore/Ream Choice
1. On the PROGRAM menu, click Edit Design.
2. Before FID 117 (Ream NC sequence), add the line:
IF BORE_REAM = fl"REAM"
3. Before FID 160 (next NC sequence, Bore), add the lines:
ENDIF
IF BORE_REAM = fl"BORE"
4. After FID 160, add the line:
ENDIF
5. Save and exit from Pro/PROGRAM editor.
6. Incorporate changes into the model by typing y in response to the prompt.
7. On the REGEN TYPE menu, click Normal > Done.
Retrieve another model and place the group there using the Group command on the Edit menu. Click UDF Driven and Read Only, then follow the placement prompts. Regenerate the model.
You can now modify the diameter of the hole in the new model (regenerate twice) and see how the system performs different NC sequences and selects a different tool based on the built-in logic.