SolidWorks Express
CAD Tips for the week of January 17, 2011
 
Quick Background Fill: Here's yet another quick option for adding a background mask to dimension text >>
Data Extraction: Control Table Updates: Use the DXEVAL system variable to control when your data extraction tables are compared with the original data source >>
Data Extraction: Extract to File with Wizard: Besides extracting attribute data to a table, as described last time, you can also save it to an external file >>
Data Extraction: Extract to File with Template: You can also use an attribute extraction template file to create a text file for use with database software >>
   
 
> Quick Background Fill
   
 

Here’s yet another quick option for adding a background mask to dimension text. Select the dimension and right-click. Select Properties from the shortcut menu that appears. In the Properties palette under Text, change the Fill Color to Background.


Caption:Select Background in the Fill Color field.

You may need to adjust the draworder of the dimension text and objects below. Type Draworder at the command line and select the out-of-order objects. Press <Enter>.If needed, select the reference objects and press <Enter> again. Then move the out-of-order objects according to one of the following options:

Above Objects moves the selected objects above the specified reference objects.

Under Objects moves the selected objects below the specified reference objects.

Front moves the selected objects to the top of the order of objects in the drawing.

Back moves the selected objects to the bottom of the order of objects in the drawing.

Or simply enter Texttofront at the command line to bring all text and dimensions in the drawing to the front.


Caption: Dimension with background fill.

   
 
> Data Extraction: Control Table Updates
   
 

Use the DXEVAL system variable to control when your data extraction tables are compared with the original data source. If the data in the table is not current, AutoCAD will display an update notification (or automatically update, if that is what you selected).


Caption: AutoCAD alerts you when data extraction tables become outdated.

Your options are as follows (select multiple options by adding the values together):
0          No notification
1          Open
2          Save
4          Plot
8          Publish
16        eTransmit/Archive
32        Save with Automatic Update
64        Plot with Automatic Update
128      Publish with Automatic Update
256      eTransmit/Archive with Automatic Update

If your drawing is very large, you may notice performance slows down when AutoCAD is updating data extraction tables. In this case, you may want to set DXEVAL to 0 while you work. Just remember to turn it back on when you’re done.

   
 
> Data Extraction: Extract to File with Wizard
   
 

Besides extracting attribute data to a table, as described last time, you can also save it to an external file. Start the Data Extraction Wizard by selecting Data Extraction from the Tools menu. The first screen asks whether you want to create a new extraction or edit an existing one. Save your data extraction file when prompted (you can reuse as a guide for future extractions). Next, you are prompted to save the data extraction (DXE file). On page 2 of the wizard, select the data source. See the tip from last time for more details on options here.

AutoCAD now loads all the source files you specified, which may take a while if you specified a bunch. On page 3 of the wizard, select the objects from which data will be extracted. Page 4 presents the properties of the items you selected on page 3. Check the ones you want to extract.

Page 5 of the wizard presents a preview of what your extraction will look like. Right-click on the column headers to view sorting and filtering options, and to insert formula columns.


Caption: Right-click column headers to access sorting, filtering, and formatting options.

Buttons at the bottom right of the window let you sort columns, link to an external data source (we’ll discuss this in greater depth later), and preview your changes. Select the Sort Columns button to specify the sort order priority.


Caption: Sort Columns dialog box.

On the next wizard page, you select whether to extract to a table or an external file. File format choices for external files are CSV (comma-delimited), TXT (tab-delimited), XLS (Microsoft Excel), and MDB (Microsoft Access). Select Output to External File and browse to the location where you want to save it. Select the file type in the Files of Type field in the Save As box.


Caption: Select the output file type in the Files of Type field.

AutoCAD will now extract your data to the file.

   
 
> Data Extraction: Extract to File with Template
   
 

You can also use an attribute extraction template file to create a text file for use with database software. If you are using AutoCAD LT or an older version of AutoCAD, this method may be your only data extraction option. You can extract the data as a CDF (comma-delimited), SDF (space-delimited), or DXF file. Note: You don’t need a template to extract to a DXF (drawing interchange format) file.

To create your template file, start Notepad or a similar text editor. The template is an ASCII file that defines the structure of the file that will hold the extracted attribute information. The template file will include information such as the tag name, data type, field length, and number of decimal places.

Each field in the template file extracts attribute data from the block references in the drawing. Each line in the template file specifies one field to be written to the attribute extraction file, including the name of the field, its character width, and its numerical precision. Each record in the attribute extraction file includes all the specified fields in the order given by the template file.

Use the following format to extract information from attributes you’ve defined:

attribute_tag Twwwddd

where attribute_tag is the attribute tag, T is the data type (N indicates numeric, C character), www is a 3-digit number that sets the total width of the field (including decimal points and commas), and ddd is a 3-digit number that specifies how many numeric decimal places are displayed to the right of the decimal point.

You can also extract block information such as the following:

BL:NAME Cwww000 (Block name)
BL:LEVEL Nwww000 (Block nesting level)
BL:X Nwwwddd (x coordinate of insertion point)
BL:Y Nwwwddd (y coordinate of insertion point)
BL:Z Nwwwddd (z coordinate of insertion point)
BL:LAYER Cwww000 (Block insertion layer name)
BL:ORIENT Nwwwddd (Block rotation angle)
BL:XSCALE Nwwwddd (x scale factor)
BL:YSCALE Nwwwddd (y scale factor)
BL:ZSCALE Nwwwddd (z scale factor)

Follow these guidelines when creating a template file:

  1. Be sure to place a space between the attribute tag and the character or numeric data. Use the spacebar, not the TAB key, to enter the space.
  2. Press <Enter> at the end of each line, including the last line. Don’t include any <Enters> after the one ending the last line.
  3. Each attribute extraction template file must include at least one attribute tag field, but the same field can appear only once in the file.
  4. Do not use tab characters when constructing the template file. To align the columns, insert ordinary spaces by pressing the spacebar.
  5. Don’t insert extra spaces at the end of any line.

Here is a sample template file that uses some of the attributes from our earlier example

MFG C064000 (Manufacturer's name, 64 characters)
PART_NO C009000 (Part number, 9 characters)
UNIT_COST N010002 (Unit price, 10 characters, 2 decimals)


Caption: Template in Notepad.

Each row in the template becomes a column in the resulting output file. If a block contains some but not all of the attributes listed in the template file, any missing values are filled with blanks or zeros (depending on whether the field is a numeric one or a character one.

You can create any number of template files. Each line of a template file specifies one field to be written in the attribute extraction file.

Once you’ve created your template file in Notepad, save it with a TXT file extension. To extract data using your template, start the Attext command by typing Attext at the command line. In the Attribute Extraction dialog box, click on Template File and select your template file. Select the file format you want  for the extraction (CDF, SDF, or DXF) and name the output file.


Caption: Attribute Extraction dialog box.

Make sure that the attribute extraction file does not have the same name as the attribute template file. Select OK to extract the attributes.


Caption: Output from template-driven data extraction.

   
 
   
 
 
>> SIGN UP for SolidWorks Express Newsletter and get the tips and tricks delivered into your inbox every two weeks!