<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<!--
Copyright (c) 2006 UGS Corp.

All Rights Reserved.

This software and related documentation are proprietary to UGS Corp.
-->
<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>Custom Command Library</title>
      <script language="javaScript">
        abridged="false";
        displayConditions=new Array();
      </script>
      <link type="text/css" href="../css/main_styles.css" rel="stylesheet">
   </head>
   <body class="bodydocs" onload="top.pageLoader()" bgcolor="#FFFFFF">
      <div class="title_topic3" id="xps10_pagetitle">Custom Command Library</div>
      <hr noshade="true">
      <p class="para_topic">The following custom commands are available in the custom command directory to add functionality to your post.</p>
      <div class="title_division">pb_cmd_center_of_ball_output</div>
      <p class="para_division">This custom command outputs center of ball in every linear and rapid move block. To use this option, turn on the Output Contact Data button on the Machine Control dialog. This custom command is only valid for the Fixed and Variable Axis Surfacing Contouring modules in NX2 or later. </p>
      <div class="title_division">pb_cmd_cincinnati_pq_cutcom.tcl</div>
      <p class="para_division">Use this custom command to add PQ cutcom vectors to your post. </p>
      <ul>
         <li>
            <p class="para_item">Place the command PB_CMD_pq_cutcom_initialize in the Start of Program event marker. </p>
         </li>
         <li>
            <p class="para_item">Place the command PB_CMD_cutcom_on with the Cutcom On event marker. </p>
         </li>
         <li>
            <p class="para_item">Remove the G40 from the Cutcom Off event marker, the G41 word from the linear, circular and rapid move markers. &nbsp;</p>
         </li>
         <li>
            <p class="para_item">Add the PB_CMD_pq_motion to the linear, circular and rapid move markers. </p>
         </li>
      </ul>
      <p class="para_division">Alternatively you can use the pre-defined controller for the Cincinnati Acramatic control. This control has all of the above pre-defined.</p>
      <div class="title_division">pb_cmd_coordinate_system_rotation</div>
      <p class="para_division">This custom command outputs the code needed to cause a coordinate system translation and rotation on the control. &nbsp;Starting in NX2 a MOM_set_csys event with a coordinate system type and matrix will be output at the start of every tool path where the MCS changes. If the coordinate system type is csys, the system converts the coordinate system into the rotations and translations needed. </p>
      <p class="para_division">This custom command must be placed in the Start of Program event marker.</p>
      <p class="para_division">You can modify this custom command to output the code you need for a specific control. For Fanuc, Siemens, Heidenhain and Mazatrol, the specific code is included.</p>
      <p class="para_division">This custom command is used primarily for head/table five-axis or head/head five-axis machine tools.</p>
      <p class="para_division">When you set the type to siemens you have the following choices: fanuc, siemens, heidenhain_iso, heidenhain_conv, mazatrol. These custom commands are intended for general cases. You may find that you need to make some adjustments to get the desired output.</p>
      <div class="title_division">pb_cmd_fixture_offset_with_G10 </div>
      <p class="para_division">This custom command determines the correct information for the G10 work coordinate system definition. Place this custom command in the Start of Program event marker. The system outputs a G10 block every time the MCS changes.</p>
      <p class="para_division">You must define a main MCS in the Geometry View. This coordinate system must be coincident with machine tool coordinate system and located at the center of rotation of the fourth axis. You can then create your MCS's under the main MCS in the Geometry View. &nbsp;</p>
      <p class="para_division">You may need to customize the MCS dialog. If so, add the option for Coordinate System Purpose and Special Output to the MCS dialog. Set Coordinate System Purpose to MAIN for the main MCS and LOCAL for the local MCS. The Special Output should be set to FIXTURE OFFSET.</p>
      <p class="para_division">For four axis machines the coordinates systems must meet the following criteria:</p>
      <table cellspacing="3" align="center">
         <tr valign="top">
            <td bgcolor="#f4f4f4" colspan="1" rowspan="1">
               <p class="para_td">For rotary axis tables in the YZ plane </p>
            </td>
            <td bgcolor="#f4f4f4" colspan="1" rowspan="1">
               <p class="para_td">the X axis of the local MCS must be parallel (not reversed) with the X axis of the main MCS</p>
            </td>
         </tr>
         <tr valign="top">
            <td bgcolor="#f4f4f4" colspan="1" rowspan="1">
               <p class="para_td">For rotary axis tables in the ZX plane </p>
            </td>
            <td bgcolor="#f4f4f4" colspan="1" rowspan="1">
               <p class="para_td">the Y axis of the local MCS must be parallel (not reversed) with the Y axis of the main MCS</p>
            </td>
         </tr>
         <tr valign="top">
            <td bgcolor="#f4f4f4" colspan="1" rowspan="1">
               <p class="para_td">For rotary axis tables in the XY plane </p>
            </td>
            <td bgcolor="#f4f4f4" colspan="1" rowspan="1">
               <p class="para_td">the Z axis of the local MCS must be parallel (not reversed) with the Z axis of the main MCS</p>
            </td>
         </tr>
         <tr valign="top">
            <td bgcolor="#f4f4f4" colspan="1" rowspan="1">
               <p class="para_td">For three axis mills</p>
            </td>
            <td bgcolor="#f4f4f4" colspan="1" rowspan="1">
               <p class="para_td">the X, Y and Z axis of the local MCS must be parallel with X, Y and Z axis of the main MCS.</p>
            </td>
         </tr>
         <tr valign="top">
            <td bgcolor="#f4f4f4" colspan="1" rowspan="1">
               <p class="para_td">Five axis mills</p>
            </td>
            <td bgcolor="#f4f4f4" colspan="1" rowspan="1">
               <p class="para_td">XZC mills and lathes are not supported with this function.</p>
            </td>
         </tr>
      </table><br><div class="title_division">pb_cmd_helix.tcl</div>
      <p class="para_division">Use this custom command to add a handler for the event MOM_helix_move. You can also define how the system outputs the helix pitch. Place the command PB_CMD_initialize_helix at the Start of Program event marker. The helix event now uses the circular move block to output the helix block.</p>
      <div class="title_division">pb_cmd_init_turbo</div>
      <p class="para_division">Place this custom command in the start of program event marker. It will initialize turbo output mode.</p>
      <p class="para_division">The execution time will be about five to ten times faster than normal processing time. The blocks being output are similar to the Fanuc type. A special set of turbo blocks are used for the Heidenhain Conversational control.</p>
      <p class="para_division">The system will display the following turbo blocks in the Block section of N/C Data definitions:</p>
      <ul>
         <li>
            <p class="para_item">linear_move_turbo</p>
         </li>
         <li>
            <p class="para_item">circular_move_turbo</p>
         </li>
         <li>
            <p class="para_item">circular_move_1_turbo &nbsp;(Heidenhain only)</p>
         </li>
         <li>
            <p class="para_item">rapid_move_turbo</p>
         </li>
         <li>
            <p class="para_item">sequence_number_turbo</p>
         </li>
      </ul>
      <p class="para_division">To modify the output of a word within the turbo blocks, modify the Word parameters with the N/C Data Definitions dialog. You can also modify the Format parameters. The turbo processor uses the words and formats to output turbo blocks. However, you can not, edit the expression in the words, remove words, or add words in any turbo block. </p>
      <p class="para_division">The reason that Turbo mode is faster is that no expressions are evaluated.</p>
      <p class="para_division">All rapid motion is output in a single move. Any custom commands in the linear move, circular move, rapid move and mom_before_motion event markers are ignored by the system.</p>
      <p class="para_division">The turbo postprocessing mode only supports three axis mills.</p>
      <table border="0">
         <tr>
            <td valign="top" align="left"><img align="left" src="../graphics/note.gif" alt="Note" title="Note"></td>
            <td valign="bottom" align="left" width="100%">
               <div class="para_note">
                  <p class="para_note_body">This custom command may only be used with Post Builder 3.2.1 or later and NX2 or later. The Heidenhain Conversational functionality can only be used with NX3 or later.</p>
               </div>
            </td>
         </tr>
      </table>
      <div class="title_division">pb_cmd_simulated_cycles.tcl</div>
      <p class="para_division">Use this custom command to simulate any one of the standard canned cycles. You can modify the custom PB_CMD_initialize_spindle_axis to specify a spindle axis other than along the positive Z axis. See the  <a class="links" href="javascript:void(0)" onclick="top.openFile('postbuilder/prog_cycle_sim_cycles.html');return(false);">simulated cycle</a> section for details. 
      </p>
      <div class="title_division">pb_cmd_spindle_rpm_range_select.tcl</div>
      <p class="para_division">This custom command automatically selects the spindle range based on the current spindle rpm. &nbsp;Place the command PB_CMD_ spindle_rpm_range_select in the Start of Operation sequence before you output the spindle range code for the operation. This custom command only selects the spindle range, for details on how it can be output see the section on  <a class="links" href="javascript:void(0)" onclick="top.openFile('postbuilder/prog_spindle_output.html');return(false);">Spindle Output.</a></p>
      <div class="title_division">pb_cmd_spindle_sfm_range_select.tcl</div>
      <p class="para_division">This custom command automatically selects the spindle range to output based on the current spindle sfm. Place the command PB_CMD_ spindle sfm_range_select in the Start of Operation sequence before you output the spindle range code for the operation. This custom command only selects the spindle range, for details on how it can be output see the section on  <a class="links" href="javascript:void(0)" onclick="top.openFile('postbuilder/prog_spindle_output.html');return(false);">Spindle Output</a>.
      </p>
      <div class="title_division">pb_cmd_spindle_table.tcl</div>
      <p class="para_division">This custom command allows you to define the S code table that the system uses for each spindle rpm and range. You need to modify the custom command &nbsp;PB_CMD_get_spindle_table_scode for your machine. The default is nine ranges and nine S codes per range. You need to place the command PB_CMD_ spindle_table in the Start of Operation sequence before you output the spindle S code for the operation. This custom command only selects the S code, for details on how it can be output see the section on  <a class="links" href="javascript:void(0)" onclick="top.openFile('postbuilder/prog_spindle_output.html');return(false);">Spindle Output</a>.
      </p>
      <div class="title_division">pb_cmd_tape_length.tcl</div>
      <p class="para_division">This custom command allows you to determine the actual tape length in feet. Place the custom command PB_CMD_ptp_size at the end of the End of Program event marker.</p>
      <div class="title_division">pb_cmd_three_dimensional_tool_offset </div>
      <p class="para_division">This custom command outputs 3d cutter compensation blocks for Fanuc type controls. </p>
      <p class="para_division">The initial block will look like the following:</p><pre class="indent">G41 G01 X Y Z I J K D</pre><p class="para_division">I,J,K represent the contact normal output.</p>
      <p class="para_division">You will need to do the following to your post in Post Builder:</p>
      <ol type="1" start="1">
         <li>
            <p class="para_item">Add I,J, and K words to the linear move block using the following user defined expressions for each:</p>
            <p class="para_item">&nbsp;&nbsp;&nbsp;I -- $mom_contact_normal(0)</p>
            <p class="para_item">&nbsp;&nbsp;&nbsp;J -- $mom_contact_normal(1)</p>
            <p class="para_item">&nbsp;&nbsp;&nbsp;K -- $mom_contact_normal(2)</p>
         </li>
         <li>
            <p class="para_item">Add the following line (without the #) to the custom command PB_CMD_before_motion</p>
            <p class="para_item">#PB_CMD_three_dimensional_tool_offset</p>
         </li>
         <li>
            <p class="para_item">Add the custom command PB_CMD_cutcom_on to the event marker Cutcom On under Program/Tool Path/Machine Control.</p>
         </li>
      </ol>
      <p class="para_division">To use this command turn on the Output Contact Data button on the Machine Control dialog and turn off circular interpolation output. Then output a CUTCOM/LEFT to activate the G41 block.</p>
      <p class="para_division">This option is only valid for the Fixed and Variable Axis Surfacing Contouring modules in NX2 or later.</p>
      <div class="title_division">pb_cmd_tool_list.tcl</div>
      <p class="para_division">This custom command allows you to output a tool list either at the start or end of your nc file. Place the custom command PB_CMD_initialize_tool_list in the Start of Program event marker. Then place the custom command PB_CMD_create_tool_list either after the custom command PB_CMD_initialize_tool_list in the Start of Program event marker or in the End of Program event marker.</p>
      <div class="title_division">pb_cmd_zw_axis.tcl</div>
      <p class="para_division">This custom command allows you to control the output of parallel Z and W axis. This is typically a situation where you have quill (Z axis) that has limited travel and a table (W axis) that has more range of motion. The post keeps track of the quill and table at all times and applis the current position of the parked axis while the other one is positioning. &nbsp;</p>
      <p class="para_division">To use this option you must place the command PB_CMD_initialize_parallel_zw_mode in the Start of Program event marker. You can now edit the custom command PB_CMD_initialize_parallel_zw_mode and define the home position for the Z and W axis and the leader you wish to use for the quill and table. The default is Z and W.</p>
      <p class="para_division">The system contains several useful custom commands to control the Z and W axis. These commands may be placed with any event marker. &nbsp;</p>
      <table bgcolor="#F7F7F7" cellspacing="2" align="center">
         <colgroup span="1">
            <col span="1" width="50*">
            <col span="1" width="149*">
         </colgroup>
         <tr valign="top">
            <td colspan="1" rowspan="1">
               <p class="para_td">PB_CMD_set_quill_home</p>
            </td>
            <td colspan="1" rowspan="1">
               <p class="para_td">Positions the quill to its home position at rapid.</p>
            </td>
         </tr>
         <tr valign="top">
            <td colspan="1" rowspan="1">
               <p class="para_td">PB_CMD_set_table_home</p>
            </td>
            <td colspan="1" rowspan="1">
               <p class="para_td">Positions the table to its home position at rapid.</p>
            </td>
         </tr>
         <tr valign="top">
            <td colspan="1" rowspan="1">
               <p class="para_td">PB_CMD_set_mode_zaxis</p>
            </td>
            <td colspan="1" rowspan="1">
               <p class="para_td">The W axis (table) is parked. &nbsp;The Z axis (quill) will now position.</p>
            </td>
         </tr>
         <tr valign="top">
            <td colspan="1" rowspan="1">
               <p class="para_td">PB_CMD_set_mode_waxis</p>
            </td>
            <td colspan="1" rowspan="1">
               <p class="para_td">The Z axis (quill) is parked. &nbsp;The W axis (table) will now position</p>
            </td>
         </tr>
      </table><br><p class="para_division">Additionally you can also use the UDE post commands SET/MODE,ZAXIS and SET/MODE,WAXIS to change to mode of output. The UDE post commands SET/ZAXIS,z and SET/WAXIS,w can also be used to position the axis.</p>
      <p class="para_division">You can also assign additional parameters to your cycle block.</p>
      <div class="title_division">Prerequisite: NX 2.0.1</div>
      <ol type="1" start="1">
         <li>
            <p class="para_item">Create a CYCLE in your ude.cdl file</p>
            <ol type="a" start="1">
               <li>
                  <p class="para_item">Copy the following and paste it into your ude.cdl file in the user defined events folder, but be sure to remove the comments (). &nbsp;</p>
               </li>
               <li>
                  <p class="para_item">Replace every instance of &quot;special&quot; with the name of your cycle. &nbsp;</p>
               </li>
               <li>
                  <p class="para_item">Add as many parameters as you like. </p>
                  <p class="para_item">For example, the line &quot;PARAM special_cycle_param_1&quot; will generate a mom variable mom_special_cycle_param_1 when the cycle is generated. You can then use the mom variable as an expression when you add a word to your cycle block. The syntax for a CYCLE is the same as any other UDE except for CYCLE instead of EVENT. &nbsp;&nbsp;</p><pre class="indent">CYCLE special 
{ 
UI_LABEL &quot;Special&quot; 
PARAM special_cycle_param_1 
{ 
&nbsp;&nbsp;&nbsp;TYPE d 
&nbsp;&nbsp;&nbsp;DEFVAL &quot;0.0000&quot;
&nbsp;&nbsp;&nbsp;UI_LABEL &quot;Special cycle value 1&quot;
}
PARAM special_cycle_param_2 
{ 
&nbsp;&nbsp;&nbsp;TYPE d 
&nbsp;&nbsp;&nbsp;DEFVAL &quot;0.0000&quot;
&nbsp;&nbsp;&nbsp;UI_LABEL &quot;Special cycle value 2&quot;
} 
}</pre></li>
            </ol>
         </li>
         <li>
            <p class="para_item">Add a cycle block in N/C Data Definitions for each new cycle. </p>
            <ol type="a" start="1">
               <li>
                  <p class="para_item">Go to the N/C Data Definitions tab. </p>
               </li>
               <li>
                  <p class="para_item">Select block. &nbsp;</p>
               </li>
               <li>
                  <p class="para_item">Select one of the cycle blocks, cycle drill is good. </p>
               </li>
               <li>
                  <p class="para_item">Select create. </p>
               </li>
               <li>
                  <p class="para_item">Rename the block by right clicking. Give it the name of your cycle preceded by cycle_. </p>
               </li>
               <li>
                  <p class="para_item">Right click on the G address in the block and select Change Element and then User Defined Expression. </p>
               </li>
               <li>
                  <p class="para_item">Enter the number for your G code.</p>
               </li>
            </ol>
         </li>
         <li>
            <p class="para_item">To add additional parameters to the block</p>
            <ol type="a" start="1">
               <li>
                  <p class="para_item">Select New Address from the pull down. </p>
               </li>
               <li>
                  <p class="para_item">Select add block and add the word to your block. </p>
               </li>
               <li>
                  <p class="para_item">Change leader, format and modality as needed. For format, use coordinate for numeric data and digit_2 or digit_4 for integer data. </p>
               </li>
               <li>
                  <p class="para_item">Enter your mom variable from the ude.cdl the expression. </p>
               </li>
               <li>
                  <p class="para_item">Go to word sequencing if your new word is not in the order you need.</p>
               </li>
            </ol>
         </li>
         <li>
            <p class="para_item">Add this custom command to the Start of Program event marker. If you have a linked post, this custom command must be in the main post Start of Program. </p>
         </li>
         <li>
            <p class="para_item">Make sure the name of your cycle in the ude.cdl is the same as the name of the event handlers.</p>
         </li>
         <li>
            <p class="para_item">Make sure the names of your cycle parameters in the ude.cdl PARAM section are the same as in the cycle block in N/C Data Definitions except preceded with mom_.</p>
         </li>
         <li>
            <p class="para_item">There are two basic kinds of canned cycles listed here. Use the cycle start cycle for Maho, Heidenhain, etc. Use the standard one for Fanuc, Siemens, Fadal, Mazatrol, etc.</p>
         </li>
      </ol>
   </body>
</html>