<!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>Using Attributes in the Spreadsheet</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">Using Attributes in the Spreadsheet</div>
      <hr noshade="true">
      <p class="para_topic"> You can read and write NX attributes in a manner very similar to the way the spreadsheet handles parametric expressions. These capabilities allow you to extract, edit, and create attributes using the Modeling Spreadsheet.</p>
      <p class="para_topic"> You can integrate attributes and expressions in the spreadsheet to your advantage. Consider the case of using the spreadsheet for variations on a theme. By incorporating attributes into the spreadsheet, the unique text information can be communicated to drafting by using parametric text in the notes, title blocks, and labels of the drawing when a different variation is selected. This means a Modeling spreadsheet can update both the geometry and the drawings in a single operation.</p>
      <div class="title_division"> Extracting Attribute Data from the Part</div>
      <p class="para_division"> Here is an example of NX attribute information that has been extracted from the part and placed into cells in the spreadsheet.</p>
      <p align="center"><img align="bottom" src="graphics/tls_6ssheet1fr07.gif"></p>
      <p class="para_division"> Attributes Extracted to the Spreadsheet</p>
      <p class="para_division"> In the example spreadsheet shown above, the spreadsheet contains a section with expressions in the range A1..B3, and a section with attributes in the range D1..E8.</p>
      <p class="para_division"> In cell D2 there is a part attribute named &quot;NOTICE&quot; it's a part attribute because it does not have an object name in the cell.</p>
      <p class="para_division"> The next cell down refers to an object in the part named &quot;cylinder1&quot;, with the attribute title of &quot;revision&quot;. A space is used to separate object names from attribute titles. A more extensive description of the attribute name field follows in the next section.</p>
      <p class="para_division"> The &quot;E&quot; column contains the values of the attributes. The first value is a string followed by an integer value, a floating point value, and some reference attributes that are displayed as strings. Note that the reference attributes values (cells E7 and E8) are displayed with the raw data format using the angle brackets for the reference. Both cells are referencing the parametric expression for diameter.</p>
      <p class="para_division"> The attribute values can also contain formulas. See Using Formulas for an illustration showing how the formula in cell E8 works.</p>
      <p class="para_division"> In the case above, the active range for attributes would be cells D2..E8.</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">  Attributes can only be extracted from objects in the part that have object names.</p>
                  <p class="para_note_body"></p>
               </div>
            </td>
         </tr>
      </table>
      <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"> All names, both object names and attribute titles, are case insensitive.</p>
               </div>
            </td>
         </tr>
      </table>
      <div class="title_division"> Attribute Naming</div>
      <p class="para_division"> The generic case for an attribute name in the spreadsheet consists of three parts, separated by spaces, with the following form:</p>
      <p class="para_division"> [object_name] attribute_title [qualifier]</p>
      <p class="para_division"> All three parts are required.</p>
      <p class="para_division"> The object_name specifies the object to which the attribute is attached.</p>
      <p class="para_division"> The qualifier differentiates between different types of attributes. The qualifier field is surrounded by parentheses, and contains a keyword to describe the kind of attribute. Possible qualifiers would be:</p>
      <p class="para_division"> (INTEGER) (FLOATING POINT) (STRING) (REFERENCE)</p>
      <p class="para_division"> The system generates all of the fields during the attribute extract command (Spreadsheet Tools&rarr;Extract Attr). You can abbreviate the qualifier fields with the first three or more characters:</p>
      <p class="para_division"> For example: (INT) instead of (INTEGER) For example: (FLO) or (FLOAT) instead of (FLOATING POINT)</p>
      <p class="para_division"> Qualifiers are also case insensitive, so (int) is the same as (INT).</p>
      <p class="para_division"> Cell D3 from the sample spreadsheet [CYLINDER1 REVISION (int)] uses the three name fields in the following way: The object name is CYLINDER1, the attribute title is REVISION, and the qualifier is (int). </p>
      <div class="title_division"> Attribute Values</div>
      <p class="para_division"> You have a good deal of flexibility in composing the value of the attribute that is shown in column E of the spreadsheet shown in the sample spreadsheet. You can use text values, numeric formulas, or any spreadsheet function in order to create the value of the attribute. The spreadsheet will then convert the cell into the proper format for storage in the attribute.</p>
      <p class="para_division"> If the qualifier is not included, the spreadsheet will examine the cell containing the value field and use some logic to determine the kind of attribute being referenced. If the spreadsheet cell contains a number, the attribute will be (INTEGER) or (FLOATING POINT). To determine (INTEGER) or (FLOATING POINT), the program checks for an existing attribute by that title as first a (FLOATING POINT), then as an (INTEGER). If an attribute is found, then that type is used. If nothing is found, then (FLOATING POINT) is used for the attribute type.</p>
      <p class="para_division"> If the spreadsheet cell contains a string instead of a number, then the attribute type is a (STRING) or a (REFERENCE). Similar logic is used to determine the type of parameter, with the preference given to having the attribute be a (REFERENCE) attribute. The program checks for an existing attribute by that title as first a (REFERENCE), then as a (STRING). If an attribute is found of a type, it will be used. If nothing is found then the type will be (REFERENCE).</p>
      <div class="title_division">  Using Formulas</div>
      <p class="para_division"> One of the advantages of the spreadsheet is its ability to create values based on other cells in the spreadsheet. In the case of attributes, the value may contain any of the spreadsheet functions in a formula, instead of plain text. The figure below shows how NOTE2 uses such a formula.</p>
      <p align="center"><img align="bottom" src="graphics/tls_6ssheet1fr04.gif"></p>
      <p class="para_division"> Using a Formula in a Cell</p>
      <p class="para_division"> The formula used for the value of NOTE2 is:</p>
      <p class="para_division"> =@STRCAT(E6,&quot; &quot;,E5,&quot; &quot;,E7)</p>
      <p class="para_division"> This formula concatenates various cells together in order to create the attribute value. If you check the value of the reference attribute in NX, you will find that it is Polished Steel Diameter: 0.5.</p>
      <div class="title_division"> Refreshing Attributes from the Part</div>
      <p class="para_division"> After you have extracted attributes from the part, you can refresh the spreadsheet values if those values were changed using normal NX functions. The Tools&rarr;Refresh Attr command updates attribute values in the spreadsheet and work the same way as the Tools&rarr;Refresh Expr command. When you refresh the attributes, the spreadsheet updates the attribute value cells with the latest values of the attributes.</p>
      <p class="para_division"> The basic procedure is to walk through the active range of attributes and look for cells containing an attribute name. The name will be parsed as described above, in order to find the object name, attribute title, and qualifier. Similar logic as described above is used to determine the type of the attribute if the qualifier is not included.</p>
      <p class="para_division"> The program then checks to see if the attribute exists in the part using the provided or derived qualifier. If an attribute of that type and name does not exist in the part, or if the cell containing the value is protected in the spreadsheet, then no changes are made to the cell containing the value of the attribute.</p>
      <div class="title_division"> Updating the Part with Attributes</div>
      <p class="para_division"> When the NX part is updated, expressions and attributes are updated as required. The update looks for an active range for expressions and attributes, and if it finds one, it updates those expressions or attributes into the NX part. The method for determining the type of attribute during an update is described earlier in the section  <em>Attribute Naming in the Spreadsheet.</em></p>
      <p class="para_division"> During part update, if the attribute is not found in the part, it is created. Using that technique, new attributes can be added to the part or to a named object just by adding the data to cells and including the new cells in the active range.</p>
      <p class="para_division"> Attributes are functionally identical to expressions when it comes to updates. Attributes, along with expressions, also follow the Use Fixed Update Range preference. If you toggle OFF the Use Fixed Update Range preference so that that the current cell is used to select the column or row for update, then the attributes need to be in the same orientation as expressions.</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">    A spreadsheet does not have to contain expressions. Spreadsheets containing only attributes will update exactly as you would expect.</p>
               </div>
            </td>
         </tr>
      </table>
      <div class="title_division"> Access to the Attribute Functions</div>
      <p class="para_division"> Spreadsheet options that support attributes in the spreadsheet include the following:</p>
      <table border="0" cellpadding="2" cellspacing="3" align="center">
         <tr>
            <td bgcolor="#f4f4f4" colspan="1" rowspan="1" valign="top">
               <p class="para_td"> Tools&rarr;Extract Attr</p>
            </td>
            <td bgcolor="#f4f4f4" colspan="1" rowspan="1" valign="top">
               <p class="para_td"> Extract attributes from NX.</p>
            </td>
         </tr>
         <tr>
            <td bgcolor="#f4f4f4" colspan="1" rowspan="1" valign="top">
               <p class="para_td"> Tools&rarr;Refresh Attr</p>
            </td>
            <td bgcolor="#f4f4f4" colspan="1" rowspan="1" valign="top">
               <p class="para_td"> Update the values of attributes currently loaded in the spreadsheet.</p>
            </td>
         </tr>
         <tr>
            <td bgcolor="#f4f4f4" colspan="1" rowspan="1" valign="top">
               <p class="para_td"> Edit&rarr;Define Attr Rng</p>
            </td>
            <td bgcolor="#f4f4f4" colspan="1" rowspan="1" valign="top">
               <p class="para_td"> Define the update range for attributes.</p>
            </td>
         </tr>
      </table><br></body>
</html>