<!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>Tool Query Dialog</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">Tool Query Dialog</div>
      <hr noshade="true">
      <p class="para_topic">In the Tool Query dialog you can construct rules for a rule-based tool search. </p>
      <div class="title_division">Units</div>
      <p class="para_division">The Units option allows you to select the units of the tool you are selecting. This makes it possible to search for metric tools in an inch part file and inch tools in a metric part file.</p>
      <div class="title_division">Variable Type</div>
      <p class="para_division">Set the Variable Type to Database Attributes. This lists the tool parameters according to the specified class. These parameters can be used for the rule based tool search.</p>
      <p class="para_division">Clicking a tool parameter displays the parameter in the Query Window where the rule is built. &nbsp;</p>
      <div class="title_division">KBE Tool Query Rule (&amp;KFRQ())</div>
      <p class="para_division">This tool query function only uses strings that represent a tool query built with KF rules. Instead of defining the tool class and the query in the dialog, you can build it in a dfa function and execute it by calling this function using &amp;KFRQ(). </p>
      <p class="para_division">You can use this function when an operation uses tools of different classes, where the library class, its subclass, and the query are dependent on certain features or other criteria.</p>
      <p class="para_division">This option is found under: Tool Query Dialog &rarr; Variable Type &rarr; KBE Query Rule</p>
      <p class="para_division">Example:</p><pre class="indent">{&amp;KFRQ(query_from_function())}
Defun: query_from_function()
@{
if ug_cam_ask_FeatureTolerance() = TRUE then 
&nbsp;&nbsp;&nbsp;&nbsp;# Feature has no tolerance information
&nbsp;&nbsp;&nbsp;&nbsp;@{ $class_spec &lt;&lt; ug_cam_askClassOfClassList(&quot;TOOL&quot;,&quot;TOOL;DRILLING;SPOT_DRILL&quot;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$class_qry &lt;&lt; ug_cam_askQueryOfDbcClass(&quot;TOOL&quot;,$class_spec);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$qry &lt;&lt; $class_qry+&quot; &amp;&amp; DB(Diameter) == &amp;KFR(ug_cam_tool_spot_drill_dia())
&nbsp;&amp;&amp; DB(PointAngle) == 90&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;
else 
&nbsp;&nbsp;&nbsp;&nbsp;# Feature has tolerance information
&nbsp;&nbsp;&nbsp;&nbsp;@{ $class_spec &lt;&lt; ug_cam_askClassOfClassList(&quot;TOOL&quot;,&quot;TOOL;DRILLING;CENTER_DRILL&quot;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$class_qry &lt;&lt; ug_cam_askQueryOfDbcClass(&quot;TOOL&quot;,$class_spec);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$qry &lt;&lt; $class_qry+&quot; &amp;&amp; &quot;+&quot;DB(Diam_1) &lt;= 20&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}; 
}String;</pre><p class="para_division">The result of this example is one of the following strings: </p><pre class="indent">[DB(SubType)] == [22] &amp;&amp; [DB(Type)] == [03] &amp;&amp; [DB(libref)] !=0 &amp;&amp; DB(Diam_1) &lt;=20
(Spot Drill)
or
[DB(SubType)] == [21] &amp;&amp; [DB(Type)] == [03] &amp;&amp; [DB(libref)] !=0 &amp;&amp; DB(Diameter) ==
&amp;KFR(ug_cam_tool_spot_drill_dia()) &amp;&amp; DB(PointAngle) == 90</pre><p class="para_division">(Center Drill) </p>
      <p class="para_division">Based upon the features tolerance information, one of these queries is returned and executed.</p>
      <div class="title_division">Operators</div>
      <p class="para_division">The operators ( &gt;, &gt;=, &lt;, &lt;=, ==, !=, SE, SNE, AND, and OR) are combined with the tool parameters and the KF functions to construct the rules.</p>
      <p class="para_division">By switching the Variable Type to KBE Rule &quot;&amp;KFR(&quot; &nbsp;displays. This fragment is expecting a KF rule to be entered for completion.</p><pre class="indent">{
&nbsp;&nbsp;&nbsp;&nbsp;{DB(Diameter) == &amp;KFR(ug_cam_tool_drill_dia_base();)
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&amp;&amp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{DB(FluteLength) &gt;= &amp;KFR(ug_cam_drill_depth_base();)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
}</pre><p class="para_division">Refer to the  <a class="links" href="javascript:void(0)" onclick="top.openFile('mfgholemaking/ex_set_tol_query.html');return(false);">Setting up the Tool Query</a> section for more examples.
      </p>
      <div class="title_division">Check Query Syntax</div>
      <p class="para_division">This option checks the constructed rule for syntax errors according to the tool query syntax.</p>
      <div class="title_division">Sort Order</div>
      <p class="para_division">Selecting the Sort Order button displays the Sort Order dialog. In this dialog you can indicate the desired sequence of the records in the record set by selecting attributes from the Sort By and Then By drop down menus. </p>
      <p class="para_division">The drop-down menus list the Database Attributes. The attribute that is selected in the Sort By option is the attribute used to create the primary sequence. If you want to sort the sequence further, select attributes in the first and second Then By options. </p>
      <p class="para_division">Selecting Ascending or Descending from the Sort By and Then By list sorts each sequence in an ascending or descending order respectively.</p>
   </body>
</html>